Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Facebook flash api and social game development

5,069 views

Published on

Published in: Technology
  • Be the first to comment

Facebook flash api and social game development

  1. 1. Facebook Flash APIand Social Game Development<br />http://fb.me/tempofeng<br />
  2. 2. Agenda<br />Gamelet<br />Our Experiences<br />Tips & Tricks<br />Flash<br />Social<br />Facebook / Flash<br />Q & A<br />
  3. 3. Gamelet: Our Experiences<br />
  4. 4. Gamelet<br />
  5. 5. Web Traffics<br />
  6. 6. Gamelet<br />Published 17 Games<br />15 Real-Time Synchronized Games<br />2 Social Games<br />11 Employees<br />6 Engineers<br />3 Arts<br />
  7. 7. Gamelet<br />Bandwidth<br />60M/Month<br />Online Users<br />8000 users (max)<br />Aggregated MAU<br />400K (down from 800k)<br />
  8. 8. Servers<br />Web Servers<br />apache -> tomcat<br />2xDell PE R610 (1 Master-N Slave)<br />2xI5520, 6GB, SAS HDs<br />Static Files Servers<br />1xPC<br />Real-time Socket Servers<br />Java/Mina/ActiveMQ<br />3xDell PE R610<br />1xI5520, 6GB, SAS HDs<br />
  9. 9. Servers<br />DB Servers<br />MySQL<br />2xDell PE R710 (1Master, 1Standby)<br />2xI5530, 32GB, SAS HDs<br />Cassandra<br />2xDell PE R710<br />2xI5530, 32GB, SAS HDs<br />
  10. 10. Tip & Tricks - Flash<br />Development Environment<br />Art/Developers Workflow<br />Performance<br />Fighting Cheaters<br />Loader<br />crossdomain.xml<br />
  11. 11. Development Environment<br />Developers<br />Flash(Flex) Builder<br />Flex Components<br />Slow<br />Ram/CPU/SSD<br />Open Too Many Projects<br />Arts<br />Illustrator/Photoshop/Flash<br />
  12. 12. Arts/Developers Workflow<br />.as<br />Designers<br />Programmers<br />
  13. 13. Versioning Graphics Assets<br />Confusing!<br />SVN<br />Development Mode<br />car.fla, airplane.fla<br />Production Mode<br />car.fla, airplane.fla -> vehicle_v00.swf<br />
  14. 14. Performance<br />Monitoring Framerate<br />Don’t<br />Alpha, 變形工具<br />Large Bitmap<br />Parent/child Movieclip<br />Using<br />Sprite instead of Movieclip<br />
  15. 15. Performance<br />Slow Movieclip<br />cacheAsBitmap<br />Rotate, Scale, …<br />AnimationSlicer<br />http://blog.vandenoostende.com/2008/animationslicer/<br />Profiler<br />Memory Leak<br />
  16. 16. Fighting Cheaters<br />Manipulating Memory<br />Intercepting Packets<br />Accelerators<br />Double Login<br />Manipulating Code<br />Building a Bot<br />Fake Accounts<br />
  17. 17. Manipulating Memory<br />
  18. 18. Manipulating Memory<br />Cheat Engine<br />http://www.cheatengine.org/<br />Encode Critical Data<br />Heap Data<br />Scores, Weapon, …<br />
  19. 19. Manipulating Memory<br />class SecureInteger<br />{<br />int number;<br />int checksum;<br /> public void setNumber(int number)<br /> {<br />this.number = number;<br />this.checksum = md5(number);<br /> }<br /> public intgetNumber()<br /> {<br /> if(verifyMd5(number, checksum))<br /> return number;<br /> else<br /> throw new SecurityException();<br /> }<br />}<br />
  20. 20. Intercepting Packets<br />Add Signature<br />Encode<br />SSH<br />proprietary PKI solution<br />
  21. 21. Accelerators<br />變速精靈<br />http://tw.vrbrothers.com/speeder/<br />
  22. 22. Accelerators<br />Use Server Time Everywhere<br />Detecting<br />Calculate the difference between client time & server time<br />Network latency will be hard to predict<br />
  23. 23. Double Login<br />Logout Previous Logined User<br />Flash LocalConnect<br />Server Notification<br />
  24. 24. Manipulating Code<br />Obfuscator<br />Dynamically Download Encoded SWF<br />Loader.loadBytes(bytes)<br />
  25. 25. Building a Bot<br />Monitoring<br />Monitoring All Service Interfaces<br />AOP, Annotation<br />Limiting resource update<br />Limit by Time Period<br />Limit by User Roles, Levels<br />Guests, Unregistered Users<br />
  26. 26. Fake Accounts<br />Limit Help from Friends<br />
  27. 27. Loader<br />Loading Static Files<br />Always Retry!<br />
  28. 28. crossdomain.xml<br />crossdomain.xml<br />Access Remote Files<br />Security.allowDomain()<br />SWFs from Other Domain to Access Me<br />loader.loaderContext = new LoaderContext(true, ApplicationDomain.currentDomain)<br />Access Remote Image Files without crossdomain.xml<br />
  29. 29. Tips & Tricks – Social Games<br />Game Design<br />Viral Channels<br />Data Storage<br />
  30. 30. Game Design<br />Beautiful!<br />Gifting is the New Poke<br />Don’t Punish Users<br />Represent Relations between Friends<br />
  31. 31. Viral Channels<br />monfriends<br />
  32. 32. Data Storage<br />Read:Write = 1:1<br />MySQL<br />Transactional<br />Data Growing Slowly<br />Cassandra<br />Key/Value<br />Data Growing Fast<br />
  33. 33. Tips & Tricks – Facebook / Flash<br />Facebook API / Graph API<br />Chinese Input<br />Invite/Request without Page Reloaded<br />
  34. 34. Facebook API & Graph API<br />No Plan of Updating<br />Recommend<br />Calling Javascript API from Flash ExternalInterface<br /><ul><li>if (!ExternalInterface.available)
  35. 35. {
  36. 36. return;
  37. 37. }
  38. 38. ExternalInterface.call("lumixInviteFriends", invite, title, type, content, url, label, condensed, toUid(username));</li></li></ul><li>wmode = ‘opaque’<br />
  39. 39. wmode = ‘window’<br />
  40. 40. Chinese Input<br />Flash 9/10<br />Only wmode = ‘window’ Can Input Chinese<br />Will Hide javascript Windows<br />Flash 10.1<br />wmode = ‘opaque’ can input Chinese in IE/Firefox<br />
  41. 41. Flash 9,10 + wmode = ‘window’<br />Move or Hide the Flash<br />
  42. 42. Invite/Request without Page Reloaded<br />
  43. 43. Step 1: Dynamically Add an <iframe><br /><ul><li><iframe id='inviteFriendsIframe' name='inviteFriendsIframe' src='inviteFriendsIframe.do' scrolling='no' frameborder='0' width='760' height='800'></iframe></li></li></ul><li>Step 2: <fb:request-form> in <iframe><br /><fb:serverFbml><br /><fb:request-form action="closeFbmlIframe.do" invite="" type="" …><br />…<br /></fb:request-form><br /></fb:serverFbml><br />
  44. 44. Step 3: Close the <iframe> by Javascript<br /><script type="text/javascript"><br />$(document).ready(function()<br />{<br />window.parent.onFbmlIframeClosed();<br />});<br /></script><br />
  45. 45. Thanks<br />
  46. 46. http://apps.facebook.com/pizzaworld_tw/Pizza 世界<br />

×