Dev Log: Save System Added

I finally have a (mostly) working save system in place! It’s probably not the most efficient method, but I’m satisfied with the speed and flexibility it offers for now. The system relies on Godot’s Resource nodes and ResourceSaver functions to store text files in a directory.

To capture the game data as text, I created environment and character exporters. The character exporter is a very simple check that returns a dictionary with key values like health, energy, position, inventory, etc., which are stored in a Resource scene. The environment exporter was a little more challenging. I wanted to receive an array of arrays for each region of the map, with info on spawn points, enemies alive, farmable resources, and other details that are randomly generated at the start of each game.

To start, I created empty arrays for each region as placeholders and used my environment group to create a master array of all existing environment nodes. Each environment node has metadata on the region type, which is used to sort the master array into the regional arrays. (Side note: it might be more efficient to use regional groups and skip this sorting step, but for now I like that this keeps my groups list a little cleaner.) After all the environment nodes are sorted into regional arrays, another set of empty arrays are created to store that data that will be exported (again, one per region). With every regional environment node array, the exporter loops through and creates a subarray of data for each individual environment node present. The data includes global position, region, area subtype, farmable resources (subarray), and mobs (subarray). All of this info is packaged into an environment data array and saved in the Resource scene.

My main reason for using this mess of arrays is that it makes loading game data fairly easy. The load function takes the final environment data array, breaks it back into regions, and loads each environment node with the data provided.

Active drops and farm data still need to be added to the save system. I expect these will use a similar process of gathering an array using groups/metadata. I also need to add a loading screen at the start of the game to ensure all signals are connected before the player can move around.

There is still a long way to go, but I’m excited to see the game getting closer to playtesting!

Select File Menu

Previous
Previous

Dev Log: Equipment Selection Menu

Next
Next

Dev Log: Start Menu Added