vietnam mobile day 2012 multi platform development - game loft
DESCRIPTION
TRANSCRIPT
Who am I
Nguyen Huy Dung, Team Leader at Gameloft HAN studio
Love to exchange knowledge and passion. Had several seminars and trainings in Hanoi-Aptech, GameLoft, Universities.
Agenda
Gameloft IntroductionGameloft’s approach to Multi-
Platform developmentTips, tricks and examplesQuestions and Answers
Gameloft: Leading developer and publisher
Founded in 1999, to develop from mobiles & smart phones
to cross-platform digital distribution
MobileConsole
Iphone, Ipod, Ipad
Android
Gameloft: Leading developer and publisher
Presence in over 80 countries
Agreements with over 200 carriers
~400,000 games sold per day
Gameloft: Leading developer and publisher
5125 talented people
Production studios in 12 countries
New York, San Francisco, Seattle,
Montreal, Mexico, Buenos Aires, Paris,
London, Cologne, Milan, Madrid,
Copenhagen, Warsaw, New Delhi, Seoul,
Beijing, Hong Kong, Tokyo, Sydney...
The BIGGEST Gameloft Studio WorldwideMore than 1000 talented staff
Gameloft Vietnam is The BIGGEST Gameloft Studio Worldwide
More than 1700 talented staff
SAI 1e-Town 2 Building - 7Fl., 364 Cong Hoa, Tan Binh Dist., HCMC
SAI 218A Cong Hoa, Tan Binh Dist., HCMCSince Aug-2008
DAD74 Bach Dang, Hai Chau Dist., Danang CitySince Mar-2010
HAN3rd&4th floor – Lilama 10Le Van Luong, HanoiSince June-2011
Gameloft keeps on growing fast in Vietnam
Multi-platform developmentGameloft’s approach to
Our games are running on
iOSAndroidPS3Windows Phone 7badaWebOSJava embed….
Our games are running on
iOSAndroidPS3Windows Phone 7badaWebOSJava embed…
How could we accomplished that?
How could we accomplished that?Different codebases for each platform?
Different codebases for each platform?Yes.
Different codebases for each platform?Yes. And No
Android Game
Platform-
specific UI
Platform-
specific Feature
s
Platform API
Wrapper
iOS Game
Platform-
specific UI
Platform-
specific Feature
s
Platform API
Wrapper
Windows Game
Windows Game
Built with C++, contains almost everything:UI Design
Game-LogicGame Rendering
SoundMultiplayer
…
Windows Game
Platform API
Wrapper
Platform API
Wrapper
•Android NDK•Java wrapper: Activity, View, Intent, Receiver
•C++ auto-compat•UIWindow, UIViewController, UIView, UIApplicationDelegate
Android Game iOS Game
Windows Game
Platform-
specific Feature
s
Platform API
Wrapper
Platform-
specific Feature
s
Platform API
Wrapper
•Advertising•In-App Billing•Beam
•iAd•In-App Purchase•Music Player
Android Game iOS Game
Windows Game
Platform-
specific Feature
s
Platform API
Wrapper
Platform-
specific Feature
s
Platform API
Wrapper
•Push Notification toggle•Kindle Fire Volume•Color Correction
•iOS is normally the role-model
Platform-
specific UI
Platform-
specific UI
Android Game iOS Game
Android Game
Platform-
specific UI
Platform-
specific Feature
s
Platform API
Wrapper
iOS Game
Platform-
specific UI
Platform-
specific Feature
s
Platform API
Wrapper
Windows Game
PORTING
Advantages of Porting
Big common code base: less bugs, less maintainance effort, less human resource
Only the things that really platform-specific are needed to be separated
How?
We built:Our own 3D engines and libraries
(Networking, Sound, UI, Debugger…) which already support multi-platform
Online System to centralize the services: User profiles, Billing, Data downloading, Multi player….
Core Packages for general features in each platform
plan ahead, not fix laterMulti-platform support
Tips and tricks
Try to build your game without a real device first
Graphics: Use OpenGL ES 2.0Don’t hard-code. Do things explicitly.
Have separated Configuration files. Prepare your data wiselyPreprocessing is not only for C++Keep an abstract macros/classes/library
of code that using platform-specific API or behave differently on each platform
Examples – Defines/Configuration#ifdef OS_ANDROID
#define KEYCODE_BACK (4)#define KEYCODE_UP (19)#define KEYCODE_DOWN (20)#define KEYCODE_LEFT (21)#define KEYCODE_RIGHT (22)
#elif defined(WIN32) #define KEYCODE_BACK (27)
#define KEYCODE_UP (38)#define KEYCODE_DOWN (40)#define KEYCODE_LEFT (37)#define KEYCODE_RIGHT (39)
#endif
Examples – simple macro#define PLATFORM_WIN32 1#define PLATFORM_ANDROID 2#define CONFIG_PLATFORM PLATFORM_WIN32#if CONFIG_PLATFORM==PLATFORM_ANDROID#include <android/log.h>#define Log(...) __android_log_print(ANDROID_LOG_INFO, “GLGame",__VA_ARGS__)
#elif CONFIG_PLATFORM==PLATFORM_WIN32#define Log(...) printf(__VA_ARGS__);printf("\n")
#else#define Log(...)
#endif
Examples – Abstract Libraryclass TouchScreenBase { ... }class TouchScreenMobile : public TouchScreenBase { ... }class TouchScreenWin32 : public TouchScreenBase{ ... }#ifdef OS_ANDROIDtypedef TouchScreen TouchScreenMobile
#elif defined(WIN32)typedef TouchScreen TouchScreenWin32
#endif
//Usage: Just use TouchScreen Class
Examples – Abstract Library (2)class TouchScreenBase { ... }class TouchScreenMobile : public TouchScreenBase { ... }class TouchScreenWin32 : public TouchScreenBase{ ... }
//Usage: Cast to TouchScreenBase Class#ifdef OS_ANDROID TouchScreenBase* TS = new TouchScreenMobile()
#elif defined(WIN32) TouchScreenBase* TS = new TouchScreenWin32()
#endif
plan ahead, not fix laterMulti-platform support
Questions and AnswersThanks for your attention! Contact me: [email protected]