Android for Game Developers• Store files in – APK (read-only) – Internal Storage (read/write, limited space) – External Storage (read/write)• SharedPreferences for simple settings• GOTCHAS – APK size limit (50mb) – Asset file compression bug until Android 2.3 – No direct access via NDK in older Android versions
Android for Game Developers• OnTouchListener and OnKeyListener on View• SensorManager for compass, accelerometer, gyro, …• USB/NFC since Android 3+• GOTCHAS – Horrible Touch API – Multi-touch broken on many devices
Android for Game Developers• SoundPool for sound effects• MediaPlayer for streaming music• OpenSL ES in C/C++ setVolumeControlStream(AudioManager.STREAM_MUSIC); soundPool = new SoundPool(20, AudioManager.STREAM_MUSIC, 0);• GOTCHAS explosionId = soundPool.load(descriptor, 1); soundPool.play(explosionId, 1, 1, 0, 0, 1); – High latency (+100ms) – Broken drivers mediaPlayer = new MediaPlayer() mediaPlayer.setDataSource(descriptor.getFileDescriptor(), descriptor.getStartOffset(), descriptor.getLength()); mediaPlayer.prepare(); mediaPlayer.setLooping(true); mediaPlayer.start()
Android for Game Developers• Device-specific driver bugs (audio, OpenGL ES)• Android version-specific bugs• Multiple test devices (3-4) – PowerVR, Mali, Snapdragon, Tegra – Low-end to high-end phones – Tablet• Or use a framework/engine!
Frameworks & Engines Not exhaustive, visithttp://mobilegameengines.com/
Frameworks & Engines$$$Free$$$Free$$$FreeFree$$$ Not exhaustive, visit http://mobilegameengines.com/
• Java (lots of C/C++ under the hood)• Develop on the desktop 90% of the time (no slow deploys, no emulator madness)• Abstraction layers – Low-level: OpenGL ES, file i/o, input, audio, ... – Mid-level: shaders, textures, linalg, … – High-level: fonts, sprites, scene graph, …• Pick and choose, see feature listhttp://libgdx.badlogicgames.com/features.html