Skip to content

Save File System

Veenit254 edited this page Oct 6, 2026 · 2 revisions

Save File System

Overview

The game stores each run in a numbered local save slot. Save data includes player progress, checkpoint information, inventory, upgrades, selected weapon and play time.

Save File Structure

File Purpose
save_slot_<n>.json Serialized game save data
save_slot_<n>_preview.png Preview screenshot shown by the load screen

GameSaveData stores:

  • Save version
  • Total play time
  • Dungeon completion times
  • Current checkpoint
  • Resume position
  • Player gold
  • Inventory
  • Charms
  • Weapon upgrades
  • Selected weapon

Saving During Exit

When the player presses Exit, MainGameExitDisplay displays three options:

  • Save and exit
  • Delete save and exit
  • Cancel

Save and Exit

The game returns to the main menu. During MainGameScreen.dispose(), the current run is captured and saved.

The save process captures the game state with GameSaveMapper, writes it with FileLoader.save(...), and creates a preview image.

Delete Save and Exit

This option deletes the current save and preview:

public void deleteSaveAndExit() {
  saveOnDispose = false;
  runSaved = true;

FileLoader.deleteSaveSlot(saveSlot); game.setScreen(ScreenType.MAIN_MENU); }

saveOnDispose prevents the normal disposal process from recreating the deleted save.

Cancel

The dialog closes and the player continues playing.

Loading Saves

LoadGameScreen loads the selected slot with:

GameSaveData save = FileLoader.load(slot);

A valid save restores the player's statistics, inventory, charms, weapon upgrades, selected weapon, checkpoint, resume position and play time.

Empty slots start a new run. Unreadable saves can be deleted from the load screen.

Main Classes

Class Responsibility
GameSaveData Stores save data
GameSaveMapper Converts game state to and from save data
FileLoader Reads, writes and deletes save files
LoadGameScreen Displays save slots and loads saves
MainGameScreen Saves the current run during disposal
MainGameExitDisplay Displays save and delete exit choices

Table of Contents

Home

Test Plan

Team 2

Features

Components
Player
Items and Inventory
Enemies
Interactable NPCs
Cutscenes and Dialogue
Music
Bosses
Rooms
Weapons
Abilities & Spells
Game Screens and Areas
Dungeons

Game Engine

Getting Started

Entities and Components

Service Locator

Loading Resources

Logging

Unit Testing

Debug Terminal

Input Handling

UI

Animations

Audio

AI

Physics

Terrain

Concurrency & Threading

Settings

Troubleshooting

MacOS Setup Guide

Clone this wiki locally