Open HimeWorks opened 9 years ago
Looking forward to more of this.
The actual storage of the file is pretty much up to you. You can use a text file, you can use ruby's serialization like other data files, you can encrypt it compress it all you want.
What's important for me is how you can access it. Because different people may have different security requirements, I would provide an interface that allows you to get and set data, and allow other scripters to implement them as needed.
I would provide an implementation that would use a similar format as the save files.
Let's consider accessing global data.
GlobalData.switch(1)
GlobalData.switch(1, true)
GlobalData.get_switch(1)
GlobalData.set_switch(1, true)
This is one way that you might expose data access by forcing them to go through the interface. Alternatively, you might do it like this
GlobalData.get(:switch, 1)
GlobalData.set(:switch, 1, true)
Where you provide a key as the type of data you want, and some arguments. There's no real difference between them.
Another way to approach this is, instead of thinking of it as some complicated format, why not just think of it as a huge hash map?
GlobalData.set("switch1", true)
GlobalData.set("variable 3", 34)
GlobalData.set("main actor", $game_party.leader)
There's no real reason why it should be complicated: you just need to be able to store data somewhere and get it back right?
thinking in getters and setters is how I originally learned to code... Working in IDE's made me think I was a better coder than a really was... :D
Back when I first started messing with RMVXA I wanted an easy way to record info outside the normal database and save file, but settled for a lot less.
I might have a lot of use for this, if/when you get it done.
The way I have presented the solution, it's basically a huge hash map, rather than having pre-defined data types (eg: switch array, variable array, etc)
This basically means gamedevs will decide how to organize this data. But I'm not sure how user-friendly that might turn out to be.
The engine provides save files by default. Save files store information about a specific instance of the game.
However, sometimes we might want to operate with data that is independent of the save files themselves, which you can call "global data"
There are several different scripts already
Engr. Adiktuzmiko: http://forums.rpgmakerweb.com/index.php?/topic/20304-game-custom-data-v126/ Skul_: http://www.rpgmakervxace.net/topic/6462-global-save-file-by-skul/
Just some examples. There are more out there.
In general, we need support for the following operations