2D Shadows Shader Sample

Spring 2013

As a learning excercise, I set out to recreate Catalin Zima's Dynamic 2D Shadows sample using DirectX 9 with C++ instead of XNA with C#. Afterwards I implemented his shader-based method for the same effect using the previous sample. The current sample focuses on computing shadows for a 2D environment using shaders, render to texture and texture blending techniques. The final result mimics the original sample at a good framerate in release mode.

One of the main challenges for this excercise was working around XNA-specific features, such as SpriteBatch, and determining equivalent function calls in DirectX. In addition to this, my version deviates from the original in that the texture reduction method sweeps through 8-pixel wide chunks for each pass instead of repeatedly downsampling by a factor of 2. I felt this was more optimal as it reduced the number of overall texture sampling and comparison operations.

During this project, I focused a lot on optimisation and considering how certain methods and techniques would affect the framerate. For example, the drawing code for shadows was the subject of much deliberation in the original sample and was rewritten several times during development to try and improve performance. Further, I often broke the code into phases and used debugging tools such as PIX to see exactly how much certain operations affected the framerate.

Sample Archive
DirectX 9 Redistributable

Bada Pool AI

Spring 2013

As part of a 3 week internship at Mobile Pie, I was tasked with updating one of their games for Samsung devices. Among some fixes and other features, one of their suggestions was to add an AI-controlled player. In the existing build, the game could only be played with 2 players taking turns with the phone and it was reasoned that it would be much more popular if it could also be played with a single player.

The AI player takes the role of Player #2 (yellow in the video above). It works in three phases; first checking whether it can directly pot any balls, then checking if it can just hit any balls, before finally checking radially around itself and selecting the best direction. It features roulette wheel selection, so it doesn't always pick the best shot, and some randomness, so it doesn't always make perfect shots.

This was a good exercise in creating AI from scratch, as I had to decontruct the behaviours I wanted and determine what the best method to achieve them was. In addition, it was also a good learning experience as I had to work with Samsung's Bada OS and the Chipmunk Physics Library, neither of which I had very much (if any) previous experience with.

Project "Lead"


Project Lead is a small personal project I worked on immediately after finishing university to keep my programming skills sharp and to continue learning. The final build takes the form of a simple survival shooter where the player has to survive against waves of zombies for as long as possible, using simple weapon power-ups along the way.

During development, I had to look into many areas of game design such as collision detection, raycasting, serialisation, pathfinding, state machines, and more. Enemies have a rudimentary AI that allows them to wander and idle aimlessly. On hearing a sound, a player's shot in this case, they can pathfind towards the source to investigate. They will only chase the player for as long as they can see them, otherwise chasing to the last known position.

Of the lessons learned, one of the more crucial was in maintaining a flexible and robust code base so that new ideas can be easily implemented and sections can be quickly modified later. The use of abstract base classes and simple interfaces became an important tool during later production. Also of importance was being cautious of feature-creep and setting manageable goals.

Game Archive
XNA 4.0 Redistributable

Dynamic Waypoint Generation Demo


This tech demo was the basis for my final year computing project at university. The project mainly focuses on exploring dynamic generation of waypoints for AI agents, but also branches off to cover related topics like navigation mesh generation. The application was written using C# and the XNA tool kit for rapid prototyping.

In its current state, it can read in level data from text files and then step through the process of generating a navigation mesh for them by segmenting the terrain and triangulating each area. Triangles are then semi-randomly selected and a simple implementation of the A* algorithm is used to find a path between them. By increasing the weight of nodes as they get used in paths, the application generates routes which tend to avoid each other.

Some of the lessons learned from this project were the ideas behind generating a navigation mesh, as well as how to utilise weighting in A* to manipulate how paths are generated. With more time, I would have improved on existing features such as the distribution of paths generated, supported file types and AI behaviour, as well as optimising existing processes like triangulation.

Project Archive
XNA 4.0 Redistributable

Vertigo Game Project


Vertigo was a project I was part of during my final year at university. The aim was to make a simple game with some cooperative/competetive gameplay mechanics as part of a small team. My key role on the team was to supervise most of the programming. This project was also developed using C# and the XNA tool kit, as it was the system that the group was most familiar with.

One of the key technical features is a basic procedural level generation system. Given the simple nature of the game (where there are only solid and empty tiles), the system is able to consistently generate valid levels within set parameters (dimensions, collectible frequency, etc.). Another key feature is the use of both 2D foreground sprites and 3D background models, linked to move simultaneously with the camera to create a sense of depth.

This project helped reinforce the importance of proper team coordination and management for me, as well as helping me explore some new subjects like procedural level generation and 2D-3D transformations. Some areas that I would improve on would be the addition of more dynamic powerups (like ice blocks) and more tile types like ladders and crates.

Game Archive
XNA 4.0 Redistributable

The project specification required two versions of the game, one for PC and another for an arcade cabinet. Both versions of the game support Xbox Controllers and keyboard-emulated arcade controls.

Xbox Controller P1 Keyboard P2 Keyboard
Jump/Select A Left Shift W
Back B Z I
Pause/Select Start 1 2
Move Left D-Pad/Stick Left Left D
Move Right D-Pad/Stick Right Right G

Unreal Level Design Project


A basic games level design module was included as part of my second year of university, which focused on some of the technical aspects of Unreal Editor 3. One part of our project had a list of features we had to implement in order to demonstrate our knowledge and understanding of the tool.

- A simple room within which a gassing effect is required.
- A corridor with structures that posses motion.
- A gate with a complex trigger and series of intermeshing elements.
- Another corridor which deals with staggered switching of lights.
- A door involving the use of alpha blending and material editing.
- An industrial/space engine room with a series of fires.

Some of the main areas explored with this project were custom particle effects, dynamic lighting, material editing, and Kismet sequences. Additional areas were explored such as lightmap usage, to create more intricate shadows in areas, and trigger volumes, to apply a more immersive "damage over time" effect in the gassing room.

Given more time, I would have enjoyed further exploration of Kismet and lighting to create other suggested effects such as a "light bridge" or to improve areas such as the complex gate mechanism.

UE3 Level

Maya Fireworks Generator


This project was for a Scripting for 3D Graphics Applications module during my second year of university. It was one of 4 specifications available and focused on creating a fireworks particle effect tool from scratch for use in Autodesk Maya.

The product allows users to define a variable number of fireworks "clusters", which are created and managed by a dynamic UI system. The UI scales to match the number of fireworks clusters specified by the user and allows them to select different preset types like rockets and fountains, as well as configuring variables such as positioning, colour, magnitude and more. The script then loops through a set of instructions and generates the firework objects using the variables specified.

This project helped increase my knowledge with script-based design, particularly in the area of UI functionality. Additionally it allowed me to gain more experience with particle systems and the functions related to them such as gravity and drag. The script could be improved by allowing the user to select firework clusters and adjust them using the UI.

MEL Script

Spaceship Assignment


One of our projects for our Coding for Game Development module in second year was to make a 3D spaceship demo using XNA 3.1. We were given some basic assets and told to make a simple tiled background (for orientation), a controllable spaceship and a dynamic camera.

The specification required us to be able to move and rotate the ship in all 3 axes as well as moving, rotating and open/closing the arms. The camera also had to follow the ship and be able to rotate around the ship's local axes. There were also some additional tasks to add a togglable first-person camera and to make it so that the third-person camera would reset after a period of inactivity.

One of the key areas of this project was the use of quaternions to avoid the typical problems assosciated with movement around 3 axes (namely Gimbal Lock). This was our course's first in depth look at 3D programming in XNA and it was interesting to see what sort of considerations were added when working in 3D, such as camera matrices.

Assignment Archive
XNA 3.1 Redistributable

Connect 4 Game


As part of our second year C++ Programming module, we were tasked with completing the implementation for a simple Connect 4 game. The core source code was given to us and we had to implement the gameplay and win conditions. The program was written using C++ and Qt for the basic UI elements.

- Allow the user to toggle grid slots in alternating colours for each player (filling from the bottom).
- Check for winning combinations and display the results as a dialog box.
- Create a dynamic menu bar (so you could only save while a game was in progress)
- Add a rudimentary save/load functionality while a game was in progress.

Up until this point our group had only made basic console programs in C++. As such, this was our first introdution to C++ GUI development and it was interesting to see how typical applications could be created using it. In particular was the use of Qt's signals and slots, which were similar to the C# events and handlers we'd worked with before.

Game Archive

Coding Style


This last section is an additional footnote regarding my programming style, as I'm aware of the importance of a legible, structured format when working in a group. The file pictured above is an example from a personal project dealing with managing and querying an input state.

My usual coding style involves common conventions, adjusted for personal preference:
- 90 character limit.
- File description headers.
- Regular comments and summaries.
- Group segmentation (using #regions).
- Regular use of properties to expose fields.

I was taught to use simple, descriptive names for variables and methods (using Camel or Pascal cases depending on whether they're variables or methods/constants), however I am aware of Hungarian notation and it would not be difficult to transition to such a coding style.

C# Demo Class