flash lite to corona

43
(Notes are exported here)

Upload: roberto-capodieci

Post on 10-Apr-2018

220 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Flash Lite to Corona

8/8/2019 Flash Lite to Corona

http://slidepdf.com/reader/full/flash-lite-to-corona 1/43

(Notes are exported here)

Page 2: Flash Lite to Corona

8/8/2019 Flash Lite to Corona

http://slidepdf.com/reader/full/flash-lite-to-corona 2/43

- Comrade Software - founded in 2002, doing mobile Flash since Summer 2002 (PocketPC)- Contract Web games, internal mobile games- Also games released on Verizon (USA) and Softbank (Japan) via publisher Smashing Ideas- But mobile Flash is di f cult to monetize...

Page 3: Flash Lite to Corona

8/8/2019 Flash Lite to Corona

http://slidepdf.com/reader/full/flash-lite-to-corona 3/43

(First example to be discussed)

Page 4: Flash Lite to Corona

8/8/2019 Flash Lite to Corona

http://slidepdf.com/reader/full/flash-lite-to-corona 4/43

Page 5: Flash Lite to Corona

8/8/2019 Flash Lite to Corona

http://slidepdf.com/reader/full/flash-lite-to-corona 5/43

Flash Lite to Corona:The Developer Case

Page 6: Flash Lite to Corona

8/8/2019 Flash Lite to Corona

http://slidepdf.com/reader/full/flash-lite-to-corona 6/43

‣ Uses the Lua language: easy lateral shift from

Actionscript‣ Existing Flash assets and program logic can

often be re-used, or ported rapidly

Development time comparable to Flash,shorter than iPhone SDK, much shorter thanOpenGL

Page 7: Flash Lite to Corona

8/8/2019 Flash Lite to Corona

http://slidepdf.com/reader/full/flash-lite-to-corona 7/43

Flash Lite to Corona:The Business Case

Page 8: Flash Lite to Corona

8/8/2019 Flash Lite to Corona

http://slidepdf.com/reader/full/flash-lite-to-corona 8/43

Problem #1: Carriers

- To develop Flash for Verizon, we had to join the BREW developer program at $400/yr tocode-sign on test phones- NSTL testing fees were $800 per application per device model (14 phones total) = $11,000,paid by publisher- Testing process much more nicky than Apple’s; some games from other developers failedat least once and publisher had to pay test fees again- Standard breakdown: carrier takes 50% of revenues, publisher takes 50% of remainder

Page 9: Flash Lite to Corona

8/8/2019 Flash Lite to Corona

http://slidepdf.com/reader/full/flash-lite-to-corona 9/43

Problem #2: Fragmentation

- Flash addresses the fragmentation problem with rescaling (much better than the 6-gureporting costs for wide-released mobile Java games), but you still end up compromisingdesign to ship a unied binary, due to the range of target devices- Apple avoids this problem by only making one device, more or less

Page 10: Flash Lite to Corona

8/8/2019 Flash Lite to Corona

http://slidepdf.com/reader/full/flash-lite-to-corona 10/43

iPhone users buy stuff.

(enough said)

Page 11: Flash Lite to Corona

8/8/2019 Flash Lite to Corona

http://slidepdf.com/reader/full/flash-lite-to-corona 11/43

When to use Corona?

‣ 2-D games

‣ Graphically-oriented utilities

- Good for apps with “immersive” interfaces

Page 12: Flash Lite to Corona

8/8/2019 Flash Lite to Corona

http://slidepdf.com/reader/full/flash-lite-to-corona 12/43

(Examples of popular graphically-oriented utilities)

Page 13: Flash Lite to Corona

8/8/2019 Flash Lite to Corona

http://slidepdf.com/reader/full/flash-lite-to-corona 13/43

- This is a Comrade-built native SDK app (because we needed MapKit), but note how most of the onscreen elements are still custom bitmap graphics, including all buttons and pickerwheel “highlight” bar- As it happens, most of the graphics were created in Flash

Page 14: Flash Lite to Corona

8/8/2019 Flash Lite to Corona

http://slidepdf.com/reader/full/flash-lite-to-corona 14/43

Page 15: Flash Lite to Corona

8/8/2019 Flash Lite to Corona

http://slidepdf.com/reader/full/flash-lite-to-corona 15/43

(Example of adware in the App Store)- Currently not for apps with Apple-style UI controls, although UI features have beenrequested- Currently no 3-D (or Flash-style “2.5-D”) support; also requested

Page 16: Flash Lite to Corona

8/8/2019 Flash Lite to Corona

http://slidepdf.com/reader/full/flash-lite-to-corona 16/43

Page 17: Flash Lite to Corona

8/8/2019 Flash Lite to Corona

http://slidepdf.com/reader/full/flash-lite-to-corona 17/43

Lua/Corona forFlash Developers

Page 18: Flash Lite to Corona

8/8/2019 Flash Lite to Corona

http://slidepdf.com/reader/full/flash-lite-to-corona 18/43

www.lua.org/pil

Page 19: Flash Lite to Corona

8/8/2019 Flash Lite to Corona

http://slidepdf.com/reader/full/flash-lite-to-corona 19/43

(Other Lua books -- note that Lua tends to be used as a game-development language)

Page 20: Flash Lite to Corona

8/8/2019 Flash Lite to Corona

http://slidepdf.com/reader/full/flash-lite-to-corona 20/43

Basic Lua Syntax in 60 Seconds

Actionscript:

Lua:

- Will feel similar to Actionscript, but adds “do”, “then”, “end”, etc.- Semicolons at ends of lines are optional- Need to break the habit of using curly braces for code blocks

Page 21: Flash Lite to Corona

8/8/2019 Flash Lite to Corona

http://slidepdf.com/reader/full/flash-lite-to-corona 21/43

Tables are Fundamental

- Curly brackets are reserved for declaring tables- Tables are the fundamental object in Lua; tables = associative arrays (or dictionaries)- Functions are rst-class variables, and you can redene any function anytime (includingsin(x))- Lua is not heavily object-oriented by default, and the PIL book discourages encapsulation.However, it is possible to build your own classes and objects -- see PIL, and brief discussionat end of this talk

Page 22: Flash Lite to Corona

8/8/2019 Flash Lite to Corona

http://slidepdf.com/reader/full/flash-lite-to-corona 22/43

Think Locally

Bad: Good:

(30% performance difference)

- A major Lua optimization is using local variables (and functions) only- Declaring a local copy of the sin function means that it doesn’t require a lookup from theglobal “math” table

Page 23: Flash Lite to Corona

8/8/2019 Flash Lite to Corona

http://slidepdf.com/reader/full/flash-lite-to-corona 23/43

More Familiar Objects

Flash:

Corona:

- Other similar elements include event listeners and transition libraries- Notice less code coloring in the 2nd example; this is because TextWrangler doesn’t knowhow to color the Corona framework objects (this would be a nice-to-have feature)

Page 24: Flash Lite to Corona

8/8/2019 Flash Lite to Corona

http://slidepdf.com/reader/full/flash-lite-to-corona 24/43

Our Friend, the Button

- Corona example code includes a robust button object (handles rollout correctly, etc.)

Page 25: Flash Lite to Corona

8/8/2019 Flash Lite to Corona

http://slidepdf.com/reader/full/flash-lite-to-corona 25/43

Flash Lite Conversion #1:Poker Arcade

- A collection of 6 popular video poker games; Flash version completed in 2007

Page 26: Flash Lite to Corona

8/8/2019 Flash Lite to Corona

http://slidepdf.com/reader/full/flash-lite-to-corona 26/43

- Game originally developed in FlashLite 1.1 (no functions, no arrays, etc.) for maximumdevice compatibility- Card assets (the most time-consuming to create) taken directly from Flash to Corona, usingPNG export

Page 27: Flash Lite to Corona

8/8/2019 Flash Lite to Corona

http://slidepdf.com/reader/full/flash-lite-to-corona 27/43

- Main program logic (dominated by lengthy scoring routines, especially in Deuces Wild)ported with very few changes; new code mostly involved the UI.- Game was playable within a couple of days; total coding time was less than a week

Page 28: Flash Lite to Corona

8/8/2019 Flash Lite to Corona

http://slidepdf.com/reader/full/flash-lite-to-corona 28/43

- The single biggest step was the creation of new background and UI assets to takeadvantage of the large screen (graphical production time exceeded coding time)- Making the higher-res graphics took another week, so total development time was about 2weeks

Page 29: Flash Lite to Corona

8/8/2019 Flash Lite to Corona

http://slidepdf.com/reader/full/flash-lite-to-corona 29/43

(asset comparison)- Note change from 3 to 5 hands in game

Page 30: Flash Lite to Corona

8/8/2019 Flash Lite to Corona

http://slidepdf.com/reader/full/flash-lite-to-corona 30/43

(asset comparison)

Page 31: Flash Lite to Corona

8/8/2019 Flash Lite to Corona

http://slidepdf.com/reader/full/flash-lite-to-corona 31/43

- Final build has about 2000 lines of code- Particle e ect added for win animation: a burst of stars falling under “gravity”- Surprising number of stars could be animated, compared to many mobile Flash devices (Iwas hoping for 3-5)- The game came out well, but the source code is another matter...

Page 32: Flash Lite to Corona

8/8/2019 Flash Lite to Corona

http://slidepdf.com/reader/full/flash-lite-to-corona 32/43

We’re happy with how the game turned out, but I would organize the code much di erently if doing it again...

Page 33: Flash Lite to Corona

8/8/2019 Flash Lite to Corona

http://slidepdf.com/reader/full/flash-lite-to-corona 33/43

Poker Arcade: Lessons Learned

‣ The Flash timeline had hidden the spaghettilogic of the original program

‣ But Lua functions and variables declared

“local” are sensitive to code-ordering...‣ ...which led to declaring everything as global...

‣ ...which caused memory management issues.

‣ Eventually, brute force was used: load all assetsat once; never deallocate or reallocateanything ever.(This approach is not recommended!)

Page 34: Flash Lite to Corona

8/8/2019 Flash Lite to Corona

http://slidepdf.com/reader/full/flash-lite-to-corona 34/43

Flash Lite Conversion #2:Core Damage

- Flash version also completed in 2007

Page 35: Flash Lite to Corona

8/8/2019 Flash Lite to Corona

http://slidepdf.com/reader/full/flash-lite-to-corona 35/43

(This slide is a 60-second embedded video demo)- Flash version completed in 2007- Based on Breakout (1976), but using polar coordinates rather than (x,y), and circularwraparound

Page 36: Flash Lite to Corona

8/8/2019 Flash Lite to Corona

http://slidepdf.com/reader/full/flash-lite-to-corona 36/43

Page 37: Flash Lite to Corona

8/8/2019 Flash Lite to Corona

http://slidepdf.com/reader/full/flash-lite-to-corona 37/43

- For iPhone version, since the screen is much bigger (and user expectations higher), muchmore graphical detail was added- Some Flash assets resized and re-used; others redrawn- We also decided to make it a tilt-controlled game, and went to a landscape orientation- In score eld, “LED” style replaced with “Nixie tube” style

Page 38: Flash Lite to Corona

8/8/2019 Flash Lite to Corona

http://slidepdf.com/reader/full/flash-lite-to-corona 38/43

(Detail comparison)- Since all assets on iPhone are bitmaps, and there’s lots of memory, there is no reason notto use subtle shading, shadows, glow e ects, and other details

Page 39: Flash Lite to Corona

8/8/2019 Flash Lite to Corona

http://slidepdf.com/reader/full/flash-lite-to-corona 39/43

- Same level designs ported directly from Flash version

Page 40: Flash Lite to Corona

8/8/2019 Flash Lite to Corona

http://slidepdf.com/reader/full/flash-lite-to-corona 40/43

Now Featuring Tilt!

(This is a 60-second video demo, showing accelerometer controls)

Page 41: Flash Lite to Corona

8/8/2019 Flash Lite to Corona

http://slidepdf.com/reader/full/flash-lite-to-corona 41/43

Core Damage: Lessons Learned

‣ Use object-oriented principles for codeorganization

‣ Most importantly: forward declaration allows

sensible code ordering while maintaining localscope throughout

‣ Better use of reusable objects

‣ “Movieclip”-like objects created to replicateadvantages of Flash

‣ With fully-bitmapped assets, detailed visualsare “free”

Page 42: Flash Lite to Corona

8/8/2019 Flash Lite to Corona

http://slidepdf.com/reader/full/flash-lite-to-corona 42/43

My Corona Wish List

‣ A mechanism for “includes” or externallibraries

‣ Specialized game-dev support (e.g., physicsengine?)

‣ Tethering iPhone to simulator foraccelerometer testing

‣ Local peer-to-peer networking support‣ 3-D support

‣ Keyboard and other UI controls

Page 43: Flash Lite to Corona

8/8/2019 Flash Lite to Corona

http://slidepdf.com/reader/full/flash-lite-to-corona 43/43

Demos & URLs

www.lua.org/pil

www.barebones.com/products/textwrangler

developer.anscamobile.com