Discussion: Where to store additional data

Discussion in 'Learning Javascript' started by Andar, May 6, 2016.

  1. Andar

    Andar Veteran Veteran

    Messages:
    28,613
    Likes Received:
    6,568
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    I would like to get some scripter's opinions on where to store additional data (preferably with advantages and disadvantages), before I decide how to handle that in my own projects.


    The most commonly used method is to store everything in the noteboxes of the database. This has the advantage of compatibility and being a well-developed method.


    Unfortunately, if your project needs a lot of additional data, it gets difficult to read and scroll through.


    One other method is to basically use external storage of some form - either text files with more date (or redirected notetags into those text files), or placing the data in the script lines (Modern Algebra's Quest Journal for Ace is one example for this) or possibly in MV's plugin parameters.


    For some cases like translating texts to be used in show texts external textfiles have additional advantages, but when it comes to assigning data to existing database objects (like actors or equipments) this has the disadvantage of splitting the data into different places (the game database and whatever other place is used). This might cause confusion, especially if you accidentally look at the wrong file.


    However, I can think of a third way to handle at least some of the data in a logical way, that reduces the load on the notebox:


    reassigning unused editor data


    Example: let's assume I want to change the skill/damage sequence from the default of HIT%/EVA% to one where an attack quality gets compared with a parry quality to determine if the target is hit or not. Instead of placing the battler's data into the notebox I can decide to assign the attack skill to HIT% and the parry skill to EVA%, knowing that I won't use that data for anything default in the project.


    There are a lot more similiar possibilities, but for some reasons it isn't done in the scripts/plugins I know of.


    The advantage of handling the data this way is of course to have it easier to use the editor for data input.


    And I also can see that this might cause compatibility problems: if you don't know what other plugins a developer using a script might use, that redirect of data use might result in breaking the functions of the other plugin.


    But if you're building a specific engine instead of general-purpose plugins and plan to use that for several games, then I think this method might be better than overloading the notebox (which will get used for more data anyway)..


    So what are your opinions? have I overlooked some other advantages or disadvantages, or would this third method be preferable for something like a specific engine?
     
    #1
  2. Gatene

    Gatene Intermediate Scripter Member

    Messages:
    11
    Likes Received:
    1
    Location:
    South Carolina
    First Language:
    English
    Hello Andar,


      I began to understand what I thought you meant when you said bout storing data in notepad documents, but then you lost me again later when you gave an example. If I understood you correctly, then my notes that I make on my own code (things I need to remember, etc) I usually store in comments throughout my code, or write them in the notebook where I take notes about the things I learn in javascript (I was familiar with javascript before RMMV, but RMMV teaches me a lot more). I have different notebooks with subject dividers and proper hearders for a variety of notes, ideas, things I need to remember, etc, so I won't get confused and read the wrong thing. this is just how I learn, and we all do it differently. Did I miss the whole point of this discussion? lol


    Gatene
     
    #2
  3. Andar

    Andar Veteran Veteran

    Messages:
    28,613
    Likes Received:
    6,568
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    @Gatene This is not about storing notes for development somewhere, this is about storing game data to be processed by plugins, and one of the methods has always been to store that game data in the database' notebox (for example a lot of Yanfly's scripts do this). It can't be manually written in physical notebooks, because the program cannot read them.
     
    #3
  4. Gatene

    Gatene Intermediate Scripter Member

    Messages:
    11
    Likes Received:
    1
    Location:
    South Carolina
    First Language:
    English
    I figured I missed the whole point lol. Hmmm, if it were me...I would make various variables or arrays (depending on what kind of notes I were taking) that I could easily access with my scripts...like for my game, each character has their own item set, and no item has multiples, so if you have 2 potions, then two different items are named potion. In the same multidimensional array, I have options and notes about each character's "bag" that can be tweaked by the user or me as I create new scripts. If I still missed the point then I apologize.


    Gatene
     
    #4
  5. Andar

    Andar Veteran Veteran

    Messages:
    28,613
    Likes Received:
    6,568
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    Yes, you're still missing it - it is not about the coding structure of the internal data storage, it's about where to write down the data in a way that the code can read it and fill those arrays you're talking about. Because filling them in the javascript code directly would be the worst solution, the other three options would be much easier.
     
    #5
  6. Tsukihime

    Tsukihime Veteran Veteran

    Messages:
    8,230
    Likes Received:
    3,067
    Location:
    Toronto
    First Language:
    English
    I use standard data formats to store data.


    Formats I have used in MV plugins include CSV and JSON.


    CSV is used for inherently tabular data, such as that shown in parameter tables or exp tables.


    JSON is used for more general structures.


    Any serialization format would be suitable.


    By using a common format, additional tools can be written on top of it, so that you can have multiple applications communicate using the same medium. 


    Specifically, you would have a specialized tool manage this extra information, and MV would just consume it like any other piece of data.


    For that matter, I would simply store it in MV's database files directly: MV doesn't remove extra fields that it doesn't use, so you can just add new fields easily without having to worry about dealing with multiple files. It would be better to introduce an "external database editor" that is more customizable than MV's default database editor.


    For anything that isn't related to the database, I would just use JSON or something.


    Data sync'ing is about the only issue I'd be concerned with.


    For example, you decide to add or delete an entry from the database in MV, and the external tool doesn't automatically refresh itself to take note of this.


    RPG maker is notorious for not providing an easy way to refresh the project, short of closing and opening it, so there's already no real-time sync'ing there.
     
    Last edited by a moderator: May 7, 2016
    #6
    Zeriab likes this.
  7. Gatene

    Gatene Intermediate Scripter Member

    Messages:
    11
    Likes Received:
    1
    Location:
    South Carolina
    First Language:
    English
    Heh, I get it now. I've never tried anything like that when scripting. I do not do it often when I program or write javascript code for the web either, but when I have in the past, it was too simplistic. The external data never followed an algorithm, format, etc. just simple text insertions separated by a line feed in good ole' notepad...I know it makes data easier to read, keeps your code light, etc...I'm just the simplistic type. Heh, sorry it took so long for it to click.


    Gatene
     
    Last edited by a moderator: May 7, 2016
    #7

Share This Page