Save data too big - what are the implications?

There's one map in my game where I'm getting this error message when I save, but the save (to my PC) is still successful.

Is this something that will cause saving to fail if the game is played on a mobile device?

The map is 100x101 tiles, and I have 103 events, the majority being "waterfall" type events - 3 pages with a different image on each page, conditioned by a variable, with no event commands. I haven't added monsters & loot here yet. I have other maps that are just as large, but not as many events, where I don't get the message.

I'm pretty sure $dataMap is not saved?
$dataMap is not saved. All that is saved can be seen in DataManager.makeSavefileInfo (if I remember correctly). Not sure how many plugins you use that extend this data though.
Not many - 24 small plugins, less than half of those would add new class variables, and they wouldn't add any more than 3 or 4 variables to a single class. So negligible.
I see. Btw. it's not makeSavefileInfo, but makeSaveContents. My bad 😀
It doesn't save $dataMap, only $gameMap. It also saves all your actors, switches, self switches and variables. So savefile data could be big from numerous reasons, including huge actor database.

When I have this error in a game I playtest, it usually passes well despite that though. In the worst case you can increase the byte limit inside the core scripts.
I do not think you have to worried.
We are talking about Json information and therefore kilobyte.
i do not know where the message come from.
Can you share a print screen with CTRL+V in the message box?

I personally use the node module for my save data.
Small example:
PHP:
        let filePathName = `data/MapSprite${$gameMap._mapId.padZero(3)}.json`;
        let fs = require('fs');
        let content = JSON.stringify(DATAS);
        fs.writeFile(filePathName, content, 'utf8', function (err) { if(err){return console.log(err) }});
If I put my starting spot on this map, with just a single actor, no equipment, no items, and save, I don't get the error - save file is about 51K.
If I add a second party member, no equipment, no items, and save, I get the error - save file is 60K.

The error message is:
Code:
Save data too big! (241182)

and it comes from here, in rpg_managers.js (I added the length to the error message):
Code:
DataManager.saveGameWithoutRescue = function(savefileId) {
    var json = JsonEx.stringify(this.makeSaveContents());
    if (json.length >= 200000) {
        console.warn('Save data too big!');
    }
    StorageManager.save(savefileId, json);
    this._lastAccessedId = savefileId;
    var globalInfo = this.loadGlobalInfo() || [];
    globalInfo[savefileId] = this.makeSavefileInfo();
    this.saveGlobalInfo(globalInfo);
    return true;
};

Isn't there something about the game being saved in cookies, which might have a maximum length? Does that still happen? Because my games are being saved to the saves folder inside the project folder.

Maybe something to do with this?
Code:
StorageManager.saveToWebStorage = function(savefileId, json) {
    var key = this.webStorageKey(savefileId);
    var data = LZString.compressToBase64(json);
    localStorage.setItem(key, data);
};


I don't want to change the code to make it bigger - I want to know why the error shows just on this map, and what the consequences are going to be - there must be something that's going to happen if the file is too big, or it wouldn't show the error.

I expect once I start adding in monsters, loot, NPCs, and start filling out the database with stuff, my save files are going to be quite a bit bigger than that! Just adding a single actor looks to add about 9K, and I will have a maximum of 9 actors in the party (plus others who have temporarily joined but no longer there, and their data will be retained in $gameActors).
json.length >= 200000 ??? it count letters in string!, that have no sense !
more information on limit size. max 5 GB
https://www.ibm.com/support/knowledgecenter/en/SS9H2Y_7.6.0/com.ibm.dp.doc/json_parserlimits.html

it maybe related to the software limitation and not the engine limitation.
In one of my old projects I have a savefile of 43 KB. That means there is some kind of data that takes a lot of space converted to the string. However, the only good way to analyze that would be to save the uncompressed string and take a look at it.
Which is a lengthy job 😀

I wouldn't be worried about that though. I've never encountered a problem on my weak-o-machine with games throwing me Save data too big. The error is not an error after all, just a warning that you have a big savefile. But 61 KB is still perfectly fine for computers to handle. Maybe phones would have troubles with it? I don't know.
I could point you towards some simple unification of those 100 events, but I'm not sure how to code it in JS.
basically, you would store the events themselves as a few lines of code, and at the moment of loading the map, they'll all take position and activate themselves.

that *should* take the data load off the map itself and put it into the scripts.

I have something like that for Ace, and it's amazingly versatile (I'm having those non-existent events trigger common events and interact with the player), so it *should* handle a few static events with no problem
......in theory.
But 61 KB is still perfectly fine for computers to handle. Maybe phones would have troubles with it? I don't know.

If any one of your devices has to worry about a handful of KB then I heavily doubt it can even run MV games (either at all or without significant performance issues) to begin with. I'd be more worried about trying to load a 100x101 map with 103 events (especially if parallel), tbh
@TehGuy I know. The warning is not there without reason though. So I'm trying to think what could it be. But as I said, it's nothing one should be worried of, at least with computers.
@TehGuy I know. The warning is not there without reason though. So I'm trying to think what could it be. But as I said, it's nothing one should be worried of, at least with computers.
The warning was added by a rmmv dev, this message has no reason to be.
Simply suppress it.
Maybe theres a limit of time to load saves, and because of it the Save files need to be as small as possible, idk
I had a look at the code, and it seems that all events are stored in the save file.
This is probably to ensure that events (the ones that move around) don't suddenly disappear when you save and load.

If you're really worried about the warning, you could write a plugin that removes non-essential events (like in your case waterfall events) from $gameMap upon saving the game (then adds it back it after saving). I'm sure these events will be re-added when the game is loaded, but if not, it should be a trivial fix at that point.

I'd like to write that plugin, but I'm unfortunately too busy for that at the moment...
The warning was added by a rmmv dev, this message has no reason to be.
based on what information?

The devs wouldn't just throw warnings like that in there for no reason.

If you are saying "get rid of it", I want to know what research you have done into why the message is there, and how you know it won't harm anything to remove it. I want to know that it's not just an opinion off the top of your head, but that you do have something to back it up. You've spent a lot of time pulling the engine apart, but have you gone through the storage manager code thoroughly? I can get rid of it, or I can make it larger. But not without a solid reason. I want to know why it's there in the first place. I did mention in an early post that at one stage, saved games used to be stored in cookies. Maybe THAT is the reason, and maybe that was changed, but the line was never removed. I want to know what restrictions I could be placing on the game or devices that can play the game, by removing/ignoring that warning, before I remove/ignore it.

I cringe when I see people ask if they can use certain resources and others say "yeah, you should be able to - I can't see a problem with that", when they're giving nothing but their opinion, don't know the facts, and haven't taken the time to look into it. The same when someone says they're getting a script error, and they have no idea how to read code, but they fixed the error by deleting the line that threw it. It might be an answer, and it might appear to solve the OP's problem, but it could be setting them up for more issues down the track.
I cringe when I see people ask if they can use certain resources and others say "yeah, you should be able to - I can't see a problem with that", when they're giving nothing but their opinion, don't know the facts, and haven't taken the time to look into it. The same when someone says they're getting a script error, and they have no idea how to read code, but they fixed the error by deleting the line that threw it. It might be an answer, and it might appear to solve the OP's problem, but it could be setting them up for more issues down the track.

You know, it's probably the second or third time I see you answer adding some anger in it(After the first, which was to me, I even avoided asking you more things). A bit of politeness would be cool, since he's stopping by to help you, with your problems that doesn't matter to him or anyone else.

By the way: There's no answer inside the code itself that I could find.

On the web, I found that Chrome can only store 10MB(Using stuff like localStorage) per origin. If each origin means each website/IP(Which I don't think but...), then probably they limit those files' size to be the smallest possible to store then in the website localStorage without losing other stuff from there(including other saves)
I don't believe my post contains anger, and I'm sorry you feel that it does. I just want an explanation for the advice being given. My question was "what will happen if the save file is too big - too big for what?" and that hasn't been answered.

The part of my post you quoted shows well how many people give advice without actually knowing the answer. I know Jonforum is familiar with the scripts, but I'd still like more of an explanation before I go around deleting stuff.

I prefer to know what other problems I might be causing if I remove or ignore something that has been built into the engine for a reason.

You have me curious though - in what post did I respond to you in anger? I looked through your most recent 100, and could only find a few threads that we both took part in - in most of them I was not replying to you, and in the few where I did, I can't see anything that would be considered anger.
I don't believe my post contains anger, and I'm sorry you feel that it does. I just want an explanation for the advice being given. My question was "what will happen if the save file is too big - too big for what?" and that hasn't been answered

According to this SO answer, I'd wager it may be due to browser limitations but it varies depending on what's used (200k is nowhere near the 2^30 that some can handle)

EDIT:

Another link, just for funsies. Though it actually makes me question the reason the 200k warning exists even more
Thanks - that's very interesting.

If it does this for web storage:
LZString.compressToBase64

would that result in a smaller file?

If it does, and the issue is supposedly browser limitations, wouldn't you be able to do the same for local storage, and check the size of the resulting string rather than the uncompressed one?
Thanks - that's very interesting.

If it does this for web storage:
LZString.compressToBase64

would that result in a smaller file?

If it does, and the issue is supposedly browser limitations, wouldn't you be able to do the same for local storage, and check the size of the resulting string rather than the uncompressed one?

According to this SO answer, it can result in a shorter string (thus a smaller file). You could do the same for desktop/mobile storage, but whether or not it actually matters there is another story. IIRC, desktop stuff is saved locally in its own files so really your limitation there would most likely be RAM and then disk space (depends on how Node.js handles things). Mobile, since it has to go through a WebView as far as I can tell, is most likely constrained by the associated browser engine (Chrome on Android, Safari on iOS, etc).

But yeah, I don't see any reason why you couldn't encode the string, check its size to see if it's too big, and continue on normally if you want to do it. Just be sure to add bits to decode it in the relevant loading functions.

Do note that, while LZString is much faster, LZMA will compress better once you get around the 100k character mark and LZString ends up losing in both speed and size once you get to 750k. Just thought I'd throw that out there in case you'd prefer compression ratio over speed

Original thread: https://forums.rpgmakerweb.com/threads/save-data-too-big-what-are-the-implications.93502/