-
Notifications
You must be signed in to change notification settings - Fork 0
Save Game
Save game placeholder
For Sprint 3 Team 4 decided to implement the save game functionality for the game. This was done to help encourage and facilitate players to play the game without having to worry about progress or having to finish the game in a single sitting. The save game is one of the most complex systems present having to be dependent on every single other system and having the ability to retrieve and load relevant information as needed.
Currently save game functions for loading environmental obstacles, structures, player, crystal and game state to some degree. Due to the sheer complexity and dependencies involved Save Game encounted significant issues which are discussed below in the issues arose section.
Save Game generally functions by using Json serialization of objects and their respective properties as needed. This meant that customs methods and functions were written for each of the below features. General save location is in assets/Saves/
where there is multiple json files labeled environment, game state, structures etc
As the SaveGame is a static class, the game state can be saved and located at any point via the two static methods saveGameState()
and loadGameState()
The pipeline for saving Environmental obstacles this was that every entity was searched for a environmental component and texture component and if an entity had these two things it was deemed to be an environmental obstacle. From this point critical data was loaded in a Tuple class which stores the name, texture and position of the environmental obstacle. Environmental obstacles were then saved via Json serialization of their attributes into an ArrayList.
The Json file for environmental objects is Saves/Environmental.json
and follows the format:
[{
class: com.deco2800.game.files.Tuple
texture: images/landscape_objects/leftPalmTree.png
position: {
x: 936
y: -9.449275
}
name: Tree
}
{
class: com.deco2800.game.files.Tuple
texture: images/shipWreckBack.png
position: {
x: 1064
y: 38.8
}
name: ShipwreckBack
}...