Middleware/Muddleware: Unity-Based Stuff That We’ve Been Using To Make Development Easier And More Interesting

With Sir, we’re leveraging, or in some cases planning to leverage, a fair bit of middleware. But let’s be clear: By middleware I don’t necessarily just mean full blown systems like Speedtree and Scaleform (neither of which we could afford to use anyway), but also all the smaller bits of tech and code libraries we haven’t completely written ourselves from scratch. Basically, this post is about a bunch of cool stuff we’re putting into Sir, and “middleware” seemed as good a catchall as any. Read on if you want to see some Cool Things that go into the weft and weave of tweedpunk.

Head Tracking
First up Track IR. I’ve been in love with this head tracking system since I first encountered the TrackIR 3 during my tech-lovin’ PC Format days, a love that grew a few years later when I worked on ArmA2 and saw the power this simple device had to draw you deeper into your games. Put simply, Track IR is a high speed camera that tracks your real world head movement and converts that to In-Game character head movement. Why don’t you end up looking at the wall of the office and peering out of the corner of your eyes a the monitor? Because TIR amplifies and exaggerates your movements. In practice you rarely move your real head more than a few degrees, but the feeling that you’re moving your whole head like the in-game character is intoxicating. It becomes a totally natural and instinctive thing and you miss it dearly in games where head movement cannot be independent from body/gun direction. Originally invented for flight/driving sims, the suitability of the system for FPS games where situational awareness is more important than twitch reflex is quickly apparent and the benefits cannot be overstated. It’s going to be in Sir, thanks mostly to this excellent plugin by Tobias Boogh. Situational awareness is all important in Sir, as you try to dodge Hunters across the grim moors, so TIR will come in very handy. For those who don’t have or cant afford to buy the hardware one, we’re also going to look at Freetrack and – if all else fails – you’ll have a modifier key so you can look around with the mouse without turning your body.

Inverse Kinematics
So Max Payne 3 is doing the rounds at the moment, showing off just what a difference procedural animation can make to embedding the physicality of a character into a gameworld. Watching Max slam himself into walls and wrap his middle-aged manflesh around a post is deeply satisfying but also somehow unnoticeable. It’s done so well that you could almost miss it, it’s just so natural. OF COURSE that’s how a body would react. We’re trying – albeit in a far, far lesser way – to have something of this well-rooted physicality in our animations for Sir, You Are Being Hunted. Because our world is procedurally generated, we can’t know with totally accuracy what kind of terrain an AI’s path might take them across. Slopes might turn out to be terraced, there could be a rock half way along a path that a character in real life would step ON rather than avoid, should we allow Hunters to simply pass through a fallen comrade’s body or would then walk over it? Animating these eventualities is tricky. Even today a lot of games, especially in the indie sector, are happy with simple walk animations that don’t react to the pitch of a slope, or obstacles underfoot, but just play the same regardless of the terrain being traversed. Not so with Sir. Thanks to Unity dev Rune Skovbo Johansen’s Locomotion System we can cram some of that Max-like fluidity into our game. The Loco system is really ingenious. By taking the velocity of a characters movements and comparing them to the distances between the footfalls of a given animation sequence, the system can create smoothly blended IK animation for any surface. Feet and legs align to slopes, legs bend to accommodate steps, running and walking animations are blended between one another procedurally and automatically. It’s really quite the thing. Of course, we’re not anywhere near the sort of graceful fluidity Rockstar can enjoy thanks to Euphoria and a bucketload of programmer cash, but it’s amazing that we can even consider implementing any mind of procedural IK at all.

Ultimate FPS Camera
This is an interesting thing we’re looking at. We’ve previously been rolling our own camera and FPS control systems for Lodestone and Sir, but this system caught our eye mainly because of it’s procedural animations and mouse acceleration functions. We’re all about procedural stuff at BR, mostly because we don’t have the staff to spend weeks hand crafting tons of art assets. Every anim we make costs time and money we don’t really have, so if something offers good results procedurally, we take it. The alternative is to not have things like weapon sway and head bob and recoil and all that good stuff at all, and those things can really make or break the feel of the gunplay in a game. Take ArmA’s oft-debated mouse movement (please), and compare it to something like Battlefield 3. You could argue for days (and people do) about the relative merits and demerits of those two opposing approaches to gun-holding, but the point is that people do. It’s important enough to try and get right, otherwise we’re all still playing with the fixed guns of Doom.*

Ok, so Unity’s built in GUI is appalling. No two ways about it. It’s clunky to work with, cumbersome to code and worst of all an absolute porker of a resource hog, even if you’re careful with your code. You only have to look at the alternative top sellers on Unity’s third party plug-in pluggin’ service the Asset Store to see that people want something better. Of the many flavours, we went for EZGUI. This is all pretty dry stuff for a blog post so I won’t bore you with too much detail, but it’s worth mentioning if only because it allows us to have GUI elements in the 3D space of the gameworld itself, something we could never do with the standard engine tools. Having GUI elements in the 3D worldspace means we can do stuff like have keypad buttons on doorways and other funky stuff like that… Aaanyway, moving on!

Strumpy Shader Editor
Node based graph editor thingummies for code are all the rage, but Stramit’s Strumpy is the bee’s knees, not least cos it’s free. While legendary programmer Tom Betts is more than capable of hand coding the shaders we’ve been making use of in Lodestone and now Sir, You Are Being Hunted this node-based editor allows us to rapidly test and experiment with shaders to get some great visual effects. Most notably, Tom’s tri-plannar shader for texturing a procedurally created terrain. We could certainly make do without it, but with it anyone can mess around writing their own shaders. Have a go yourself…

There are a bunch of other middleware solutions we’re implementing, not to mention the code libraries we’re drafting in and butchering for our pathfinding and steering and so on, but I’m running out of space. A quick mention should go to Tomaszek’s Volume Grass systems (which you can see a good example of here). We’re hoping to implement that really soon and maybe eventually use it to have footsteps leave depressions in the grass so you can track enemy movements! Exciting stuff. Mostly however, I want to point out what could arguably be called our own ‘middleware’. Tom’s amazing infinite procedural terrain generation stuff constantly gets asked about whenever he does talks to other developers. “Can we buy this system anywhere” they ask. Well, maybe, one day…

*”The Fixed Guns Of Doom” is an excellent name for a thrash metal band or a 60’s WWII film.

Something to say? Head over to our forum!