Sunday, 7 September 2014

To infinity and beyond!

I got a little distracted about posting this update, but we recently added Update 8 to our Steam Early Access, it's primary additions being voice acting for the androids and the last of our three main game modes - Infinity Drive.

Infinity Drive is our take on an endless mode where you fight waves of enemies until you fall. Sessions easily stretch to half an hour or more so it's pretty great if you just want to play a whole lot of Cactus and set in a new stage capable of rearranging itself.

"Oh great, who spilt the blue everywhere?"

Initially we released it with functional whitebox art, and I intended to leave it that way while I worked on other areas of the game but we had such a good reaction that I thought it was important to dress it up sooner rather than later! Since we had all the gameplay worked out from the whitebox, that meant I could start modelling straight over the top.

step 1 : take an egg slicer to the walls

The level is built out of four pieces - the non moving parts, the middle (which is capable of being raised, lowered or forming an island for turrets to sit on) and two wedge shaped pieces that are duplicated to form the main ring.

The visual motif is that the stage should look like it's built out of these metal hoops, like you're inside a stainless steel chamber. After fleshing out the walls, I started cutting into the space below the chamber - the goal was to add some geometry that'd only be visible when enough of the floor pieces retracted, that'd give the appearance of gears or machinery that could be animated and add visual interest.

step 2 : add ambiguous JRPG style architecture

I was switching between texturing and modelling at this stage, I wanted to keep the checker board pattern, but also give the whole thing a clean brushed metal look. From the other levels with changing configurations, I knew it was important that when a floor piece rises to become a wall, the top of it switches over to match the "border" material - this way the space you can walk on reads clearer - and while Influx used flipping plates, I decided Infinity Drive would use sections that slid up and down.

The sliding kept the rig relatively simple, there were a lot of moving parts but they only had to move on one axis so after setting that up I skin-weighted everything and prepared for animation.

step 3 : Green boxes. Lots of green boxes.

Something I learnt from Influx was having a lot of animated meshes on screen (that don't move) is surprisingly expensive, it's much better to have static meshes of their final states and switch them on to replace the skinned mesh renderer when the animation finishes. An added benefit is the static states can be stripped of any geometry that won't be seen once the animation finishes, which means the stage you're actually fighting across contains a pretty efficient amount of mesh.

With the animation set already defined from the prototype/whitebox, I was able to just go ahead and animate everything as one big set. Note the middle piece has more animations as it also has to handle Island state. I animate everything to the same timing, in game we have a small delay between one block and the next block animating to generate a ripple effect (just like Influx although far less noticeable in Infinity Drive) and keeping timings consistent gives me more control when it comes to adding procedural variance.

I could watch this all day - serious danger to my productivity

I have been exporting things to Unity as I go to test, but this is the point where I clean up the last few things and export everything as FBX, then create prefabs and generally set everything up properly inside of Unity, including creating and setting up materials. Fun minor detail! To maintain the checker board pattern on the main ring I had to make alternate versions of the two wedge shapes with altered UV's.

Once everything's in place, the level looks a bit like this!

it'd take practically an army of robot workers to keep this thing polished!

Certainly an improvement, but not particularly colourful! Which was intentional and brings me to the finishing touch. The plan was always to treat Infinity Drive like a space that adapts dramatically - it springs to life as you enter and is full of vivid colour. A much smaller game we worked on in the past called Antibody changed colours as you advanced through score brackets and it worked really well to convey progression.

To pull off a colour change effect, I used a Unity feature I'd only recently heard about, setting global shader properties. When the stage transitions, I set the colour, vector position (the characters current position) and then animate a 0-1 value over time to control the sweep. Inside the shader I use the vector to calculate the distance, modulate it by sine/cosine as well as the alpha value of the texture to make the edge more interesting, and away we go! Setting global properties was a way of reaching every material using a particular shader at once, without having to keep track of renderers/material instances. I wrote a simple script that assigns colours to each of the level configurations and handles the transitions.


The neat thing about handling this effect inside the shader is the versatility - I'm just changing the colour, but it could easily be blending diffuse textures, or normal maps or specular calculations. Anyway, that's the state of Infinity Drive! It's also a bunch of fun to play!

No comments:

Post a Comment