Folk Heroes - Scene Changing

19 Nov 2019 - vidya

This one is less visually exciting, but a very important step nonetheless.

The hardest part of this was saving any runtime changes to the grid or WorldObjects by the player.

The way that Unity works, each scene has a initial state for all of its GameObjects and fields. It’s the scene’s state at the onset of runtime, and the part of the scene you can visually edit in the Unity Editor. I created a StaticGridManager to hold on to each scene’s grid and all of its inhabiting GameObjects. Each time the player changes a scene, the GridManager updates StaticGridManager’s Tile dictionary of the scene. When the player changes scenes, the GridManager reads from StaticGridManager’s Tile dictionary of the respective new scene.

It involved some funky code to get my GridManager to read the prebuilt Unity Editor scenes, then later take into consideration WorldObjects and Tile changes the player has added to the scenes. I probably wouldn’t ever ship code like what I have, but it’s a good foundation to clean up.

That seems to be my unconscious design method with this project: try and add and build and worry about optimization later. There were some weird errors, a few rewrites needed, but altogether it seems to be working quite well now!

With that, I may spend some more time on the art of the game!

I want to consider different methods of illustrating the world and then converting it into a grid style. Then I will start working on the NPC characters, both friend and foe. Very exciting!