Tuesday, 4 February 2014

Outlining and other 3D UI tropes

The all new official web site for Combat-Helo (are we still going with the hyphen?) will launch real soon (this week). All future blog entries will be posted there, this blog will serve as a personal and more technical insight into development for other projects. Where is this awesome new web site? I'm not telling as it's not live yet (check back Thursday).

In the meantime I've been working on 3D user interface code that will work with Leadwerks 2.51 (depreciated). All the bits needed to enhance the GUI such as outlining of selected entities, see the Hellfires in the free-roaming arming mode shown in screen-shots below. 



Once upon a time creating this kind of effect was easy in OpenGL using stencil buffers, or some flipping normals trick combined with object rendering order. However in Leadwerks, complex scenes require a little extra work; the creation of a new World, new Buffer, a Camera, post-shader. Hmmm, exactly the same way the cockpit is rendered.

In the main draw method, once we've done the bulk of the scene mesh rendering, we render this new outline world as a post process prior to the deferred lighting stage. The output buffer of this outline world is then alpha-blended over the Leadwerks gbuffer, a frag shader processes the output buffer adding the highlight colour.

Once that modification to the main render method was completed, we can outline any world entity by copying it into the outline world. This is what we do during arming or other menu mode. We had to use EnityUserData() on created outline world entities to maintain links to the main world entity (you can't parent between worlds without some kind of book-keeping).


In addition to this we needed 3D UI objects to facilitate area marking for things like triggers and unit formations during editing. So I built a class that generates the geometry to create these animated "force-field" looking objects that form fit to the terrain using a feature of the built-in vegetation shaders.

#define LW_MESHLAYER
#define LW_UPNORMALS

Creating groups of units and assigning them as primary targets, or special formations can be done by area rather than linking at design time. Simply throw down a bunch of vehicles in proximity and ring-fence them as a unit. The Formation manager will try and do the rest. The game portion is starting to come together, I'm sure we can find ways to improve WYSIWYG mission editing.

You can add a dozen oil storage tanks, wrap them in a target-zone and set the zone as a "primary target". Destruction of a percentage of primary targets are considered for mission evaluation. We also have secondary, tertiary and specials.

Sadly what you don't have is an infinite supply of ammo...unless you enable cheats and type "/rearm" into the console window.

A Call for Arms

We're looking for new models, specifically more radar and SAM units such as SA-10s, Rapier batteries etc. to make deadly spaces (the Hills have Eyes, or so I'm told). I'm still working on the ASE demonstration video, I stopped to add some features to the avionics when recording but I'll pick it up again this weekend once we've launched the new site.

I would love to add more threats to our release, if you've been in touch already then expect an email from me in the next few days. With so much going on I'm behind as usual.

See you at the new site at www.combat-helo.com in a few days and clear skies. You have control.