It’s the most productive time of the year! That means it’s time to tackle those big problems that put the fear into you at in any other season. But with a couple weeks of holiday? Oh yes.
Over the weeks leading up to crimbo, I was dancing around, adding little new features and refining systems. I put decorations into the bunkers, added vending machines and guard posts, deleted the crap code that was failing to do these things before — the level generator is, dare I say it, looking pretty damn good.
The next step, then, is to take this mishmash of content and make it… into a campaign.
The Final Foundation
The way Unity works (superficially at least) is actually distressingly similar to Warcraft III. A Unity game only exists inside “scenes”, each only roughly analagous to the self-contained world of a Warcraft map. Things can only exist beyond and between scenes if you deliberately force them to.
Since my levels are procedurally generated, my game has so far consisted of a single scene. Rather than loading a new level and dealing with transferring the persistent character information, I have simply been wiping the level content and replacing it with fresh stuff.
Needless to say, this is untenable. Eventually, I want to make campaigns, stories that progress over multiple hand-crafted levels. These cannot be shuffled so readily.
I’ve been juggling with how to manage this sort of stuff beyond a single scenario for a while, and have finally come up with this three-layer system:
- The imaginatively-named GameController handles utterly foundational information; loading new levels, holding onto the user interface and other shared components and data. It has been around a while.
- The second layer is totally fresh, the Campaign layer; this manages data that pertains to a given scenario. The important thing that I was missing before is that a narrative scenario can (and will) occur over more than one map — the Campaign layer will handle that. Only when you start a new campaign can this information be flushed away.
- The third layer was previously doing most of the Campaign work, the Level layer; this handles data and logic that is global within, but specific to, a given level and doesn’t touch anything beyond that. When I was just flushing the environment and building a new one, this layer was able to hold onto “transitional” data because there was no transition actually occurring.
Needless to say, implementing this required unpicking a lot of old logic and shaving off more than a few old mistakes. I needed a small and safe testbed to work out the kinks, which I found in… a menu fly-by.
It’s no secret that I idolise Unreal and Deus Ex. Both games present their players with 3D scenes that the camera whooshes around, waiting for them to press a button to open up the main menu and get started.
You’re right, this is hardly a “campaign”, but it is an utterly distinct pseudo-level that shares basically no logic with the main gameplay. If I can transition from this dud scene to a new game, and back again, then I can confidently say that everything is working as intended.
With that all seemingly in place, the next step was one I’d been looking forward to for a long time — the character creator.
Dress-Your-Own-Mech is here at last! The Epsilon mech has 21 paintable elements, some of which can be replaced with different physical variations too. This is likely “a bit much”, so I’ve added in the global colour schemes that will set your mech up more coherently — each of the paintable parts knows whether it should use the main, accent or camouflage texture of a given scheme. Then you can override little bits of the main scheme to taste.
The character creator screen is actually pretty special in structural terms, so it was still important beyond the aesthetic.
This is where everything begins — where the campaign parameters are set, where the player takes control of their avatar. Rather than throwing you straight into a new game with no preamble, this is your moment to get warmed up. This is the final piece of the puzzle: which means that the game’s foundations are now… complete.
That means it’s time to double down on fine-tuning and content. I need to add more levels, flesh out that campaign structure, add more units, more equipment… Ahhh, but that’s for the rest of the year. 2018 is going to be the one!
Have a new gameplay video to celebrate!