I have a problem. I'm working on a game comparable to Final Fantasy. On my maps, there will be "objects" (literally objects, as in pick-up-able items) that get loaded along with the map itself. Once the player picks up an object, I don't want that same object to re-appear next time the map is loaded. Simply overwriting the file the object is in won't do, because if the player starts a new game, the object still won't come back.
I was thinking that I should make a way to "restore" the game object files to their original state upon a new game being started, but the amount of files will be VAST.
Typically you have static things that cannot change (maps, objects, NPCs for example) separate from the location/state of the objects and NPCs. When the user picks "New Game" the static data and the default object locations are loaded. When the user picks "Load Saved Game" the static data and the saved object locations are loaded. So, when saving a game, all of the state information is saved into the same format that the "new game" state information is stored in.
If there is no way to uniquely identify an object, then you don't need to worry whether states are associated with the right object. The object of type T with state x is T(x). As long as any T can take state x, and your program will treat it as T(x), you are OK.
The only state I was worried about was bool pickedUp; It would need to be associated with the right Object (literally, class Object{ };). Everything else (x, y and type [as in item, weapon, armor and further classification in those areas]) is constant.
So, if object at (100, 123) is picked up, I need the pickedUp variable to be set to true next time the object at (100,123) is loaded, not any random object at (whateverX, whateverY).
I don't see how that boolean would need to be associated with the 'right' object anymore than the location and the type would be. Keep the boolean with the other data; the same way you associate some x-coord with some y-coord, also put that type and boolean with that.
The x/y are constant, thats what I'm getting at. The only external value is the boolean. If I were to store x/y/type/pickedUp all separately, then I might as well have 2 copies of the file. Those are everything an object has.
I suppose it could be... I think I see what your getting at ;)
Load all the objects for a map, indiscriminately. Then, load a file of x/y pairs of picked up objects. Once its loaded, compare all the x/y's to the x/y's of the loaded objects. If they match, delete the object from memory.