GML Version saving like v0.01a

Discussion in 'Programming' started by Denis Elias, Mar 15, 2019 at 8:13 PM.

  1. Denis Elias

    Denis Elias Member

    Joined:
    Feb 24, 2019
    Posts:
    3
    Hi

    I'm very new to Game Maker. First tryout.

    I'm making a game and I want to save the progress in different versions, like v0.01a, v0.02a...when I do "save as" it always saves all my assets with it. But I just want a new version number in the same folder.

    I hope the question is not to dump :)

    thanks!
     
  2. samspade

    samspade Member

    Joined:
    Feb 26, 2017
    Posts:
    1,572
    What does your save code look like?

    I've done something like this for my saves before:

    Code:
    
    /// @description Save the Game
    
    //delete existing save if any
    if (file_exists("general_save_file.svf")) {                           
       file_delete("general_save_file.svf");                           
    }
    
    //create save file
    var file = "general_save_file.svf";                                   
    
    //open file   
    ini_open(file);                                           
    
    //save version number
    ini_write_string("VERSION", "NUMBER", CURRENT_VERSION);
    
    //save stuff
                 
    ini_close();                                       
    
    
    
    #region //load game
    if (CURRENT_VERSION == scr_check_version()) {
    
       var file = "general_save_file.svf";
    
       if (file_exists(file)) {                                       
    
           ini_open(file);
    
           //load variables  
       
           ini_close();                                                //close file
       }
    
    }
    #endregion
    
    
    
    This is using ini files but a similar process could work. Note that this does other version saves which is what I want. If you wanted to keep other versions, then what you could do instead of having a version number is just change the file name.
     
  3. NightFrost

    NightFrost Member

    Joined:
    Jun 24, 2016
    Posts:
    1,618
    Are you talking about versioning your game project's progress? If that's the case I'd recommend setting up a git repository and reading a bit about its use. It is a very felxible tool for moving between different versions of your game, and also branching the project to allow multiple persons work on it.
     
    ohmsnap likes this.

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice