ID:151396
 
I have been thinking about this lately. Instead of each individual stat like Strength, Defense, etc. or even Level, only the class type and the amount of experience would be saved in each savefile. When the player logs in, the game would look at the class type and figure out the base stats and the level up stats associated. Then the game would look at the the amount of experience and determine the level. With the level and the associated stats, the final stats can be found out and applied to the player logging in.

Of course, there are other factors such as equipment boosts and bonuses, but they could be simply saved and added on when the player logs in.

I feel like this is a pretty efficient way to go about it but of course there may be some drawbacks that I'm not thinking at the moment.
It would be more efficient to load a slightly larger save file rather than processing all those stats.

You also have to consider spells and whatnot learned at certain levels. I'd be pretty annoyed if my UI reset every time I logged into World of Warcraft because I relearned every spell when my character spawns. If you plan on saving all that stuff it would negate the entire purpose of shaving down the save file size in the first place.
If you do the saving properly in the first place your only ever looking at 1kb~100kb. or atleast thats what my game currently runs 100kb being the max with a LARGE amount of items/skills/itemised verbs.

more then what a general player would be having at any time i think
Look up /tmp/ vars. Then save the mob.

Bam, efficient saving.
It sounds rather pre-mature to be trying to optimize your savefile size like this. Are you actually having issues with Savefiles? If so, here's a few tips:

  • As another poster said, don't save if you don't have to. Use 'tmp' where appropriate for things that can/should simply be calculated on loading and use Read()/Write()
  • Don't save icons/files. The file's data gets written into the savefile along with the file's real path, an 11-byte header and additionally a 18+n byte header where n = length of the name of the entry it's saved as.
  • Use lists where appropriate. List data has a natural advantage in that it saves a few bytes where appropriate not needing the initial header for a data entry anymore.


Ultimately, you'd be better off rolling your own format for savefiles if you have the knowledge and specialized need to do so.