Case study: Aeon Racer – ShiVa Engine

Case study: Aeon Racer

Aeon Racer is a neon-styled retro arcade racing game in 2D. In short, you control a space ship and have to fly through gates, avoid obstacles and gather up pickups to gain the ultimate highscore. Aeon Racer is available for iOS, Android and ShiVa3D Webplayer. In this case study we, the developers, would like to give an overview about how we created this game.

Why ShiVa3D?

We choose ShiVa3D for several reasons, most importantly:

  1. ShiVa3D supports the targeted platforms, iOS, Android and Webplayer. All our previous evaluations have shown that you really can develop once and conveniently deploy on all these platforms without any trouble.
  2. ShiVa3D offers more features at a lower price than other solutions.
  3. Building our own engine wasn’t an option. Come on, we’re here to make games, not engines!

A 3D engine for a 2D game?

Browsing the ShiVa3D forum, people keep asking whether or not it is possible to create 2D games in ShiVa3D. The answer to this question is that you have three ways of doing so:

  1. use the HUD system;
  2. use billboarded planes;
  3. use 2D objects (not necessarily limited to planes).

Each approach has pros and cons; we choose 2D objects because we wanted to be able to access all the features the engine offers, such as physics, materials, skeletal animation or particle effects.

Special 2D techniques like sprite sheet animation aren’t supported out of the box, but could be implemented via scripting if needed.

Creating the game

So let’s take a look how Aeon Racer is built up. In ShiVa3D, a scene is generally composed of so-called Models (which others might refer to as game objects or entities). We created a Model for each object type the game needs (space ship, miscellaneous gates, pick-ups, accelerators, etc). As a concrete example, the gate-Model consists out of the following components:

*Two textured planes representing the left and right side of the gate;
*Three sensors for collision detection: one if you pass the gate in the middle, the other two if you hit the gate;
*A dynamics controller (we actually don’t move the ship through space, we move the gates towards it);
*An AI Model which handles the collision events (e.g. colourises the gate green or red if you pass or hit it respectively).

A screen shot is shown below:

Levels And Beyond

The good thing about ShiVa3D is the WYSIWYG aspect. As stated above, you compose your scenes using the models you defined. In Aeon Racer, the levels are quite long and thus full of models. We ran our first prototype on a HTC Magic and were pretty soon confronted with performance issues. That’s why we decided to pool all the level objects, keeping these pools as tight as possible and store each level in an XML file instead of using ShiVa3D-scenes. At a first glance, this seemed like a smart move, and the performance problems were (temporarily) gone.

What we didn’t see, is the drawback regarding level design: modifying XML files in a text editor can’t really be considered as WYSIWYG. This especially became an issue as we started tweaking each level, so we had to come up with a solution: a ShiVa3D-scene-to-XML-exporter.
Thanks to the scripting API, this was done within an hour. We could now create our levels inside ShiVa3D, export them to XML and load that XML in our game. Still a bottleneck, but far better than tweaking values in a text editor plus we could hold on to our pooling system.

A screenshot of one of our levels in both forms (inside ShiVa3D and the corresponding XML) is shown in the following image:

The artistic aspect

Aeon Racer tries to incorporate a retro-styled neon look. We did this by creating simplistic textures,  setting the material blendmode to additive and colourising the ambient term of the material a bit. This allows us to vary the hue of each gate and thus achieve a more visually appealing result.

Also, due to the fact that most mobile devices don’t have enough power, the glow effect was baked into the texture. The following images show the original texture and the in-game result:

Performance optimisation

Besides the object pooling already mentioned, we made use of the following performance optimisation techniques:
*We cut down textures: we kept the resolution as tight as possible. This means hardly any 512 textures. This was more of a tweak-and-test-if-visually-still-ok process – and had big impact regarding performance.
*We deactivated collision detection for objects in the pool. We experienced random frame rate drops every once and a while and didn’t quite know why. Looking at the code, we discovered that each time an object is put back into the pool, it gets placed at the same position as all the other objects in the pool. This meant that all of these objects were firing collision events – which weren’t needed in any way! The solution to this problem was to simply deactivate the collision detection for temporarily pooled objects.
*We didn’t implement the following point, but are considering it for an update (if needed): in order to lower the number of rendering state changes, we would put all the object graphics in one texture. Since we’re using 2D objects rather than, for example, billboards (meaning we got access to the meshes and their UVs) it is no big problem to update the models.

Conclusion

The decision to use ShiVa3D really helped us a lot. We had a prototype of our game up and running within a few days. The realtime preview ability of the materials, for example, helped our artists to achieve the desired look and feel. Also, cross-platform publishing is a matter of minutes and works really well.

The downside is, if you ever happen to need a feature the engine doesn’t support, you might have to figure a workaround. That’s feasible in most cases and therefore never happened to be a big deal for us. However, if you create a 2D game and need some collision detection or physics, you have to use a 3D physics engine, which might be a waste of performance, for example.

The support, on the other hand, is excellent (the support forum is king) and most problems can be sorted out quickly. All in all, we are convinced that ShiVa3D was the best choice for us and are looking forward to our next project with it.

Aeon Racer: features

*2D high speed racing game;
*Retro style ‘neon’ graphics;
*Three galaxies to play, each with their own individual design and challenges;
*Bonus ‘infinite’ level for high scorers.

About the developers

Formed in  January 2011, Modern Alchemists is devoted to converting creative ideas into compelling games. Their games are primarily available for mobile devices like the iPhone, iPad and Android but also for web browsers. Modern Alchemists was founded by four graduates of the University of Applied Sciences in Hagenberg, Upper Austria.
Check out our website at www.modern-alchemists.com or follow us on Twitter @m_alchemists!


  • slackBanner