Legacy GM Professional Game Save

JPDamstra

Member
GM Version: GameMaker: Studio
Target Platform: ALL
Download:
Part 1 Project Files
Part 2 Project Files
Links:
JSON Tutorial

Summary:
Game saving is an important aspect to take into consideration when designing a video game. Whether it's keeping your player's progress and achievements stored for later use or developing a checkpoint system, game saving means users can play your game anytime, anywhere without having to plan tackling your piece of art around their sessions of free time.

Tutorial:
 

chance

predictably random
Forum Staff
Moderator
This is an excellent tutorial. The videos are organized and easy to follow. It's clear from your presentation that you pre-planned your comments and the sequence of events to be described. But the flow still feels very natural and conversational in style.

In addition, you've provided downloadable Studio source files. The source code is well written and has plenty of comments. Those alone would make good tutorials, but complimented by the videos they're even better.

The detail here is probably more than a typical beginner would need. Most simple games just need a way to save the score and the level number (or save point), for example. So re-loading a game just re-starts at the last saved location with the current score. But the way you've divided your tutorials into sections and separate scripts, beginners who want something simpler can probably find it.

This is a useful addition to the Tutorials Forum. Well done.
 

FrostyCat

Redemption Seeker
I'm glad you're doing something to try and get JSON troglodytes out from under their rocks, but the second part of this tutorial is off on several levels.

In the second part of your tutorial, you recommended using pipes to separate JSON objects. I don't think you understand the point of JSON if you don't see the problem with that: put a pipe in a string to save and pop goes the weasel. You should have used a JSON array containing the JSON objects as nested structures, that way there are no taboo characters.

Another thing that I just don't understand is why you didn't take advantage of JSON nesting. That would have reduced your multi-file albatross to one coherent structure, and all of it could fit inside one file after encoding. No fuss, no mess.

Code:
{
  "player": {
    "x": 50,
    "y": 75,
    ...
  },
  "traps": [
    {
      "x": 500,
      "y": 400,
      "sp": 2
    },
    ...
  ],
  "pellets": [
    {
      "x": 700,
      "y": 800,
      "direction": 170,
      "speed": 6,
      "counter": 2
    },
    ...
  ],
  "score": 5740
}
Review this tutorial a little more and perhaps then the word "professional" would have a place in the title.
 

gnysek

Member
My question is "professional" means here JSON instead of INI? For me that's "elegant" more than professional. Professional wold be with encryption like at least XOR and using buffers, so file will look like random characters when user open it. In above example it's too easy to modify saved file.
 
I

icuurd12b42

Guest
My question is "professional" means here JSON instead of INI? For me that's "elegant" more than professional. Professional wold be with encryption like at least XOR and using buffers, so file will look like random characters when user open it. In above example it's too easy to modify saved file.
json string to buffer, xor buffer, buffer to base 64, write...
 
H

Howard Lehr

Guest
This seems like a lot of back flips to do something that's relatively simple. INI files are easy to use, easier to read than JSON and seem to work flawlessly on PC, Android and iOS (at least with a limited sample test group).

Couple of Questions:
1. What is the reason(s) to save games this way instead of INI files?
2. On Google Play Store, will "cloud_file_save("save.ini", "current save file"); " work or is it necessary to create a text file in JSON format before using the cloud save function?

Any help that cuts out some trial-and-error is most appreciated.
 
B

banebyte

Guest
This doesn't look like a professional save at all :/ Never saw games which save their game data in human-readable formats (json, xml or ini).
The professional way is to use binary file format, which has lots of positive features, such as:
1. Harder to modify (you should know the file structure)
2. Faster reading/writing
3. Takes much less space
 

TheWaffle

Member
1. What is the reason(s) to save games this way instead of INI files?

Any help that cuts out some trial-and-error is most appreciated.
For HTML platforms, .ini files get saved to strange places and can be hard to find later. Also, .ini files are generally not encrypted.
If you create an encrypted (or at least obfuscated) json file , you can output a text string and permit the user to save anyplace
using notepad... also good for loading a level back in later. There are better examples on doing this ....
shaun spalding
 
Top