Updating a game without losing save games?



  • Hey all. Here's a quick rundown of my problem.

    I'm using FlxSave to save to various slots and whatnot.
    I also posted my game online and I've been trying to update as much as I can.

    But the problem is that it seems once I update the file, all the save game progress is lost, so is there any way to fix this so the save games are consistent?



  • Are you saving data as objects or are you saving some serialized value like JSON?

    Did the actual class (or JSON data format) change between the previous and current release of your game?



  • I'm saving the values individually

    public static function save():Void
    	{
    		FlxG.save.data._skill = _skill; //_skill for example could be an Int or a float or whatever
    
                    FlxG.save.flush();
            }
    
    public static function load():Void
    	{
    		_Skill = FlxG.save.data._Skill;
            }
    

    I'm not too sure how SharedObject works across the various SWF's or whatever. If it comes down to it I'll have to implement some sort of "Cloud Save" thing with the Newgrounds API (where my game is posted)



  • I think you need to bind the save to a name.
    I save my slots like this and the sharedObject will be MyGameSave1, MyGameSave2, etc.

    public static var savesName = "MyGameSave";
    
    public static function saveSlot(slotID:Int):Void
    {
    	if (saves[slotID] == null)
    		saves[slotID] = new FlxSave();
    	
    	saves[slotID].bind(savesName + slotID);
    	
    	var data = saves[slotID].data;
    	
    	data.level  = level;
    	data.health = health;
    	data.cash   = cash;
    	data.gun    = gun;
    	data.rounds = rounds;
    	data.shield = shield;
    	data.bombs  = bombs;
    	data.time   = time;
    	
    	saves[slotID].close();
    }
    
    


  • oh, you must be binding the save somewhere. Are you using the same name to load the data as you do to save it? Each slot should have a unique name unless you save as _skill1, _skill2 for all slots.



  • I am binding in another function, and the different files work fine.
    ex:

    // this one gets called when you press the top button in file select screen
    private function load1():Void 
    	{
    		FlxG.save.bind("File1");
    		loadGame(); // function later in the class, nothing important
    	}
    
    

    My problem is when I'm updating the game on websites and such, the save files seem to get lost



  • @ninja_muffin99

    It might be that the location changed? If you change the name of the game, like myGame1.0 to something else, it will make a new sharedobject in a new location.


Log in to reply
 

Looks like your connection to HaxeFlixel was lost, please wait while we try to reconnect.