210 likes | 346 Views
Michael Birsak and Michael Hanzl. Institute of Computer Graphics and Algorithms Vienna University of Technology. Outline. Motivation Related work Game description Implementation Performance Demo Future Work Conclusions. Motivation. Develop and release a 3D game Google Android
E N D
Michael Birsak and Michael Hanzl Institute of Computer Graphics and Algorithms Vienna University of Technology
Outline • Motivation • Relatedwork • Game description • Implementation • Performance • Demo • Future Work • Conclusions M. Birsak, M. Hanzl
Motivation • Developandrelease a 3D game • Google Android • OpenGL ES • Experiment withAndroid • NOT a computergraphicsdemo!!! M. Birsak, M. Hanzl
Related Work • Many 2D games (tiles) • Basicallyno 3D game in Spring 2009 • Now: Some 3D gamesavailable • Android Knight (3D Chessgame) • Games fromOmniGSoft: • Super-G Stunt • Snow Rally City Stage • … M. Birsak, M. Hanzl
Idea • Space Taxi forCommodore 64 (1984) • Space Taxi 2 (2004) • Someinofficialversions M. Birsak, M. Hanzl
Game Overview • 3D, but discreteheightlevels • 7 levels + 7 bonuslevels • 3 lives & power • Transport passengers in 3 minutes • Score • Highscore M. Birsak, M. Hanzl
Game Objects • Transporter • Passenger • Terrorist • Asteroid • Geyser Bullet • Packet • Banana M. Birsak, M. Hanzl
Controlling • Devices have different inputunits • Accelerometer • Calibration • Howtoascendordescend? • Slider • Height depends on thevelocity M. Birsak, M. Hanzl
ImplementationOverview • CollisionDetection • View FrustumCulling • Modelloader (obj) • LOD • Effects • Random levelgeneration • Ownmodels & images & sounds • Settings • Local & Online Highscore M. Birsak, M. Hanzl
Highscore Features Online Highscore LocalHighscore Compareyourownresults Delete all entries • Competeagainstotherusers • Onlyoneentry per user • Registration required • Searchforyourownresult • View highscore on yourAndroiddevice • Detailedoverviewofthehighscoreentries • Overviewofyourresult after insert • Correcthandlingof time zones • Correcthandlingofties M. Birsak, M. Hanzl
HighscoreImplementation • LocalHighscore • SQLite • Online Highscore • Insert / Login / Register: HTTP Post (HTTPS!) • Retrieve Data: HTTP / XML • Web-Server: PHP / MySQL Client Server HTTP Post Response Androiddevice Webserver M. Birsak, M. Hanzl
Highscore Security • Avoid SQL-Injections • Check andconstraintheuserinput • PHP escapefunction • Password → SHA-512 Hash • Secure connection (HTTPS) • Check thehighscore • Special „password“ • Check constraints:s-pt:22-pt:48-pt:17-pt:10-le:1-ti:28-b-b-le:1001-pk-pp-d-d-d M. Birsak, M. Hanzl
Lifecycle • Activitiescouldbeinterrupted • Activity not killed • Activitykilled • Screen orientationchange • Lessmemory • Save / restorestate • Do not block themainthread! • Avoidinjuries!!! M. Birsak, M. Hanzl
Performance Issues • Geometry • Rasterizer • Creatingobjects expensive • GarbageCollector (~100 - 300ms) • ObjectOriented Design • Functioncalls: local, via interface, JNI • Loadingandparsing ASCII filesisslow M. Birsak, M. Hanzl
Performance Solution • Reuse yourobjects→ Object Pool • Try toavoidgarbage • Concatenated Strings / Java built-in methods! • InvokeGarbageCollectormanually • Decreasethenumberofpolygonsto render • Usethedraw_textureextension • Use Java ObjectSerializationfor model loading • Write codethatis fast Reference: Chris Pruett: Writing Real Time Games ForAndroid, Google IO 09, May 2009 M. Birsak, M. Hanzl
Performance • G1: 20 - 30 FPS • Emulator: 10 - 20 FPS (Dual Core 2x3Ghz) • Models: 18 - 508 / 372 triangles M. Birsak, M. Hanzl
Demo M. Birsak, M. Hanzl
Skills andBenefits • Controlling thegameis not easy! • Measuringdistances • Spatialimagination • Find strategiesveryquickly • Balance betweenspeedand score • Trust in luck • Work under stress M. Birsak, M. Hanzl
Future work • Save thegame • Highscoresearch • Objects • Planets / suns • Spaceships (enemies) • Effects • LensFlare M. Birsak, M. Hanzl
Conclusions: Android • Permanent furtherdevelopment • License: „Free“ • Easy towriteapplications, but… • Great tools, examples, community, guidelines • OpenGL ES support not perfect • Different hardware(currently ~11 smartphones) • Different displayresolutions • Different inputunits • Performance • Emulator ǂ Real Device M. Birsak, M. Hanzl
The END • Thankyouforyourattention • Special thanksto Peter Rautek & theinstitute • Are thereanyquestions? M. Birsak, M. Hanzl