Key Achievements
Selective Post Processing
Weather
Lightning
Fog
Rain
Animation controller clone (Zombie Swarm)
FPS prototype
Real time point lights
Weapons
Rigid body simulation (PhysX)
Level Editor
GUI
Top Down Arcade Shooter – Commercial Title ‘Invasion’
Agile Object Oriented Design
Weather effects can really help create atmosphere in games, however as a feature it remains underutilized in most titles. My code has three major weather effects: rain, fog and lightning, with the exception of the rain currently all effects blend together, for example lightning reflects off the fog.
Selective Post Processing
Lightning
(click to enlarge)
At first I was planning on making lightning work by simply increasing a scalar holding the intensity of the ambient light colour. However this had a habit of creating an impression the lightning was changing the colour of some surfaces when rapidly flashed. The new lightning algorithm saturates colours in the scene when applying the ambient scaler then gradually restores the original ambiance value and colour to create the effect of receding light.
For a video demonstration of the lightning see the videos below demonstrating fog, rain and lightning.
Fog
In the video above you can see the fog as it iterates between various colours and intensities. Fogs are defined by a start distance and a ‘range’ where start distance is when the fog actually starts and the range is how far the fog should remain before completely obscuring your view. The above video demonstrates this by going between start distances of 0 to 10 and ranges from 0 to 150. To achieve the effect of a fade out within the fog range I used the lerp function in HLSL. Fog transitions between colour and start/end range also use linear interpolation but in C++ code instead of HLSL with the aid of a templated function (which can interpolate between colours, vectors, floating point values and many more without needing to be re-written).
Besides creating atmosphere fogs are a great way of hiding distant objects and therefore not requiring to render them, the code automatically detects this and does not render objects which are completely hidden by the fog, this is in addition to basic camera visibility tests it performs using bounding boxes.
Rain
(see above for demonstrations)
Render to texture
Rendering to texture is the process of rendering detail onto a texture. It can be used during runtime to create post-processing effects, reflections and things like television screens or during content creation to add extra detail to an object by rendering such things as lighting or other finer data onto a texture rather than computing it on the fly.
I’ve used this technique to create a top down map during run time for a first person shooter prototype (see top right hand corner):
Below are two examples of using render to texture during the content creation process to add fine details such as soft shadows, ambiance and radiosity to an image, they have no run time effects applied to them whatsoever.
Zombie Swarm/FPS Prototype
The zombie swarm demo is based on a DirectX sample demo provided by Microsoft but unlike the Microsoft demo should have the ability to load different animated models. A bug present in the Microsoft sample where animation would become choppy when faced with artificially low frame rates has been metaphorically squashed. Video below shows the choppy effect occuring at 30 frames per second on the original code.
Also note the yellow effect in the center of the field is a phong based spotlight.
The zombie swarm demo loads up a single animated zombie model and then for every new zombie instance added to the game clones the controller. You can see a video from a top down perspective below, note after death zombies fade out.
.
Lights
Lighting is achieved in a single pass through SM2.0. SM2.0 can only run a limited number of const assignment and check operations in a pass, to get around this problem I used multiple passes but found it to be extremely slow on older computers. To get around this problem and achieve lighting in a single pass I wrote a lighting class which finds the nearest lights to any given model and only uses them in the final lighting calculation. My main inspiration for the lighting algorithm was based on the fog algorithm, lights are calculated in the exact opposite way to how fogs are, there is a radius defined in which the light remains consistently strong after which the light drops off linearly to completely being finished after the light drop off radius is reached. Video below,
The lighting does not at all simulate real world lights however serve to add colour and work on older computers. Of course lighting can be significantly improved if multiple passes are used however early model SM2.0 cards (particularly the Intel GMA910 series) struggle enough under the load of even basic SM2.0 effects and as such having even just these effects is an accomplishment on them.
Rigid body simulation (PhysX)
Calculations for rigid body physics is provided by PhysX, the video below demonstrates how PhysX is implemented, all ‘explosion’ effects have been coded in and are created on the fly.
Weapons
The weapons class is extremely flexible, the video below demonstrates a generic water gun which shoots single bits of ammo forward, a rocket launcher with a user guided trajectory and a gun which ‘grabs’ various objects and drops them on enemies. All weapons must operate in the same basic method however the weapons class gives the programmer a lot of flexibility to easily code weapons with varied behaviour.
Level Editor
The level editor provides many different kinds of objects to be added. The video below shows the building tool, walls are created and collision data is calculated on the fly as the building is ‘painted’ into the game, this is the basis of how the tile object works. Newer versions of the level editor feature more varied kinds of tiles including doors on hinges and windows.
GUI
On a technical level the GUI uses the ID3DXSprite class, all elements of a GUI are derived from a base widget class.
Top Down Arcade Shooter – Commercial ‘Invasion’
The following game was completed in under a week using almost 80% new code (hardly anything carried over from previous work) using a new Physics engine API (Newton).
The game has been released commercially
Agile Object Oriented Design
I have some experience designing classes using AOOD methodology and implementing them from the design. I’ll be uploading some diagrams soon.





