Game
Clever Cogs
8 years ago

Save/ Load system


The save system that was created is quite rudimentary but it does the job. Before making the save/ load system I had to figure out how exactly to do it. From my previous experience I imagined it being done through the use of files and sure enough after a bit of research I found a simple way to save data into a file and load the data from the file.

The process was simple enough, all I needed to do is create a static class with variables I wanted to save and make sure that the object the save/load script is attached to is persistent through different levels, which I did by running “DontDestroyOnLoad” function in the “Awake part of the script. This makes it so the object is not destroyed when an object is loaded.

Save system is quite simple, due to level based nature of the game. Since There are no collectibles right now, the only thing that will differ between saves is the level player is on. Since level the player is on can be represented by a single number, that’s the only thing I save. Originally I was going to save two variables like level and save slot number, but since save slot doesn’t change during the game, I decided not to save unnecessary data, instead I have split each of the save slots into it’s own file. This way a file can correspond to a save slot and I only need to save a level number for that slot. Having a separate file for each slot also allows me to easily expand save system in future by simply adding variables. This wouldn’t be possible before, since each variable would have to be linked to a save slot in some manner so I would have to think about how to make it so that variables with the same names are differentiated in a single file. It’s not impossible, since I could separate file into sections representing save slots or adding a prefix to each variable when it is written into a file. However I decided that having separate files is a better solution.

In the end what I ended up with is a system that consists of 3 save slots each dedicated to a separate file. If there is no file. game can’t be loaded from that save slot and instead a “No save data found” is displayed.



0 comments

Loading...

Next up

Menu Changes and Death mechanic Just a quick update on the menu changes. I have added a restart option to the pause menu The same function will be used to restart the level when a player hits “Death spikes”.

First character is finished (well, modelling is) Texturing will be done when other characters are ready. The model is far from perfect, but it will do for now.

Base for 2 characters (need to be finished) The base models for small and medium characters are done (see below) I had to remake the legs for the character since they looked way too small. The new ones look better:

Base for 3rd character The last of three characters is complete… well the base model is.

Enemies can also suddenly spawn through Realm Rifts. These Rift Spawns are going to be stronger than the ones wandering around. TBD on the enemies... #screenshotsaturday #godstear #madewithunity

What you all think

Sometimes the suction cup get sticky. Small animation I made in Blender after doing my tutorial on picking up/dropping objects in animations. Crate model by jQueary (https://sketchfab.com/3d-models/game-ready-sci-fi-crate-d98deca6…).

OK, this starts to be too tricky puzzle already :D

#platformer #indiegame #puzzle

We're knee deep in multiple large features and "game feel". Quick peek behind the scenes in this weeks Dev Blog: https://bit.ly/2QmmaQM

Here's a Fredbear sprite i made in Aseprite! I'm pretty proud of this!

(Btw, sorry for the double post! I'll try to post less)