Just an idea, but in my opinion those players have static and dynamic data... just like actors, right?
So why don't you make a "Player.json" file that would be read in a $dataPlayers variable and that contains all the static data (what will not change between two playthrough), and a $gamePlayers variable with their dynamic data - the consequences of the player's choices and random events - and only a reference to their static data structure.
You would have to replicate a bit of the Actor classes logic.
For example the name of the player could be $gamePlayers[x].player().name
The $dataPlayers array would be the biggest one and has no need to be saved, only $gamePlayers should be added to saves - if it is done correctly.
Just my 2 cents.
The name is the only data that will never change. A skills can be trained, al traits can be learned and statistics change all the time as well.
I would love to know how to make a json file for static data, but there is hardly no static data in my game. Even the starter data isn't pre-programmed, but generated at the start of the game.
I've been thinking about making player data variable and opponent data static, but that would take away 90% of the dynamics of the game. The weakest opponent will always be the weakest and the strongest will always be the strongest. It would make it impossible to have red-cards and injuries for opponent teams, or to improve them by training, or lose stats because of age.
So, yeah, I'd love to learn how to use a Json fine the way you described, but but for this problem, I need to be able to edit the files.
What you describe sounds like what I am looking for, if it means I can (occasionally) save data in there.
Then the game can be saved normally on action, to keep the actions played, but it doesn't need to save the whole database over and over again. I'd still have to save the database after each match, but that is acceptable. At least if it is possible.
Actually it is a very good idea I think.
Just let the generated data piggyback another json so you don't have to write another function to load them.
But you need to be caureful if you open it in the editor the data maybe changed due to the size limit of the textbox.
Or you can save the json string inside a common event and load it by running the event, which looks more natural.
Edit* Though it can only work on pc, not web browsers.
No, I save and generate the array in the plugin itself, outside RPGmaker. The plugin generates a large array, with all that data in there, and then that whole array is loaded into the gameVariable. I don't use a common event or anything, just a single plugin command.
I don't have to worry about textbox sizes. The generation and storage of the arrays don't use any textboxes at all.
Mayb I don't understand you right... What do you mean by saving the json string in a common event?
some games I do has file size of 30kb-60kb but goes up to 4MB the further
you go in the game of the items you collect, so it can increase slowly of all
the data.
it's also part of "what data" is being saved, as if you don't save anything, the
size are relative small most of the time.
but there are options to save and extract data when required and possible to
keep the save file lower and call them on loading the save file.
I don't mind if loading takes 5-10 seconds, as some games it's more than that
because of the big size map, so it's worth the wait if it does what it needs to do.
5 to 10 seconds? Yikes! And I was worried about 1 or 2 seconds!
😛 hahaha. Well, a few seconds saving time isn't a problem, but then saves have to be timed when possible, like on a transfer, or after a battle. If I want to generate +/- 30~45 action per match, and it needs to save for seconds after every action, it gets a bet more annoying.
So what I basically would want, is a quick save and a full save, or something.
😛 But that seems way out of my league. But that is what I try to achieve with saving the large array outside the actual saving file.
😛