ID:145879
 
Code:


Problem description:
The problem is that my savefiles are 500+ kb and I'm not sure whats taking up all that space. I'm using deadrons character handling but I never really read into how savefiles work, this was never my strong point using the C language programing MUDs either.

What I'm looking for are some suggestions of how to write very small savefiles, all I want to save is the players level, class, items, stats(hp, mp, ect.) and a few other things such as towns they have visited and tasks they have completed, used for determining things like if a guard will let them pass or attack them.

I'm not sure of this but I'm probably saving a bunch of data by saving their objects, probably all the object's data. I guess no data on any object ever really needs to be saved unless I'm planning on allowing different stats on different instances of the same object, which was allowed in my MUD but I don't plan on it at all in this game.

Would making all the objects variables tmp become a problem for reloading the character's stats? Attack and defense are determined by armor and weapons.
Do your mobs have variables that refer to other mobs, that possibly contain references to yet more mobs, etc., ad infinitum? That will massivly inflate savefile size.

Everything in the contents list of an atom is saved along with the atom, so making equipment vars tmp wouldn't do anything.
In response to Jp
Actually, I just made all obj variables tmp and it changed the size of a new player's save file from 246kb to 2kb, I had already made all data refering to other mobs such as followers tmp. I guess I solved the problem for now unless I end up runningi nto bad side effects of not saving any obj data.
In response to Hork
Like... Not having the objects? I always thought contents was auto-saved... Are all these object variables things that are also in the player's contents list? (I mean the actual, variable contents, not something used in-game)
In response to Jp
The weapons and armor themselves have variables such as which class can use them, object_type, modifier, ect. I thought for a minute that not saving those would effect the player's attack or defense when they were reloaded but it doesn't seem to. This also works for the better because it allows updates to objects, for example if I changed the club's damage from 4 to 6 or made it so wizards can't use it anymore, all players loging back in will have a new instance created instead of having the old instance saved, taking up hundreds of kb in space and in this case still allowing wizards to use the club if they already had one befor eit was changed.

I just figured all this out again, I had learned it years ago programming MUDs in C, but players needed to keep individual instances of items for that game, there was alot of clan eq and re-strung personal eq.