Save and Load Game - UQcsse3200/2024-studio-3 GitHub Wiki

How to

Save

The game can be saved from the game at any time through the pause menu which will open by pressing 'ESC'. The save button will become available to be able to save said data (See the photo below)

Load

The game can be loaded from the main menu currently and will eventually be able to be loaded from the pause menu. When opening the load menu, you will be able to see that the saves appear in a table format with two each row with information under each save.

Design Choices

The design of the load/game system is centralized the SaveLoadService which is used with its primary method save() and load() in conjunction with a GameState objects to keep track of the needed saved information which is the day, money and morality and modification time. These functions are called either by the pause menu (pause) or through the forestGameArea where the load method is called and if the file set exist, then the save file exist and the system should read from it. For now, the game files are simple called by the time they were created for simplicity. UML These game states are saved using the fileloader class in a json file in the format shown below

{
  "day": 5,
  "money": 1200,
  "ModTime": "2024-10-03T14:30:00",
  "decisions": [
    {
      "statement": "Helped a stranded traveler.",
      "isGood": true,
      "decisionMade": "Yes",
      "decisionPoints": 10
    },
    {
      "statement": "Engaged in a risky trade.",
      "isGood": false,
      "decisionMade": "No",
      "decisionPoints": -5
    }
  ]
}

Improved Load Game UI

Overview

The Load Game UI underwent a series of enhancements to align with the overall theme of the game’s user interface while improving its visual appeal and functionality. These improvements were designed to offer a smoother and more aesthetically pleasing experience for players when interacting with saved games. An example of how it should now look in game is below:

Key Improvements

Thematic Background

A thematically appropriate background image was added to the LoadGameDisplay. This background fills the entire screen, creating a more immersive and visually cohesive interface that aligns with the game's overall aesthetic.

Coin Icon Integration

A coin icon was incorporated into the saved game display to represent in-game currency. This visual cue enhances clarity and gives players a better understanding of their progress, as the icon is displayed alongside the cash value for each saved game.

Formatting, Text Size, and Spacing Enhancements

The font size and spacing between elements were adjusted to improve readability and layout consistency. Titles and instructions are now larger and more prominent, while saved game information, including the last modified date, in-game day, and cash balance, is presented in a clean, structured format. Each row of saves contains two save files, which prevents overcrowding and ensures a neat, organized presentation.

Retained Features

Interactive Save Selection

Players can easily select a saved game to load through clickable buttons. Hover states were added to create a more interactive and responsive user experience, ensuring players know when they are hovering over a selectable save.

Back Button

A Back button was added to allow players to exit the Load Game menu seamlessly. The button is styled to fit with the rest of the interface and is positioned for easy navigation.

Implementation Details

Background Texture: The background texture is loaded from images/background_images/1.0.png and set to fill the entire stage, providing a visual foundation for the UI elements.

Coin Icon: The coin icon, loaded from images/coin.png, is displayed next to the cash amount for each save, visually representing the player’s in-game currency in an intuitive and accessible way.

Save Game Display: For each saved game, the UI shows the name of the save, the last modified date, the in-game day, and the player’s cash balance. These details are presented alongside the coin icon in a two-save-per-row format.

User Interaction: Clicking on a save file triggers an event that loads the selected game. Additionally, a Back button allows users to exit the screen without loading a save.

Testing & Final Adjustments: The UI was visually tested to ensure proper alignment, spacing, and responsiveness across different screen sizes and resolutions. This update was designed with the player experience in mind, creating a more engaging and polished interface for saving and loading games.