development of cross-platform mobile game technology
DESCRIPTION
TRANSCRIPT
![Page 1: Development of cross-platform mobile game technology](https://reader034.vdocument.in/reader034/viewer/2022051513/547dc33ab379596f2b8b5303/html5/thumbnails/1.jpg)
Development of cross-platform mobile
game technologyBenjamin J. BlockCute Attack, Oy
Shared Gems 2013
![Page 2: Development of cross-platform mobile game technology](https://reader034.vdocument.in/reader034/viewer/2022051513/547dc33ab379596f2b8b5303/html5/thumbnails/2.jpg)
![Page 3: Development of cross-platform mobile game technology](https://reader034.vdocument.in/reader034/viewer/2022051513/547dc33ab379596f2b8b5303/html5/thumbnails/3.jpg)
![Page 4: Development of cross-platform mobile game technology](https://reader034.vdocument.in/reader034/viewer/2022051513/547dc33ab379596f2b8b5303/html5/thumbnails/4.jpg)
PhD in Computational PhysicsUniversity of Mainz
Mobile Games Technology
![Page 5: Development of cross-platform mobile game technology](https://reader034.vdocument.in/reader034/viewer/2022051513/547dc33ab379596f2b8b5303/html5/thumbnails/5.jpg)
![Page 6: Development of cross-platform mobile game technology](https://reader034.vdocument.in/reader034/viewer/2022051513/547dc33ab379596f2b8b5303/html5/thumbnails/6.jpg)
Background
Software Engineering in Games is HARDArchitecture is most important challenge
Why?● High performance constraint
● High complexity and interconnectivity
→ Can reusable and modular software design be achieved while maintaining high performance?
![Page 7: Development of cross-platform mobile game technology](https://reader034.vdocument.in/reader034/viewer/2022051513/547dc33ab379596f2b8b5303/html5/thumbnails/7.jpg)
Why no middleware?
● No control over development
● Performance penalties
● I wanted to learn something
● It's more fun
![Page 8: Development of cross-platform mobile game technology](https://reader034.vdocument.in/reader034/viewer/2022051513/547dc33ab379596f2b8b5303/html5/thumbnails/8.jpg)
Target platforms
=
(c) Rareware
![Page 9: Development of cross-platform mobile game technology](https://reader034.vdocument.in/reader034/viewer/2022051513/547dc33ab379596f2b8b5303/html5/thumbnails/9.jpg)
Target platforms
=
![Page 10: Development of cross-platform mobile game technology](https://reader034.vdocument.in/reader034/viewer/2022051513/547dc33ab379596f2b8b5303/html5/thumbnails/10.jpg)
Target platforms
![Page 11: Development of cross-platform mobile game technology](https://reader034.vdocument.in/reader034/viewer/2022051513/547dc33ab379596f2b8b5303/html5/thumbnails/11.jpg)
Platform independence
● Write as much as possible in a standard/portable language
Obj-C
C++Platform independent code
Platform specific code
iOS Android
JavaJNI
![Page 12: Development of cross-platform mobile game technology](https://reader034.vdocument.in/reader034/viewer/2022051513/547dc33ab379596f2b8b5303/html5/thumbnails/12.jpg)
Platform independence?
● Easy transition to any platform that supports C++
+
![Page 13: Development of cross-platform mobile game technology](https://reader034.vdocument.in/reader034/viewer/2022051513/547dc33ab379596f2b8b5303/html5/thumbnails/13.jpg)
Entity System (the glue and
communication channel)
System
Physics
Renderer (Graphics)
Tools
Input
Game Code
Sound
Resource Management
ThreadsFile I/O
Scene
Architecture Overview
![Page 14: Development of cross-platform mobile game technology](https://reader034.vdocument.in/reader034/viewer/2022051513/547dc33ab379596f2b8b5303/html5/thumbnails/14.jpg)
Engine SubsystemsWalkthrough
![Page 15: Development of cross-platform mobile game technology](https://reader034.vdocument.in/reader034/viewer/2022051513/547dc33ab379596f2b8b5303/html5/thumbnails/15.jpg)
Input
ThreadsFile I/OSystem
● Initialize Subsystems
● Provide a callback that is called each frame
● Provides threads for asynchronous tasks
● Invoke certain device specific actions (e.g.: Post to facebook, show onscreen keyboard, In-App purchases)
● Input: Touch handling, Keystrokes (Android: Back button), Other platforms (Keybaord, Mouse)
● Read and write files (resources, save games)
Main platform dependent part
![Page 16: Development of cross-platform mobile game technology](https://reader034.vdocument.in/reader034/viewer/2022051513/547dc33ab379596f2b8b5303/html5/thumbnails/16.jpg)
Entity System
Scene
Entities (Game Objects)
Collection of components
![Page 17: Development of cross-platform mobile game technology](https://reader034.vdocument.in/reader034/viewer/2022051513/547dc33ab379596f2b8b5303/html5/thumbnails/17.jpg)
Entity System
SceneComponent
Properties
Entities (Game Objects)
![Page 18: Development of cross-platform mobile game technology](https://reader034.vdocument.in/reader034/viewer/2022051513/547dc33ab379596f2b8b5303/html5/thumbnails/18.jpg)
Entity System
● Component properties can be saved to and loaded from storage
● Properties can be read and modified by runtime systems (physics, game code, renderer, etc)
● Fast queries of the type: Return all objects that have a certain component
e.g. render all meshes, rotate all cannons, etc
![Page 19: Development of cross-platform mobile game technology](https://reader034.vdocument.in/reader034/viewer/2022051513/547dc33ab379596f2b8b5303/html5/thumbnails/19.jpg)
Resource Handling
TexturesSound Files
Geometry
![Page 20: Development of cross-platform mobile game technology](https://reader034.vdocument.in/reader034/viewer/2022051513/547dc33ab379596f2b8b5303/html5/thumbnails/20.jpg)
● Decompression is fast compared to reading data from storage
● Extract resources on-demand from ZIP
● Retrieving a resource still takes time, and we need a robust system to handle this latency
Resource Streaming
![Page 21: Development of cross-platform mobile game technology](https://reader034.vdocument.in/reader034/viewer/2022051513/547dc33ab379596f2b8b5303/html5/thumbnails/21.jpg)
Renderer
Time
Draw, Draw
![Page 22: Development of cross-platform mobile game technology](https://reader034.vdocument.in/reader034/viewer/2022051513/547dc33ab379596f2b8b5303/html5/thumbnails/22.jpg)
RendererDraw, Draw
?
![Page 23: Development of cross-platform mobile game technology](https://reader034.vdocument.in/reader034/viewer/2022051513/547dc33ab379596f2b8b5303/html5/thumbnails/23.jpg)
Renderer
Resource Streaming
RequestTexture
Draw, Draw
![Page 24: Development of cross-platform mobile game technology](https://reader034.vdocument.in/reader034/viewer/2022051513/547dc33ab379596f2b8b5303/html5/thumbnails/24.jpg)
Renderer
Resource Streaming
RequestTexture
Continue, ignoring texture until it is loadedDraw, Draw
Time
![Page 25: Development of cross-platform mobile game technology](https://reader034.vdocument.in/reader034/viewer/2022051513/547dc33ab379596f2b8b5303/html5/thumbnails/25.jpg)
Renderer
Resource Streaming
System
RequestTexture
Read from storage *.zip, unpack
Requestdata
Draw, Draw
Time
![Page 26: Development of cross-platform mobile game technology](https://reader034.vdocument.in/reader034/viewer/2022051513/547dc33ab379596f2b8b5303/html5/thumbnails/26.jpg)
Renderer
Resource Streaming
System
RequestTexture
Decode, upload to GPU
Read from storage *.zip, unpack
Requestdata
Draw, Draw
Time
![Page 27: Development of cross-platform mobile game technology](https://reader034.vdocument.in/reader034/viewer/2022051513/547dc33ab379596f2b8b5303/html5/thumbnails/27.jpg)
Renderer
Resource Streaming
System
RequestTexture
Decode, upload to GPU
Read from storage *.zip, unpack
Requestdata
Return Texture Handle
Draw, Draw
Time
![Page 28: Development of cross-platform mobile game technology](https://reader034.vdocument.in/reader034/viewer/2022051513/547dc33ab379596f2b8b5303/html5/thumbnails/28.jpg)
Renderer
Resource Streaming
System
RequestTexture
Decode, upload to GPU
Read from storage *.zip, unpack
Requestdata
Return Texture Handle
Draw with actual texture
Draw, Draw
Time
![Page 29: Development of cross-platform mobile game technology](https://reader034.vdocument.in/reader034/viewer/2022051513/547dc33ab379596f2b8b5303/html5/thumbnails/29.jpg)
Sound
Small files, fit in memoryLarge files, need to be streamedAnd compressed
~40 MB for a file< 0.5 MB for a file
One Shot Background Music
![Page 30: Development of cross-platform mobile game technology](https://reader034.vdocument.in/reader034/viewer/2022051513/547dc33ab379596f2b8b5303/html5/thumbnails/30.jpg)
Audio Compression
?
![Page 31: Development of cross-platform mobile game technology](https://reader034.vdocument.in/reader034/viewer/2022051513/547dc33ab379596f2b8b5303/html5/thumbnails/31.jpg)
Audio Compression
![Page 32: Development of cross-platform mobile game technology](https://reader034.vdocument.in/reader034/viewer/2022051513/547dc33ab379596f2b8b5303/html5/thumbnails/32.jpg)
● 4:1 compression ratio
● decoded in about 100 lines of code
● runs on any platform
Audio Compression
AIFC/IMA4Lightweight solution?
![Page 33: Development of cross-platform mobile game technology](https://reader034.vdocument.in/reader034/viewer/2022051513/547dc33ab379596f2b8b5303/html5/thumbnails/33.jpg)
Sound on Android
● Historically THE weakness of the Android platform
● iOS: OpenAL, established industry standard
![Page 34: Development of cross-platform mobile game technology](https://reader034.vdocument.in/reader034/viewer/2022051513/547dc33ab379596f2b8b5303/html5/thumbnails/34.jpg)
Sound on Android
● Historically THE weakness of the Android platform
● iOS: OpenAL, established industry standard
● Android < 2.3: Java-only API
- Not easy to access from C++
- High latency on some devices
- More problematic than GPU fragmentation
![Page 35: Development of cross-platform mobile game technology](https://reader034.vdocument.in/reader034/viewer/2022051513/547dc33ab379596f2b8b5303/html5/thumbnails/35.jpg)
Sound on Android
● Historically THE weakness of the Android platform
● iOS: OpenAL, established industry standard
● Android < 2.3: Java-only API
- Not easy to access from C++
- High latency on some devices
- More problematic than GPU fragmentation
● Android >= 2.3: OpenSL ES
![Page 36: Development of cross-platform mobile game technology](https://reader034.vdocument.in/reader034/viewer/2022051513/547dc33ab379596f2b8b5303/html5/thumbnails/36.jpg)
GraphicsSpeaking of GPU fragmentation...
![Page 37: Development of cross-platform mobile game technology](https://reader034.vdocument.in/reader034/viewer/2022051513/547dc33ab379596f2b8b5303/html5/thumbnails/37.jpg)
GraphicsSpeaking of GPU fragmentation...
![Page 38: Development of cross-platform mobile game technology](https://reader034.vdocument.in/reader034/viewer/2022051513/547dc33ab379596f2b8b5303/html5/thumbnails/38.jpg)
Graphics
● OpenGL ES 1.1 with fixed function pipeline
(support for early iPhones and some low cost android phones)
● OpenGL ES 2.0 with shader generator & shader cache
(for current and future devices)
Speaking of GPU fragmentation...
![Page 39: Development of cross-platform mobile game technology](https://reader034.vdocument.in/reader034/viewer/2022051513/547dc33ab379596f2b8b5303/html5/thumbnails/39.jpg)
Textures
● Store textures in a native format, to avoid long loading times (NO PNG!)
● Consider using 16 bit formats instead of 32 bit
● Do not use alpha channel if not needed
● Consider using Texture Compression if you can control the artefacts (alpha!)
![Page 40: Development of cross-platform mobile game technology](https://reader034.vdocument.in/reader034/viewer/2022051513/547dc33ab379596f2b8b5303/html5/thumbnails/40.jpg)
Texture Compression
● Many different compression standards
● On iOS there is only one brand of GPU (PowerVR) and all support PVRTC.
● Android: Trouble, at least 3 major different formats, some devices do not support any compression
● If you can avoid it, perfect (we avoided it on Android, but we use PVRTC on iOS)
● Retina/Hi-Res Screens might force you to use some form of compression (2048x2048 Texture = 16 MB!!)
![Page 41: Development of cross-platform mobile game technology](https://reader034.vdocument.in/reader034/viewer/2022051513/547dc33ab379596f2b8b5303/html5/thumbnails/41.jpg)
5 Physics
p
![Page 42: Development of cross-platform mobile game technology](https://reader034.vdocument.in/reader034/viewer/2022051513/547dc33ab379596f2b8b5303/html5/thumbnails/42.jpg)
Physics
● 2D physics
● Sequential Impulse approach for collision response
● For everyone interested – check out the GDC 2009 slides by Erin Catto (Box2D) they should get you started.
● Custom solution – very simple, but I wanted to get to the bottom of it
![Page 43: Development of cross-platform mobile game technology](https://reader034.vdocument.in/reader034/viewer/2022051513/547dc33ab379596f2b8b5303/html5/thumbnails/43.jpg)
Lessons learned
● It works! (→ Captain Clumsy)
● Platform abstraction is worth the effort
● Custom technology is feasible, even fora small team
● Technology can be reused for next games
● Spend more time on tools
![Page 44: Development of cross-platform mobile game technology](https://reader034.vdocument.in/reader034/viewer/2022051513/547dc33ab379596f2b8b5303/html5/thumbnails/44.jpg)
Get in touch
● Email me at: [email protected]
● Twitter: lhyanor
● Cute Attack Website: cuteattack.com
Thank you for your attention :)