Mobile World Yes, it is a Mobile World Yes, it is a Mobile World This photo was NOT photo‐shopped. It is an actual images of old recycled 90’s devices.
CLAM “CHOW‐DAHH” 1. CLAM CHOW‐DAHH 1. CLAM CHOW‐DAHH 2. DOOR‐CHEST‐AHHH 2. DOOR‐CHEST‐AHHH 3. P‐ahh‐k the K‐ahh on the T‐ahh 3. P‐ahh‐k the K‐ahh on the T‐ahh
The Art and Zen of Mobile Game Creation with Flash Game Creation with Flash Game Creation with Flash Scott Janousek, Technical Director Scott Janousek, Technical Director www.hookenmobile.com fitc2007@hookenmobile com [email protected]
F B t M h tt USA – From Boston, Massachusetts, USA – Working with desktop Flash for six years – Designer & Developer Designer & Developer – 3+ year old blog (time for a new one!) MOBILE MOBILE – Working with Flash Lite 1.1 and 2.x – Flash Lite 1.1/2.x Training Instructor – Coauthor: “Foundation Flash Applications for Mobile Devices” – Mobile Gaming Enthusiast – ™
Games Portfolio • Flash Lite 1 1 and 2 x Flash Lite 1.1 and 2.x • Distribution: Working directly with 3rd party mobile game companies – Working directly with 3rd party mobile game companies – Flash Lite Exchange • More products in 2007 • More products in 2007 – Don’t Wake the Dragon, MORE! Symbian Series 60 content iRiver Clix game viliv p1 Sudoku game
“Worldwide revenue for mobile gaming Worldwide revenue for mobile gaming subscriptions could increase from $3 billion to $10.5 billion in 2009 “– Juniper Research Ltd Ltd.
Game Markets “Power” “Casual” – Power Gamers – High Learning Curve – Fun, Addictive – No learning curve – More Expensive – Guilt in not finishing – Inexpensive – No guilt – More time investment – Less time investment
Game Genres • Arcade/Action Snake Bomber Alien • Multiplayer Mario Kart Texas Hold’em – Snake, Bomber, Alien Invasion … • Role playing games (RPG) – Mario Kart, Texas Hold em • 2‐D, 3‐D Racers – Tron, Mario Kart – Final Fantasy, etc. • Sports Tron, Mario Kart • Card and board games – Slots, Blackjack, Monopoly – EA SPORTS™ Madden 07 • Skill, Strategy, Logic Mi S S d k • First Person Shooters – Quake, Doom … – Mine Sweeper, Sudoku Above: these just happen to be Flash Lite games that fit some of the genres …
“Casual Games make most use of the inherent advantages of the mobile platform. People want to fill ‘dead time’ with easy to use, but fun games” – Bruce Gibson Research Director with Juniper Research fun games Bruce Gibson, Research Director with Juniper Research.
W.O.R.A. Holy Grail W.O.R.A. • Write Once Run Anywhere • Nice idea for mobile, but … – Lots of devices different capabilities implementations etc Lots of devices, different capabilities, implementations, etc • Fragmentation is “fact of life” N ti J2ME t – Native, J2ME, etc – Flash Lite is NOT immune, but much LESS affected Handsets Handsets PDAs PDAs “Consumer Electronics” “Consumer Electronics”
DESIGN GAME DESIGN GAME DESIGN GAME DESIGN GAME DEVELOP GAME DEVELOP GAME DEVELOP GAME DEVELOP GAME Idea/Concept DEVELOP GAME DEVELOP GAME DEVELOP GAME DEVELOP GAME TEST GAME TEST GAME TEST GAME TEST GAME Other platforms … Symbian Series 60 DEPLOY DEPLOY DEPLOY DEPLOY DISTRIBUTION DISTRIBUTION DISTRIBUTION DISTRIBUTION DEPLOY DEPLOY OTHER OTHER PLATFORMS PLATFORMS O t A t p f y PLATFORMS PLATFORMS Operators, Aggregators & Content Providers .sis packaging
Game Development with Flash Development with Flash Development with Flash “The Flash Lite Platform offers one of the best environments for rapid mobile game development for casual type content for rapid mobile game development for casual type content found today.” ‐ Me
Flash Lite 1.1 Syntax Refresher Flash Lite 1.1 Syntax Refresher • tellTarget() – tellTarget( /player_mc/ ) { /:x =+ 1; } –movie clips can act as libraries (“function clips”) p ( p ) • eval() Si l t P d A i i bl d l –Simulate Pseudo Arrays using variables and eval – x1 = 23; eval( “x” add i ); • Game state Frame Labels(menu, gameplay, etc) • More ... More ... –My Flash Lite 1.1 “Reference Sheet” (PDF)
Keys/Text Input • Target devices often vary g f y • Keys: 0,1,2,3,4,5,6,7,8, #, * • Soft Keys y – Typically LEFT, RIGHT – FL 2.x supports multiple softkeys softkeys • Text Input – FL 1.1 uses device for input uses de ce o put – FL 2.x built in text input (T9) • 5 Way Direction Joystick – UP, DOWN, LEFT, RIGHT, SELECT
Casual Games ne Button Casual Games • Focus i t l d hi 5 Min Sample – user input, game play and graphics • Should be very responsive S th A i ti – Smooth Animations – Immediate Actions • Game Challenge • Game Challenge – Better to have many stages/levels – Timing + Rhythm + Reaction = GAME EXPERIENCE Timing Rhythm Reaction GAME EXPERIENCE • Key Lag – Between device platforms Between device platforms – Tweak timing calculations (if needed)
1.1 FLASH LITE 2.x FLASH LITE 1.1 • Flash 4 syntax hitT t() FLASH LITE 2.x • ActionScript 2.0 ! hitT t() il bl • hitTest() • Like Math? Ch 6 i b k • hitTest() available • More complexity possible l i 6 • Chapter 6 in our book • … also in 6 EXAMPLE EXAMPLE EXAMPLE EXAMPLE
Flash Lite 2.x games y g – i.e. Character movement, etc. enemy_mc.onEnterFrame = move; player_mc.onEnterFrame = function() { //‐‐ do xyz } • Performance – Remember call is executed X times per FPS – LIMIT multiple onEnterFrames() p () • Use only for more robust target devices I l h Li 1 1 “f l i ” • In Flash Lite 1.1 = “frame looping”
no more than 500 KB for SWF • Some carriers restrict file size (KB) • Available Bandwidth • Available Bandwidth – GPRS, 2/2.5G, 3G, others … • OTA content delivery – Sometimes user pays per kB download • Decompression – FL 2 x SWF decompresses incurring penalty – FL 2.x SWF decompresses incurring penalty – Images, Sounds must decompress
Game Text Device Fonts Pixel Fonts • Preinstalled device fonts • Results in smaller file size • Hundreds available • Larger file size • Position anywhere on x, y doesn’t matter N t i t t l k & f l • Position on x, y integer values – i.e. x=0.0, y=0.0 C i t t l k & f l • Not consistent look & feel • No anti‐aliasing • Point Size Restrictions • Consistent look & feel • No anti‐aliasing • Use various point sizes Point Size Restrictions Use various point sizes Device fonts save space Use pixel fonts for look/feel Device fonts save space Device fonts save space Use pixel fonts for look/feel Use pixel fonts for look/feel
Game Graphics Bitmap Vector “Versus” • “Larger” file size • Less CPU resources • “Smaller” file size • More CPU resources • More memory • Scaling/Rotating = Bad • Less memory • Scaling/Rotating = OK Scaling/Rotating Bad Scaling/Rotating OK Vectors preserve look when scaled Pixilation occurs on bitmap assets when scaled
Device Memory • Memory Heaps: l d • Static – nearly guaranteed • Dynamic • Typically 1000 KB 0 kB and up to 6 000 KB • Typically 1000 KB … 0 kB and up to 6,000 KB • Fluctuates depending on other apps, etc. • FSCommand2 API FSCommand2 API var total_num:Number = fscommand2( “GetTotalPlayerMemory” ); var free_num:Number = fscommand2( “GetFreePlayerMemory” ); P bl ith C t t #1 “O t f M ” • Problem with Content #1: “Out of Memory” • Garbage Collection 60 d idl i ifi t i i • 60 seconds idle or significant rise in memory usage • We need an API to avoid memory leaks!
Device Performance • CPU • Equivalent to “Pentium PC” • Equivalent to Pentium PC • Target FPS • CPU “Timer Resolution” • CPU Timer Resolution • Nokia: 16 FPS, iRiver: 20 FPS • Other Flash Lite 1 1 devices Other Flash Lite 1.1 devices • 8 to 20+ FPS • Speed‐o‐meters Speed o meters • Test FPS capabilities • K I S S Principle • K.I.S.S. Principle • Keep It Simply Silly
Performance Tools Memory & Performance Tools OLD NEW ! TASK SPY – Symbian S60 Devices – Download: Adobe Device Central “Performance Calibration Tool” – Each device has “index” – Download: www.pushl.com/taskspy – Each device has index – Simulated CPU usage – Performance reporting – Only visual elements • AS 2.0 Profiling Tool http://www.nochump.com/asprof
and Color Pixel Depths and Color • Not all devices support the same color depth! Not all devices support the same color depth! • 12‐bit to 24‐bit … typically 16‐bit l i • Example Devices • Nokia S40 6131 (24‐bit) versus Nokia S40 (18‐bit) • Adobe Device Central • Search capabilities Color Palette may need adjusting if ported to new target device.
bitmaps over vectors where possible • .PNG’s over .JPG’s for bitmaps p • Optimize shapes and outlines • Split up and tile complex Background Bitmaps • Split up and tile complex Background Bitmaps • AVOID: – animating simultaneous movieclips – complex uses of Math and looping – a lot of ActionScript contained in one frame
• Analyze size reports and optimize • Devnet Articles have LOTS OF TIPS! – http://www.adobe.com/devnet/devices/ p • MANY MORE tricks for Flash Lite (2.x) … “Optimizing content for Flash Lite 2.0” ‐ Josh Ulm (Adobe) http://www.adobe.com/devnet/devices/flash_lite_optimization.pdf “Optimizing content for Flash Lite 2.0” ‐ Josh Ulm (Adobe) http://www.adobe.com/devnet/devices/flash_lite_optimization.pdf
Clix Game • ALIEN INVASION – Casual Game – Rapid Game Development = 2‐3 days for DEMO p p y – Flash Lite 2.0 (ActionScript 2.0) – OOP (Object based style architecture) j y WALKTHROUGH
Lite “2.1” Player running under Linux T F R • Target Frame Rate: 12 fps • Screen size: 320 px × 240 px • Sound: MP3 • User Inputs: • Touch Screen, Bend Sensor, • Light Sensor, Accelerometer • “Channels” and “Widgets” • “Throw‐away” type games • Simple == better Experimental Chumby Games
Flash Games • Download update configure not preinstalled • Download, update, configure … not preinstalled – Sony PSP ROM update version 2.70 or later • Flash Player 6 (6 0 72 27) Flash Player 6 (6,0,72,27) – Reality = Think “Flash Lite 2.1” • Run methods Run methods – embedded in HTML page, standalone SWFS in web browser – file:/flash/filename.swf • PSP Dev Center on Adobe – Features and Technical Info: • http://www.adobe.com/devnet/devices/psp.html
Multiplayer games Flash Lite Multiplayer games “’Turn style’ games make most sense … but it depends d l i i l di on your deployment environment including: operator, bandwidth, target devices, etc.” – Me
kind of games make sense? b d d l – Turn based games … Card Games, Puzzles, etc. • Communication Methods HTTP (Polling) Flash Lite 1 1 – HTTP (Polling) – Flash Lite 1.1 • loadVariables(), loadVars(), etc – XML Socket Custom Socket Server … Chapter 6 • Flash Lite 2.1 or higher • Sushi Socket Server (Flash Lite API) – Flash Lite = Bluetooth • Intercommunication with 3rd party application p y pp • Look for an “article” soon … EXAMPLES Sushi Socket Server
Game l Deployment Deployment “Worldwide revenue for mobile gaming subscriptions could increase from $3 billion to $10 5 billion in 2009 “– Juniper Research to $10.5 billion in 2009 Juniper Research Ltd.
Distribution Game Distribution Aggregators, Content Providers, Operators • Device Manufacturer Pre‐installation … and MANY MANY OTHERS! • Memory Card (MMC) = “Virally”
& A • Questions? Questions? • What can we do with Flash Lite 3? i l h id d – Native Flash Video now supported – T.B.D. “Wi h Li ” f Fl h Li 2 • “Wish List” for Flash Lite > 2.x – Garbage Collection API – Bitmap Caching? – Access to Camera/Bluetooth Support LBS Support (Location Based Services) – LBS Support (Location Based Services) – Others …
Where to go from here? Where to go from here? • Foundation Flash Applications for Mobile Devices Foundation Flash Applications for Mobile Devices – http://www.flashmobilebook.com • Adobe DevNet articles – http://www.adobe.com/devnet/devices/ • http //frame27 blogspot com – http://frame27.blogspot.com • Contact Me fitc2007@scottjanousek com • Game Groups: [email protected]
and Physics • Limited Device Capabilities – Handsets vs. portable consoles – Memory and Performance • Avoid overtly complex game computations EXAMPLE • Avoid overtly complex game computations • Flash Lite 1.1 supports limited Flash 5 object EXAMPLE – supports limited Flash 5 object – Drawing API can be simulated (sort of) • Flash Lite 2 x • Flash Lite 2.x – supports AS2 Math object – Drawing API Drawing API – onEnterFrame()
Flash Lite Games for iRiver Flash Lite Games for iRiver • iRiver Portable Media Players Fl h Li 1 1 • Flash Lite 1.1: u10 • Flash Lite 2.x: e10, Clix, “u20” (Clix 2G) • D‐Click Flash Lite interface • Up, Down, Left, Right, “softkeys” are +/‐ • Capabilities: • Flash Lite Games Flash Lite Games • MP3, stored data (u10), more! • Custom fscommand2’s • Yuck … Flash Lite API limitations
Game State Methods of Game State “Shared Objects” External Server • Mobile Shared Objects (FL 2.x) • Write2File (FL 1.1) • Requires external data connection • Pros: No data connection • Cons: Not always supported (only Flash Lite 2) file size • Databases (MYSQL) • Pros: Persistent in db • Cons: Requires connection (only Flash Lite 2), file size • Cons: Requires connection Entering Predetermined “Codes” • Enter code “xyz” to get to level 3 • Pros: Simple to implement • Cons: Can decompile to figure out codes EXAMPLE
devices support this feature Some devices support this feature – Nokia 6680 for example • Simulate the result of an action or event • Simulate the result of an action or event – Hit wall, Player died, alerts, etc. tV l f d2(“St tVib t ” ff t) • retVal = fscommand2(“StartVibrate”,on,off,repeat); • Enhancement – never require this for game play EXAMPLE