Game Development

Blog 867: Fragment v0.05

Sometimes you spend six-ish weeks unwinding a whole universe of poor design decisions, all of which results in a single very subtle visual change for a small number of units. Other times you finally jemmy in a proper Game Over screen which, okay, yes, maybe was a little bit long overdue. Then you’ve got three weeks off over the festive season, and while you were planning to take a break and do some Unreal Tournament modding (or, horror of horrors, actually play it), you end up implementing object pooling and some other bits of random junk.

Finally, you realise that you’ve been working on Exon for so long that even your demo is now a year old. Happy new year! Let’s celebrate with a new version — go and see if you can find your way into the new secret level! (It’s probably not worth it.)

Fragment v0.05

Of course I’m being facetious. The unwinding of a whole universe of poor design decisions was a follow-on from extracting the gameplay logic from the art logic. As I was rewiring to reach that point, I realised that I had three different animation control systems — two of which literally competed with each other for control of the same underlying model. Also one of those contained an entire boatload of melee attack logic. Oops.

The problem with having three competing animation control systems was mainly that I had to jump through hoops when creating a unit to know which one(s) were present and where. Your player character might have had a MeleeAttackController on its turret and a UnitAnimator on its legs, but the Rust Mites had both on their root objects because they don’t have independent turrets but do perform animated attacks. The spawner thus had to work through the different parts of a unit to determine which bits of animator were present and where, and thus which ones should take priority. Also they all needed to be told about each other. Eugh! Who wrote this crap?

I’ve also slipped in some more billboard adverts. You’ll surely encounter some of these brands directly in the future.

I am now in a situation where a Model simply has animations (or not). It is not possible for a Unit to exist without a Model, so that’s a heap of if-else conditions right in the bin. If the Unit has a Turret, then that’s cool — the Turret is simply another Model with its own independent animations. A tiny switch says whether the melee attacks come from the Turret Model or the main Unit Model and that’s that; if they come from the Unit Model then there’s no clashing between two distinct objects, the animation controller just knows which animations to play when.

Of course the real highlight is that a Unit’s Model is now independent from its collision and pathfinding. This might not sound like much, but it’s actually been on my primary notepad to-do list for a long time because it enables one important thing: long and low units can now pitch as they go up and down slopes. I mean, sure, they could have done before, but it would have melted their collision and therefore everything else; now, the artwork can rotate to match the slope without disrupting all the pesky gameplay logic underneath.

Even in an action shot the fact that the Giant Rust Mite tilts is barely noticeable, but on the other hand, when it *didn’t* tilt it looked awful.

The other headline feature is the Game Over screen. I actually got quite an amount of feedback pertaining to people thinking the game “bugged out” when they were obliterated by the train… like, mate, your mech just blew up, isn’t it obvious? Anyway, I’d been avoiding this for quite a while because it wasn’t as easy a feature to implement as it looks.

You’d think it would just be a matter of registering when the player’s hero died, and then throwing up a window. Sure, but due to the Arena (and the Gauntlet), there are situations where the player’s hero can die and it’s not Game Over. How could I disambiguate between the Hero as the unit you generated during character creation, versus the Hero as any random unit you might be controlling for a side quest?

So yes, I needed to add something to the campaign metadata to say, “it’s only when this unit dies that it’s Game Over.” So far so obvious, but this butted into the save/load system — the metadata is a special case save file that is only designed to hold primitive values, not object references. This is the file that basically says “this is a saved game and not just some rando crap.” (This is why the game breaks if you try to load a saved game while you’ve got the metadata file open in Notepad. Oops.)

How did I fix it? Why yes, I did jemmy in a single object reference to the campaign metadata file, making my save/load logic another step more confusing… but at least it works. Future Robbie can deal with this some other time. (Regrets, I’m going to have a few…)

Why did I jump down onto the tracks? It’s a SECRET.

I also forked over for some more sound effect libraries and have splashed around a load of new effects. Every year, Sound Ideas do a 50% off sale, so I had been waiting for the opportunity to expand my roster for a while. Don’t get me wrong, I still love and rely a lot on the General 6000, but now I’ve been doing sound for a couple years, I have a slightly better idea of what I need and what I’m missing — so I decided to get some more specifically sci-fi and fantasy libraries. (Giving me more than two laser gun sounds to choose from, amongst other things — I believe I now have the Quake II railgun sound, the Deus Ex plasma bolt impact noise, and the Tiberian Sun Nod laser turret sound. Aww yiss.)

Okay, at 50% off these libraries are still not exactly cheap, but I’m more than happy with my purchases because I am not a sound engineer — I’m happy to pay for quality to fill the gaps that I can’t do. On the other hand, for a lifetime royalty-free single-user license, the 50% discount makes them suprisingly affordable. (Curiously, I’m relying on textures.com for textures and don’t need to pay a thing to them for the low resolutions I operate at — I have had my eye out for paid photo texture libraries, but apparently they’re simply not a thing. Maybe I’m searching for the wrong keywords?)

Speaking of which, I’m still in the market for a composer, and I get the feeling that the cost of music is going to make these sound libraries look like small change… but again, it’s one area I simply cannot do so I’m willing to splash out. I’m looking for tunes in the style of Unreal and Deus Ex, if you’re interested!

So yeah, happy birthday Fragment, happy birthday Exon. Nine years down — how many more to go, do you think?

… That doesn’t look right…

And you tell me...

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.