Skip to content

Level Saving Loading

bryan-storey edited this page Oct 3, 2021 · 1 revision

Level Saving/Loading

Levels are saved and loaded to/from JSON format. Level save files contain:

  • Tile Map Data
  • Obstacle Data
  • Obstacle Link Data

Loading/Saving Process

These files are loaded when a level is selected to be loaded by the LevelGameArea area. The loading process is as follows:

  1. LevelGameArea.readAll() is run to begin the loading sequence
  2. LevelGameAreaapplyTerrainSerializers(Json) is run to apply the serializers used to convert the TiledMapTileLayer to/from Json.
  3. The file is read, and converted to a LevelFile object, containing all of the relevant level information.
  4. The information is read from the LevelFile object and loaded into the game

In future, step 4 could be moved to a different stage in the loading process so that, for example, assets could be loaded before attempting to spawn obstacles.

When the level is saved (by the level editor), the reverse process occurs within LevelGameArea.writeAll(). Serializers are applied, a new LevelFile object is created and all relevant data is saved to it, and it is then saved to a Json file.

Adding New Data

Adding new data to the level file is simple. First, the LevelFile class should be modified to add the data field in the correct location. Next, read and write the data to/from the LevelFile in the readAll and writeAll methods, note that adding a serializer may be necessary for special datatypes, however is not needed for most things.

Table of Contents

Home


Game Design

Game Design Document

Void/Antivirus

Loading Screen

Game Sound

Menu Assets

Player Design

     Original Design

     Final Design


Gameplay

Movement

Jumping & Sliding

Jump Pads

Portals & Bridges

Buttons

Pick-Ups

Physics

    Momentum & Physics

    Gravity

    Collision


Level Design

Level 1

     Background

     Textures

     Map Design

Level 2

     Background

     Textures

     Map Design

Level 3

     Background

     Textures

     Map Design

Level 4

     Background

     Textures

     Map Design


Sprint Round-Up

Sprint 1 Summary

Sprint 2 Summary

Sprint 3 Summary

Sprint 4 Summary


User Testing

Testing Plans

Sprint 1

     Team 1
     Team 2
     Team 3
     Team 4
     Team 5

Sprint 2

     Team 1
     Team 2
     Team 3
     Team 4
     Team 5

Sprint 3

     Team 1
     Team 2
     Team 3
     Team 4
     Team 5

Sprint 4

     Team 1
     Team 2
     Team 3
     Team 4
     Team 5

User Testing

Sprint 1

     Sprint 1 - Game Audio
     Sprint 1 - Character Design
     Sprint 1 - Menu Assets
     Sprint 1 - Map Design
     Sprint 1 - Void

Sprint 2

     Sprint 2 - Game Audio
     Sprint 2 - Character Design
     Sprint 2 - Menu Assets
     Sprint 2 - Interactable Design Animation
     Sprint 2 - Levels 1 & 4, and Level Editor
     Sprint 2 - Proposed Level 2 & 3 Designs
     Sprint 2 - Current Game State

Sprint 3

     Sprint 3 - Menu Assets
     Sprint 3 - Map Design
     Sprint 3 - Score Display
     Sprint 3 - Player Death and Spawn Animations
     Sprint 3 - Pick Ups and Pause Screen

Sprint 4

     Sprint 4 - Gameplay
     Sprint 4 - Game UI and Animation
     Sprint 4 - Level Background and Music
     Sprint 4 - Game User Testing
     Sprint 4 - Final Game State Testing


Game Engine

Entities and Components

     Status Components
     Event System
     Player Animations Implementation

Level Editor

Level Saving and Loading

Status Effect


Defunct

Development Resources

    Getting Started

Entities and Components

    Level Editor (Saving and Loading
         Multiple Levels)

    Service Locator

    Loading Resources

    Logging

    Unit Testing

    Debug Terminal

Input Handling

    UI

    Level Saving/Loading

    Status Effects

    Animations

    Audio

    AI

    Physics

Game Screens and Areas

    Terrain

    Concurrency & Threading

    Settings


Troubleshooting

MacOS Setup Guide

Clone this wiki locally