Lua: the lingua franca of iPhone games

Share on Facebook0Share on Google+0Tweet about this on TwitterShare on LinkedIn0

In times like these, it helps to look at the company you keep — and if you are a Corona developer, you should find comfort knowing that you’re building apps in exactly the same way as top iPhone game studios.

These developers all depend on Lua to create their iPhone apps, so if Apple’s new rules were interpreted literally, it would immediately impact star players and top-selling apps. Developer Louis Gerbarg illustrates the consequences, assuming Apple would be reckless enough to apply its new rules to Lua-based games:

“This affects major app store publishers, like EA, Gameloft, Tapulous, and ngmoco. Looking at the top ten lists on the app store right now I see several titles that I know have embedded Lua interpreters.”

This developer’s open letter to Steve Jobs similarly highlights Lua’s central role:

“For the past 6 months I’ve used the programing language Lua in all of my iPhone apps. I’m not alone, EA and Tapulous, two of the App Store’s best selling development shops, find Lua to be a huge benefit to iPhone development.”

In the past few days, thousands of developers have been dissecting the application bundles of top-selling App Store games. What they found was that many top-selling apps embed Lua, such as the top-5 selling app Diner Dash (which has an entire folder of uncompiled Lua script files, i.e. the raw source, inside the application bundle) and the international #1 selling app Angry Birds (which also contains multiple .lua files) just to name a few. Even Tapulous’ #1-selling family of Tap Tap Revenge apps — perhaps the most well-known apps in the history of the iPhone App Store and featured onstage by Steve Jobs himself at the OS 4.0 launch — embed Lua.

Why am I bringing this up?

Because the app bundles you create using Corona are structured in the same way that these major developers structure theirs. The architecture boils down to a division between the engine and the logic. It’s analogous to the roles played by real engines and transmissions. The engine provides the power; the transmission connects the engine to the final drive to make a vehicle go.

As Gerbarg explains:

“If you aren’t a game developer you might not be familiar with how large games are structured, but most games consist of a game engine, which is high performance code for doing things like rendering graphics, and an interpreter which runs the game logic (determining how sprites move, determining when to pop up in game text boxes, etc). This is how practically every commercial RPG works, as well as many (most?) other types of games.”

This sums up how your Corona apps are packaged. There’s the game engine (the executable binary which, as I mentioned previously, is 100% Objective-C/C++) and then there’s the logic (defined by your Lua code). Then the Corona engine goes one step further than other Lua-based iPhone apps by refusing to run, load, or execute raw uncompiled Lua scripts; they must be fully compiled at the time of the build and stored internally in the app.

Hopefully this helps clarify why we continue to believe that you, our Corona developers, will be fine. After all, you will be submitting apps that look just like ones put out by bestselling iPhone game studios and developers. I can’t think of better company to be keeping!

Share on Facebook0Share on Google+0Tweet about this on TwitterShare on LinkedIn0

This entry has 29 replies

  1. Brad says:

    Good luck… Just discovered your company and product through all this 4.0 OS 3.3.1 ToS power move crap. I hope you and all the other Companies make your point and survive with full use of iPhone OS 4.0. But honestly it really sounds like Apple’s Ego just got to big and they intend to take down everything that is Non Xcode produced.

  2. That is downright funny. Steve promoting OS4 with a app that has LUA all over it. Pricessless!

  3. Mike says:

    By the way, how the Android port is going?

  4. _mark says:

    OMG. What in the Heck is Apple doing? Anyone?

  5. martin says:

    The fact that Corona is Lua based makes me happy. Should Apple ban it, Corona will still be awesome for Android, Win7 and WinMo7 and Maemo.

    Our attention = new products for platforms = equals revenue.

    It’s Apple’s choice if they want to be part of that equattion. We’ll make Android/winmo7/Maemo…. just bigger otherwise. Let the revolution begin!

  6. I think Apple got overzealous and a bit arrogant here. I understand where they’re coming from in terms of wanting to maintain quality and not filling the App Store with junk. But trying to control how developers do their thing is just kind of ridiculous and counter-productive.

    This is especially true for some of the more unusual and leading edge interfaces for new devices like the iPad. These often don’t come from hard-core coders, but designers who use productive tools like Corona so they can focus on the interaction and concept. The evolution of the iPhone OS, the applications that run on it, and how this new platform is used depends on experimentation and invention by all kinds of developers. It’s only in Apple’s interest to foster interesting work from all directions. Or do they want to shoot themselves in the foot?

  7. _mark, Apple is turning into a big ugly operator in some respects. All they need now is the infrastructure (not likely to happen anytime soon, though). 🙂

    I doubt they would go the MVNO route (mobile virtual network operator) since none in the US are really successful … however, one could call them a MCNO at this stage (mobile content network operator).

    It’s about a controlled ecosystem for them. Expect more of it, not less of it. Consumers are still eating up Apple hype.

    In some respects Apple’s device platform is the new “BREW” (closed), and Android is the new “Java” (open). Good luck to both.

  8. Snow says:

    Man again I’m sitting on the knife’s edge on opinion. I myself am not a lazy person by most means (I am a little lazy sometimes :P). My first iPhone games will be made in Flash then ported with Corona. I’m still learning to program and am eager to get games on the platform. My games are already similar to your standard flash game in architecture. So, since I know flash, I’ll stick with Flash for now as my development tool until I am ready to take on Obj-C, Cocos2d for iPhone, etc. I guess I’m impatient.

    I can understand Jobs’ decision on one hand. Because Flash makes it easier to create games, the majority of flash games out there are sub-par on quality. Unfortunately it’s a sad truth. Flash CS5 would allow for a whole slew of already made flash game to suddenly flood into the app store… as one of my international friends put it, “the app store is gonna get raped”. Of course in Flash, programming is required. However, a game built from scratch with it’s own engine, graphics system, etc requires dedicated programming and is difficult. That’s not to say that every diligent programmer are excellent game designers, there are a lot of crappy non-flash games out there too.

    The store could still get flooded with apps, through the use of Corona to port them, but as I understand it still takes a bit of effort to port. I guess basically, I’m saying is that it helps keep lazy game creators who make sub-par material from easily publishing their games.

    With Flash CS5, it would be a sad day if you suddenly saw one of those annoying banner-ad flash games on sale for 99 cents and bought unwittingly by consumers duped by the games description page. Not only that, but because of how Flash CS5 compiles, that banner-ad game would be almost 10 megs to boot. That would be a sh**storm for Apple to deal with.

    Now, on the other hand, with Steve swinging around his mighty hammer like that is irritating. Rather than sitting down with Adobe or other companies that can cross compile and say, “look, we want your developers to develop games, but there needs to be some kind of system in place to keep the technologies from being abused and sub-par material filling up the store”, he’s giving everyone else who doesn’t want to stick solely with his technologies a middle finger. Truly Apple and Adobe are hand in hand in a way. I would never have gotten a mac computer in the first place, if it wasn’t built for using Adobe software. Macs don’t or rarely crash. When I’m working on my stuff in Adobe, I want stability and a powerful machine. Apple gave me that. To see this conflict between them suddenly is like watching children fight over a piece of candy… in a candy store.

    Last, I want to say that I’m thankful to the Corona devs for working hard on a stellar technology and giving continual support. Thank you very much. 🙂

  9. Steve Balmy says:

    I don’t understand why there are so many iSheeple continually following the Pied Piper (AKA S.Jobs at apple). Camping outside crapple HQ waiting for their next instruction what to eat, when to breathe, etc..

    For all those worshipers though, here is an updated TOS for 4.0

    “In accordance with our TOS, you agree to have an apple logo branded on your forehead. You must develop in an isolated (padded) cell, with piano white walls. No contact from any other person is permissible with the exception of official apple representatives. You agree to psychological examinations by such representatives at any time without notice. You must also enroll with the Scientology organization. This cannot be disclosed. All your bases belong to us”

  10. Michelle says:

    […] Go here to learn more about how Corona apps are no different from #1-selling iPhone […]

  11. Chris says:

    Oh my god. Why has no one discussed the obvious absurdity of the fact that their language makes it against the terms to use OpenGL shader language which the platform REQUIRES if you want to use OpenGL at all.

  12. Joel says:

    In-App-Purchase almost require the use of an interpreter. Assuming the new content is not just media — images, text, video, etc — but is new game content, normally the new content would be in the form of interpreted script content. If I have 4 purchasable levels that run with the same engine, but only one executable to run them, then 1 need 4! = 24 distinct executables that the user could download to replace the original executable. That’s obviously crazy.

    Take a look at any game that has in-app-purchase of additional levels. I can almost guarantee they are using an interpreter.

  13. George says:

    Oh my god. Why has no one discussed the obvious absurdity of the fact that their language makes it against the terms to use OpenGL shader language which the platform REQUIRES if you want to use OpenGL at all.

  14. Ian says:

    Oh my god. Why has no one discussed the obvious absurdity of the fact that their language makes it against the terms to use OpenGL shader language which the platform REQUIRES if you want to use OpenGL at all.

  15. Frederic says:

    For Corona people and other alternative development tools :
    I am not sure that Apple decision to restrict the use of tools other than XCode and Objective-C is a compliant decision with the european rights : Microsoft, by embedding IE into its OS, had to pay a lot and finally made a tool to let the user choose the browser he likes. Apple makes a kind of monopolistic law with (1) itunes store : other companies cannot sell without being approved by Apple which is not freedom (2) XCode and the rejection of alternative software to build iPhone app wihich not either freedom.
    I encourage you to dig into these ideas as Europe should not let this situation for ever being.

  16. carbonsink says:

    I’m sorry, but there’s no way Corona/Lua can be allowable under the new TOS and not the Flash Packager for iPhone. If Apple allows developers to use your tools and not Adobe’s, they may as well have written a TOS that said “You can use any tool to develop iPhone apps as long as its not Flash”

  17. Evan says:

    @carbonsink — Corona apps are still being accepted for the App Store, even after the April 22 deadline. And none of the other Lua apps have been bounced from the store.

  18. joe says:

    @carbonsink – revised Apple ToS:
    “You can use any tool to develop iPhone apps as long as its not Flash”
    have a nice day 🙂

  19. Singer says:

    As soon as you port to Android, you will be in violation of the Apple 4.0 TOS agreement. Here’s why: In order for your code to maintain portability, when Apple introduces new features, you will need to make sure that implementing them is portable. At that point your developers will have to wait on you even though Apple has already made it available. In fact you may never add the full feature set in order to ensure Android compatibility. And, that is Apple’s main concern, that their innovation will be stifled by an intermediary for the sake of portability…

  20. Evan says:

    @Singer – to be clear, we’ve never committed to not supporting features unless they can be implemented on all platforms. So far, there are a number of convenient similarities between iPhone and Android, but my guess is that their features will diverge more sharply as both companies try to maintain market differentiation.

    Also note that we’re currently implementing a lot of game-development features and frameworks that are not part of either the iPhone or Android SDKs (e.g. a physics engine).

  21. Some interesting news, in case you haven’t read this:

    Basically, Corona looks even more hopeful for iPhone now.

  22. Vlad says:

    If you develop iphone games make sure to take a look at my top iphone games reviews and submit your game if you like what you see