Legacy GM Designing a Save/Load system for a 'complex' RPG

C

Cockerspaniel_Supreme

Guest
Hello everyone!
So I've gotten around to designing a Save/Load function for my game, but due to my inexperience I would like to inquire for some advice before I fall into any pitfalls.

I've already got a "working" save/load system taken from Heartbeast's RPG tutorial series:
menu:
saving:
loading:
If they're considered a simple or 'good' system I have no idea.

The system I intend to design will have 3 save slots and will cover 'complex' things like...
Changing NPC relationships
Large & diverse inventory w/ crafting
Persistent and non-persistent rooms
Dates & day/night cycles
Etc.

Does anyone know of any good tutorials that tackle these particular problems? Does anyone have any advice when designing a save/load system around these variables?

All help is highly appreciated!
 

NazGhuL

NazTaiL
So I've gotten around to designing a Save/Load function for my game, but due to my inexperience I would like to inquire for some advice before I fall into any pitfalls.
Falling into pitfalls will help you learn... ;)

Start small. Did you copy/paste Heartbeast's RPG tutorial? If yes, start over and do it yourself.
A good start is by using ini.file
Save/Load simple data
Then try ds_map or text.file.

Start by saving/loading the name of the player as a string.
Then add x/y coordinates as a real.

Then add more.
 
C

Cockerspaniel_Supreme

Guest
Falling into pitfalls will help you learn... ;)

Start small. Did you copy/paste Heartbeast's RPG tutorial? If yes, start over and do it yourself.
A good start is by using ini.file
Save/Load simple data
Then try ds_map or text.file.

Start by saving/loading the name of the player as a string.
Then add x/y coordinates as a real.

Then add more.
I followed the tutorial and typed it out by hand, so I have a good understanding of how it works and why. I know how to save variables and strings to the file, but I'm a bit more lost on complex objects like an inventory or keeping track of relationships/schedules (should I make my inventory a ds_map and save the entire ds_map as a single 'variable'?).

Also what's the significant difference between an ini file and a txt file? Is it possible to save the file as some made up filename like "mysave.sav" for added security/make it look more professional? Also GML's vague variable defining confuses me, how do I know something is a real and not a float?
 
M

Mylon

Guest
The method I'm using for my current game is to save entire objects into an array, and then create a map of the list of objects. So I get the first element in the map, do an "unit = instance_create(item[0], item[1], asset_get_index, item[2])", and then unit.var1 = item[3], unit var2 = item[4], etc. It's tedious to set up but I only need to do it once for each class of unit. My enemies and allies have a common parent so they can share most of the code.
 

NazGhuL

NazTaiL
Ok. Let's take an inventory. It's not that much more complex saving 1 or 100 variables.
If your inventory is a ds_map: ds_map_secure_save is your best option.
Text file is good too.
(then change the file extention to .sav if you want)
I won't recommend ini.file to save a game.

For inventory, I always use a ds_grid.
If I want to save it on a file I use ds_grid_write then write it to a txt file.
(That can be write to a ini.file too or a good choice: ds_map as a value. After all, ds_grid_write return a STRING)

Once you fill up a ds_map you can use ds_map_secure_save or, why not, use ds_map_write then write it to a txt.file.

Also GML's vague variable defining confuses me, how do I know something is a real and not a float?
I always turn my real to string before writing it.
Then I turn them to real when reading it.
 
Top