Jump to content


Photo

Saving in GM Studio


  • Please log in to reply
7 replies to this topic

#1 Freeload

Freeload

    GMC Member

  • GMC Member
  • 700 posts
  • Version:GM:Studio

Posted 17 July 2012 - 03:30 PM

Hi,

I've been told that the D&D Save Action from GM 8.1 (or other previous versions) does not work in GM Studio so how would one go about saving the game otherwise?

Keep in mind that I've already made a full game in a previous version of GM that uses the simple D&D Save Action, which does everything for me when creating the Save file (literally, I just select the Save Action and give it a name), and it's not practical to re-write the entire game in some roundabout way just to get it to save the full game state (and everything that entails) outside of a simple alternative Action or basic GML code of the same Action that does the same thing e.g. if I can just write something like "Save Game" in a Execute Code Action or something like that then this would be fine.

Hope that makes sense.

Thanks,

Kirk

Edited by Freeload, 17 July 2012 - 03:31 PM.

  • 0

#2 Nocturne

Nocturne

    Nocturne Games

  • Administrators
  • 20925 posts
  • Version:GM:Studio

Posted 17 July 2012 - 03:34 PM

Nope, can't be done. The save game that GM8.1 uses basically saves EVERYTHING whether it is relevant or not and that is horribly inefficient as well as very error prone, which is why it was removed. You should be creating your own saving mechanisms if you need to... also, it is highly recommended that any project started on a previous version of GM is finished on that version as porting it over to Studio is not easy due to the complete overhaul of the compiler and the removal of several functions (and addition of others!).
  • 0

#3 Research

Research

    GMC Member

  • GMC Member
  • 92 posts

Posted 17 July 2012 - 03:42 PM

Not so hard to do manually.
I set a ds_map with all necessary information. And use write and read to save and load.
Then applie the values.
  • 0

#4 Freeload

Freeload

    GMC Member

  • GMC Member
  • 700 posts
  • Version:GM:Studio

Posted 17 July 2012 - 08:16 PM

Not so hard to do manually.
I set a ds_map with all necessary information. And use write and read to save and load.
Then applie the values.

No idea what that means.

Is it hard to do?

Also, assuming when I "save" the game I genuinely want to save everything EXACTLY as it is, in my horizontal scrolling shooter that means the position of everything in the level and the state/value of everything in the level plus all the Local and Global values in the game in general etc, is that actually possible with your method?

I basically need it to do what the old Save Action and Load Action apparently did but somehow in a new way now.
  • 1

#5 Freeload

Freeload

    GMC Member

  • GMC Member
  • 700 posts
  • Version:GM:Studio

Posted 17 July 2012 - 08:17 PM

Nope, can't be done. The save game that GM8.1 uses basically saves EVERYTHING whether it is relevant or not and that is horribly inefficient as well as very error prone, which is why it was removed. You should be creating your own saving mechanisms if you need to... also, it is highly recommended that any project started on a previous version of GM is finished on that version as porting it over to Studio is not easy due to the complete overhaul of the compiler and the removal of several functions (and addition of others!).

Well assuming when I "save" the game I genuinely want to save everything EXACTLY as it is, in my horizontal scrolling shooter that means the position of everything in the level and the state/value of everything in the level plus all the Local and Global values in the game in general etc, is that actually possible now?

I basically need it to do what the old Save Action and Load Action apparently did, as far as I can tell, but somehow in a new way now.
  • 0

#6 kburkhart84

kburkhart84

    Firehammer Games

  • GMC Member
  • 1910 posts
  • Version:GM:Studio

Posted 18 July 2012 - 04:48 PM

I'd say you are saving too much. You should probably save only inbetween levels, or at the max at designated save points. Then all you have to save is where you are, and maybe something to do with points and player's weapons, etc...

As far as using the read/write functions to save many more variables, that is my recommended approach, if you really have lots of things to save. Look up ds_map in the help file. They are basically glorified arrays, but they work slightly different. Also, they have these functions that can turn(and return) the whole thing into a single string, which can then be saved into a file. That is the read/write function set being referred to. Then upon loading, you could grab the string from the file, and "read" it back into the ds_map, and voila, you have all those variables back where you want them. This method isn't for saving where all the enemies and bullets are(though I guess you could loop and make it that way) rather it is for if you have lots of things to save, like an RPG where you have experience, level, HP, maxHP, Str, Mag, etc... and all of those stats for more than one person, and then you also have all of the "quest" indicators which I'm using to refer to where you store whether you have done things yet, like talked to somebody, opened said door, beat said boss, etc... which would probably be in its own ds_map.
  • 1

#7 Nocturne

Nocturne

    Nocturne Games

  • Administrators
  • 20925 posts
  • Version:GM:Studio

Posted 18 July 2012 - 06:02 PM

<SNIP>lots of sound advice<SNIP>


I completely agree... 99% of the time you do NOT need to save everything. Especially when dealing with devices and HTML5... I also would like to repeat that the way of working with GM:Studio is waaaaay different than working with GM8.1. It is a multi-platform IDE and so is designed for light and fast games, not huge windows only RPG's. So if you have a game that is over anywhere 20% done in 8.1, you really should finish it in 8.1 as that will save you a lot of pain and heartache. Also, the above advice about ds_maps is really sound too, as they are by far the fastest of all the data structures and very optimised so you can store vast amounts of data in them and save it and load it very quickly.
  • 0

#8 Freeload

Freeload

    GMC Member

  • GMC Member
  • 700 posts
  • Version:GM:Studio

Posted 18 July 2012 - 08:17 PM


<SNIP>lots of sound advice<SNIP>


I completely agree... 99% of the time you do NOT need to save everything. Especially when dealing with devices and HTML5... I also would like to repeat that the way of working with GM:Studio is waaaaay different than working with GM8.1. It is a multi-platform IDE and so is designed for light and fast games, not huge windows only RPG's. So if you have a game that is over anywhere 20% done in 8.1, you really should finish it in 8.1 as that will save you a lot of pain and heartache. Also, the above advice about ds_maps is really sound too, as they are by far the fastest of all the data structures and very optimised so you can store vast amounts of data in them and save it and load it very quickly.

Yeah, well the game is complete in GM8.1 but unfortunately I don't know how to get that onto other platforms so I was hoping to use Studio for this.

:o

I'll have a look at that stuff above guys.

Cheers.

Edited by Freeload, 18 July 2012 - 08:18 PM.

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users