Note: This video currently has no audio.
[pro-player width=’540′ height=’585′ type=’video‘ image=’http://126.96.36.199/wp-content/uploads/2010/03/tow3.jpg‘]http://188.8.131.52/wp-content/uploads/2010/03/reacttower2009ohneTon.flv[/pro-player]
react!TOWER is a Tower Defense game with unusual interaction. Unlike typical games, which are controlled with a mouse, keyboard or gamepad, you play react!TOWER by placing physical cubes in front of you, which instantly turn into towers on your screen.
A herd of small monsters tries to cross your playfield – you can’t allow this! Place towers along their way, which not only shoot different kinds of matter onto the monsters, but also create a maze that they have to pass through. For each killed monster, you gain money and score, but each monster that manages to pass your field, you loose one of your twenty lives.
To defend yourself against those invaders, you may employ five diffent types of towers, each of which has it’s very own characteristics. If you have earned enough money, you may choose to add another tower, or to upgrade one of your existing ones by rotating the cube so that another side faces up. To get an overiew of the tower’s abilities, you may take a look at the cubes, which have all those values printed on.
In front of you, you’ll find a physical playfield and a screen. Above the screen, a small camera is mounted to capture the playfield. You place cubes onto that field, which are tagged with special visual markers. The reactivision software is able to recognize those markers, including their position, rotation and identity. This physical interface allows direct interaction with both hands at the same time (or even more hands, if you are playing together).
To control the game flow, three buttons are placed below the screen. Even though they are just printed paper glued onto a piece of wood, they actually work: they contain markes which are in the field of view of the camera and are occluded by the players hands. [clear]
First attempt: Virtools
react!TOWER has been implemented two times. The first version was created using Virtools 3.5, an authoring system for interactive 3d applications. The software developement, as well as the conception and all associated tasks were done by the students which are listed on the right.
Programming in Virtools is done by connecting visual Building Blocks, which embody the flow of data and execution through the programm. For advanced tasks, the inner structure of custom building blocks can be coded in a C-like language, which does not allow object oriented programming.
Virtools imposed some more limitations. For example, the physical interaction model allows to place the cubes at any position and arbitrary angles, but internally Virtools used a rectangular grid for pathfinding.
Performance became the biggest problem, because the instantiation of a 3d object takes up to 100ms, but in actual gameplay, about 100 bullets may be created per second. Some optimizations were possible, but Virtools clearly reached its limits.
Second attempt: Java
Therefore, react!TOWER was reimplemented in Java. This was done on top of .10gine, the 3d engine that was already used in the project a place to bee. Because .10gine was already prepared to handle the visualization of games, porting only took about four days to be playable, and was completely done by myself. While many features of Virtools had to be implemented from scratch, the actual game logic became shorter and cleaner by applying object oriented techniques.
In subsequent iterations, the game was refined. For example, the grid based path finding was replaced by a special version of A*, in which the corners of the obstacles form a dynamic graph on which the monsters travel along. Whenever a tower is moved, the graph is updated, and the game engine selects the monsters whose current path is affected, and schedules them for re-routing. The game makes heavy use of multi-threading and asynchronous computations, and scales well onto three or more CPU cores.
Third attempt: C++
The vector calculations, which are used to compute the visualization as well as inside the path finding and game logic, need a lot of object allocations in Java – sometimes as much as 10.000 per second. This leads to memory fragmentation and again puts the game to its limits. For this and other reasons, it was planned to port the game again, this time to C++. The 3d engine has mostly been ported, leading to the project .10gine++. react!TOWER has not been ported yet, but because the same engine is used, porting would be straightforward. After this step, the memory mangement could be optimized in ways impossible in Java.
In it’s current form, react!TOWER is dependant on a specific hardware setup, of which only one exemplar was ever built. To make the game presentable to a wider audience, several videos were realized over the years. The latest one was done by myself, and tries to frame an introductory tutorial into a dramatic, realistic 3d setting. I wanted to mimic the cold, luminous light and the extreme depth of field found in the computer generated Nine Inch Nails music video „Only“, which was mostly archieved up to my expectations.