February 17, 2013

Android gaming performance

Recently I started to port Biodrone Battle to the Android platform. Thanks to Libgdx the view part is quiet easy to manage, but all in all it still takes some time. On a Nexus 7 I get the following frames per second after loosing the breaks (Thread.yield() is called for each frame):
Thread FPS Tasks
server ~ 3.500 game logic, goal based AI, collision detection, A* path finding,
sprite movement, finite state machines,
field-of-view calculating with shadow casting,
game state & scores
client ~ 32.000  input handling, server event processing, managing sounds

view 58-60 painting sprites, tiles, particles, lighting and shadows,
tile map scrolling

Game and framework were designed for the desktop first in an object oriented way without considering the slower Dalvik VM. Some more technical facts:
  • data encapsulation, private fields, a lot of polymorphism, interfaces, immutable vectors, no static methods, floats for game locations.
  • 8 game actors for this benchmark
  • 1280x736 as display mode
  • Nexus 7 quad core, 16GB, Android 4.2.2
  • Dalvik launched with large heap (results in 384MB)