Cars

Cars Splash

Cars

Cars is an Android racing game based on the Pixar license. The game features a single player campaign and quick races.

Performance

I was involved in the performance and graphical part of the game. After the challenging experience with Dragon Mania we had to establish several work patterns like putting as many sprites as possible within a single sprite for sprite batching, set a choice of tile size for the tilemap, and implement vertex buffer objects for the tileset. I also developed a very compact data loading system, since localization and other data potentially take up a lot of space in memory.

cars_sshot1

Convincing the artists was somewhat difficult since they were used to techniques applicable for MIDP games, and color palettes were a very big constraint; spritesheets in the graphics library system have 256 colors maximum, and going over that is not possible. Therefore adding more sprites with varied colors ends up degrading quality. Eventually one of the leads got engaged and started enforcing good practices and clever solutions.

The tile size was set to 64×64, and although the tile artist was unconvinced at first (he felt like he had little flexibility), he worked around it quite gracefully and the results ended up being very good. Many games at Gameloft have very harsh size constraints due to their prepackaged nature, i.e. they come preinstalled on many phones. Removing assets is always a decision we try to avoid, therefore clever loading and packing is essential.

cars_sshot2

Another related problem was garbage collection. The programmers were experiencing strong periodic hiccups on old phones, and an analysis of the heap revealed that a lot of memory was being created/released in a very short amount of time. Old Android phones suffer this problem especially, since both the program and the garbage collector run on the same core. Delving into the code revealed some careless object allocations, especially many String object concatenations. Careful rewriting of this part of the code helped enormously.

Comments are closed