The Evil Genius Online Manifesto Vol. 10

EGO: Optimising Lair Rendering

To play Evil Genius Online click here.

To visit the EGO fan page click here.

With one of the main goals of Evil Genius Online being to target as wide a range of hardware as possible we thought it was about time we optimised one of the most CPU consuming tasks of all, rendering the terrain and level tiles. There were 3 main steps we looked at, reducing the number of draw calls on the floor and ceiling tiles, simplifying the border regions and simplifying the granite chunks.

The initial approach was completely brute force. A lair is split into 30 by 30 tiles, so that’s a worst case of 900 different instances of the tile mesh. Not ideal when you’re dealing with optimising the CPU. Just not rendering these meshes gave us a 20% speed boost. A slightly cleverer approach would have to be taken than just drawing each tile.

The theory was that we only wanted to make a single draw call per room type, this would reduce the number of draw calls for tile rendering from 900 to around 10 for a typical lair. To do this we came devised a triangulation pass on the tile map. First running horizontally, to generate rows with the same tileset, and then running vertically down to create rectangular areas of the same tileset.

The crude sketches below illustrate the method. As is evident, even on a relatively simple map, the number of triangles is massively reduced.

Image and video hosting by TinyPic

The next optimisation was to batch these by tileset. For example the second rectangle on the top row and the middle rectangle could be batched into a single mesh as they are the same room type. The same goes for all of the other rectangles. Like this we ended up with two meshes in this case for Room A and Room B, or in a realistic map, about 10 room types and 1 for the rocky (not dug out) region.

The following image shows this approach working. Each mesh in the tile region is assigned a random coloured shader. At this stage we can obviously assign the final texture to the mesh and everything should look identical to how it looked before.

Image and video hosting by TinyPic

Initially a similar approach was taken for granite and the tiles around the edge of the map. These were all composed of smaller tiles. The rocky edges were all made up of actual meshes with reasonably high polygon counts. To overcome this we projected the 3D mesh to create normal maps that look almost as good as the original meshes. The upside being all the edge tiles take a single draw call, and use only 16 triangles for the edge region and a further 16 per granite chunk, a huge performance boost (not to mention improved load processing time).

Overall the game runs much smoother now than it ever has, using almost 50% less CPU time than it did before (for a map with a small number of furniture in it). Another improvement that has also come in is the removal of transparent lighting on low quality mode (an improvement of 10% on the CPU).

Future plans to further improve performance are to batch any none animated instances of furniture and walls into single draw calls by merging them all into a single mesh. We will also be supporting Adobe’s baseline constrained mode which will support a wider range of hardware than ever before. We have had the game running a solid 30 frames per second (FPS) on an Intel Atom based netbook with a single core and integrated graphics! Stay tuned for updates on these two big boosts over the next few weeks.

To play Evil Genius Online click here.

To visit the EGO fan page click here.

evil genius

Latest Videos from Rebellion

Sniper Elite 3: Launch Trailer

  • Sniper Elite 3: Launch Trailer
  • Sniper Elite 3: Save Churchill DLC Announcement
  • Sniper Elite 3: Limited Special Edition Unboxing