Extending Cocos2D-xMobile 2D Framework
Rony XuHappy Elements
Agenda
Why
Overall Framework Design
Q&A guide
Why we use Cocos2Dx?
Techniques We Used
Cocos2d-iphone
HTML5
Adobe Air Porting
Cocos2Dx
Conora
Unity
Cross-platform
Controllability
Performance
Why scripting?
Multi-version
IOS/some Android mkts can’t incremental update
Big pack with all resolution, wasting bandwidth and
storage.
Update issues
Google Play : 2
hours
IOS : 5 days
Update CycleUpdate Cycle
Different Develop & Debugging tools
Context broken
Difficulties on device debugging
Debug Issues
1. Need script for compile, deploy & debug2. NDK in Eclipse is very difficult to debug
Need to use MAC for compile, deploy &
debug
IOSIOS
AndroidAndroid
50% of the debugging time is dealing with
crash
Easy Crash : using Auto-Release Pool
Easy to Lose Context/Stack, especially in
optimized mode
Crash
Quality standard5% crash rate over
5000 minutes testing
sessions
Why we choose Lua?
Easy, Controllable
Lightweight
Most games in China market is written
with cocos2dx+lua
Solutions
What have we done?
Android : Java Lua
IOS: OC Lua
LuaJit replace Lua 5.1
3rd party Lib API
IDE & Debugger
UI Editor
Animation Editor
TTF Font export tools
Tools
COCOS2D-X
Develop Tools
Mem Disambiguation
Mem Disambiguation
Localization
Localization
UtilitiesUtilities NetworkNetwork
Resource Management
Resource Management
CrashCrash
Render
Render
Script EngineScript Engine
Third party Integration
AccountAccount SNS Integration
SNS Integration
PaymentPayment NotificationNotification
Data Analytics
Data Analytics
Ad/x-promAd/x-prom
Log TrackerLog Tracker CI ServiceCI Service
IDEIDE
Automated Build ScriptsAutomated Build Scripts
Debugger
Debugger
PackagingToolsPackagingToolsLoggerLogger
Engine
Lua scripting runtimeLua scripting runtime
toLua++toLua++
Cocos2dx/Cocos2dx/Common LibCommon Lib iOS native apiiOS native api
LuaJavaLuaJava
iOS 3rd party iOS 3rd party APIAPI
Android 3rd Android 3rd party APIparty API
Android Android native APInative API
Interface w/ languages
WaxWax
- Base on Zerobrane
- Enhance 120x debugging performance
- Locating files & symbols
- Push to device
- Improve context helper
Lua debugger
StubStub
DebuggerDebugger
iOS stubiOS stubiOS stubiOS stub
Android Android stubstub
Android Android stubstub
Windows Windows stubstub
Windows Windows stubstub
File List & MD5
Connect Debugger
Connection Success
Log & Breakpoint
Changed File
File Push
Close connection
Send Instruction
File Deploy Process Debug Process
Push to device
• Complete the Update transaction
• Increment update
• Download on Demonds
• Modules
• Resolutions
• Resources Encryption
• APK Update (China Android Markets)
Resource Manager – Design Purpose
APK/App Directory
Resource Manager - Design
Current Current Resource Resource LocatorLocator
Resource Resource Locator Locator versionversion
Content with md5 name
Old Resource Old Resource LocatorLocator
Document Directory
Content with md5 name
Content with md5 name
ClientClient CDNCDN
Dynamic Dynamic ServerServer
Get the latest configuration
Download configuration
Download ResourcesCheck if the current
configuration up-to-date
Check the missing resource
Incremental update
ClientClient
CDNCDNGameGameGameGame
Res Res MgrMgrRes Res MgrMgr
Ensure Modules
Local cache ?
Download Resource
Callback Result
Download on Demand
Load Resource
Crash analyze system
PLCrash PLCrash reporterreporterPLCrash PLCrash reporterreporter
GoogleGooglebreakpadbreakpadGoogleGoogle
breakpadbreakpad Crash Crash AnalysisAnalysisCenterCenter
Crash Crash AnalysisAnalysisCenterCenter
Log trackerLog trackerLog trackerLog tracker
Game
Crash folder
Crash Sent Crash Sent TaskTask
Crash Sent Crash Sent TaskTask
Developer
SymbolSymbolCenterCenterSymbolSymbolCenterCenter
Build
- Hudson
- Download & install on mobile
- Update notice, auto-download update package
- Crash/ Log collect & analyze
- Session time analyze
- CDN check
- Udid management
- Oneclick submit to App store & Google Play (future)
Build/CI
Build/CI
Build.shBuild.sh
symbolssymbols
HudsonHudson
apk/ipa/png
apk/ipa/png
resources
resources
Adhoc.mobileprovisionAdhoc.mobileprovision
SvnSvn
build_versionbuild_version
Project.plistProject.plist
SafariSafariMobile BrowserMobile
Browser
Udid CheckUdid Check Resource Manager
CDN
Resource Manager
CDN
CrashAnalysisCrash
Analysis
Latest VersionLatest
Version
Client Manager
Client Manager
Dragon Bones
■ Flash CS5.5+Plugin
■ UI Editor
■ Animation Editor
Font editor
■ BMP Font
■ TTF
Tools
Particle designer
Glyph designer
Third Party Tools
Thanks! OpenSource Community
Cocos2dxhttps://github.com/cocos2d/cocos2d-x
LuaJavahttp://www.keplerproject.org/luajava/
Waxhttps://github.com/probablycorey/wax
ZeroBrane
https://github.com/pkulchenko/ZeroBraneStudio
Mobdebug https://github.com/pkulchenko/MobDebug
DragonBones
http://dragonbones.github.com
Thanks! OpenSource Community