Android game engine


Published on

This is my slides of COSCUP 2010 at Taipei, Taiwan.

Published in: Technology, Design

Android game engine

  1. 1. Connect your device to application
  3. 3. Agenda We Love Game Why need Game Engine What is Game Engine How many Game Engine Get one for You Implementation
  4. 4. We Love Game
  5. 5. Do You Love Playing Game? I DO
  6. 6. Everybody Love Playing GameMy Father playsSolitaireMy Sister playsLabyrinthMy Colleague playsAngryBirdI play Dracula X, Super Mario III,Final Fantasy III, Tetris, FrozenBubbles, ZooKeeper, Dragon Ball Z2Z3, DDR...blah blah
  7. 7. Why Do We Love a GameArt It looks awesomeStory It is realisticSocial We may make friends via game By exchanging information By sharing common experienceFun The most important part of a game
  9. 9. Playing Game EverywhereFCMD, SFCSS, PS.......NOW ? Long time ago we use GameBoy in toilet. Now we use mobile phone.
  10. 10. Why need Game Engine
  11. 11. Create a GameEveryone has creativityWe might want to clone a existinggameWe have a good idea for gameWriting Game is COOL, and Weare COOL!!
  12. 12. Game Engine helps usFaster DevelopementEasier Developement You might dont know OpenGL...Abstract Layer You might need to port your game to another platform....Focus on FUN If you spend more time on fighting with code, you has less time to think about your game, especially most of us are independent programmer.
  13. 13. What is Game Engine
  14. 14. Game Engine might hasSprite, Scene, Animation RendererModifier Physics EngineParticle System Collision DetectionEvent Handling Script LanguageGame Thread
  15. 15. Normal Android applicationAn Activity contains some Views. We interactive with some activities
  16. 16. In a GameAn Activity holds one GLSurfaceView.Game Engine switch one of scenes to display
  17. 17. Sprite
  18. 18. Collision Detection
  19. 19. How many Game Engine on Android
  20. 20. Lots of Game EnginesIf you search "android game" at AgeGoogle Code, you will see lots Angleof game engines. CandroidengineSome of them are Graphics CatcakeEngine Cloak Cocos2d Forget3d JMonkeyEngine ReplicaIsland Rokon AndEngine .........more
  21. 21. Target There are too many good game engines, I can only choose some of them. Rokon Cocos2D AndEngineImportant: I believe there should be some great game engine but I missed
  22. 22. RokonRokon 2.0.3 staffs Sprite, Modifier, Audio, Sprite Animation, Polygon Collision...blah You can see Particle System at Rokon 1, but nothing about Particle System at Rokon2 yet.
  23. 23. Rokon
  24. 24. Rokonimages borrows from Replica Island
  25. 25. RokonLayer accepts GameObject.You can extends GameObject andcreate your own class then add to Layer
  26. 26. Rokon (touchable sprite)TextureAtlas atlas = new TextureAtlas();Texture textureDoll = new Texture("doll.png");Sprite mDoll;mDoll = new Sprite(X, Y, Width, Height);mDoll.setTexture(textureDoll);mDoll.setTouchable();add(0, mDoll);@Overridepublic void onTouchDown(Drawable object, float x, float y, MotionEvent event, int pointerCount, int pointerId) { if (object == mDoll) { android.util.Log.i("Hi", "touch down doll"); }}
  27. 27. Rokon (Audio)/* Longer audio file */"audio/music.mp3", true); //true means loop/* Shorter sound effects */RokonAudio mAudio = new RokonAudio();SoundFile mSound = mAudio.createSoundFile(sMenuTap);;
  28. 28. Rokon(Animation)Sprite explosion = new Sprite(x, y, width, height); 1Texture texture = new Texture("explosion.png", 5, 5)explosion.setTextureTile(texture, 25); // 25 is the lastest one/* tile 1 to tile 25, one frame spends 35ms, repeat once */explosion.animate(1, 25, 35, 1, false); 25
  29. 29. Rokon(Physical)
  30. 30. Cocos2DPython Cocos2d→ iPhone Cocos2d→ Android Cocos2d cocos2d matches version 0.8 ofcocos2d for iPhone 0.9 is still in development
  31. 31. Cocos2D
  32. 32. Cocos2DCocosNode accepts ActionMost classes extends CocosNode Sprite Label Scene Action rotate = RotateBy.action(2, 360); Sprite sprite = Sprite.sprite("ball.png"); Layer sprite.runAction(rotate); ColorLayer Menu MenuItem
  33. 33. Cocos2D1. addChild: every CocosNode may has child CocosNode2. action: every CocosNode may has Action
  34. 34. Cocos2DCocosNode.runAction(action);
  35. 35. Cocos2DCocosNode + Action
  36. 36. Cocos2D(Physical)
  37. 37. Cocos2DSome problemsParticle System ExampleSceneTest ExampleTransition Example Particle System
  38. 38. AndEngineFast Development Box2d Multiplayer MultiTouch ......etcAmazing examples You can download the example at Market.
  39. 39. AndEngine
  40. 40. AndEngine(Camera) See Example TMXTiledMapExamplesetChaseShape(IShape);
  41. 41. AndEngine
  42. 42. AndEngineTouch and Multi Touch Custom Font
  43. 43. AndEngine
  44. 44. AndEngineParticle System
  45. 45. Replica IslandWell designed gameOpen Source It is very possible to split engine from the game TimeGamesAndroid.html (it is worth reading)Mailing list community/topics Highly activity!!
  46. 46. Compare Rokon2 Cocos2d AndEngine FPS (one sprite) 52(*1) 60(*2) 58(*3) FPS (50 physics) 46(*4) 18(*5) 60(*6) FPS (100 physics) 42 8 36 Physics Engine box2d box2d box2d Particle System No ? Yes License BSD BSD LGPL Examples ?(*7) Yes(*8) Yes(*9) Aug Lastesd Update Aug 8 Jun 26 14(ouch!!) Tetronimo(*10) Snake(*12) Game Implement Drop Block(*11) AlienStars(*13)Tested on Nexus One, Froyo (FRF91)
  47. 47. Ref1. examples were written for Rokon 1.1.18.
  48. 48. Game Implementation Nobunagas Puke信長的噁望 Implemented in cocos2d-android and Rokon2 From scratch in 3 days
  49. 49. Q&A
  50. 50. Sponsoredby 15 Aug 2010CC-By-SA COSCUP
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.