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