Corona SDK Game Project Post-mordem

This past semester I audited Intro to Digital Entertainment at ACU. I’ve always been interested in video game development and wanted to learn more.

For my final project I decided to write a video game using the cross-platform mobile SDK, Corona. That project was due last Thursday and I decided to post my thoughts on the framework I used.

The teacher of the class, Dr. Brian Burton, has written a book “Mobile App Development with Corona”. I decided I’d give it a try for my project because he’d given us a sample to start from and was so positive about it.

Well the project is done and at our presentation we got a lot of positive feedback about the game. I learned a lot doing the project, so here are my thoughts on developing with Corona.


You can get a lot done very easily. This is really one of Corona’s biggest pluses. Want to display a graphic on screen? One line of code.

background_image = display.newImage( "images/paper_bkg.png" )

Want sprite animation? One line of code.

ship.sp_ship = spriteSheet:grabSprite("ship.psd", true);

Want to move it from point A to point B?,{ x=1000, y=1000, rotation=45, time=1000, onComplete=finishShipMove, transition=easing.outQuad })

Adding collision detection, gravity effects, and many other features are very easy to do. I gave my son access to Dr Burton’s book and my laptop one day during Thanksgiving and he had sprites flying around in no time. The goal of Corona’s founders is to make an environment for non-programmers to make games.

Aside: I think this goal is part of my frustration. I kept expecting things a professional programmer would want from an environment and language.

The Community is Helpful.

A couple of times I posted to the forums and someone always responded back quickly. The people who use Corona love it and want to help others. I expect this post will get comments from people at Corona Labs, because I’ve seen them do it for other posts about Corona.


Lua. You write all of your game code in the language Lua. When you are writing a cross platform framework, you have to pick a language to write in because the various platforms all use different ones. Android uses Java. iOS uses Objective-C. Corona uses Lua.

My understanding is the main reason for picking Lua is the interpreter only adds 500k to the executable, which is an important consideration when you must have your framework code and the interpreter in every app you make.

But frankly Lua sucks. I could really go on and on with details, but I’ll try and be succinct.

Lua has no object-orientedness, but it looks like it does. (I didn’t realize how dependent/addicted to OOP I was until I didn’t have it) In Lua just about everything is a table – what Objective-C calls a dictionary – a list of key value pairs. Even arrays are tables where the keys are the array indexes. The reason Lua look like it has objects is you can set function “pointers” as values, so to call a function on a table it looks like an object function call. See the display call above. But there are no constructors/destructors. You can’t just release and object and know it will get rid of all its data, you have to write not just the dealloc code, but the mechanism.

This also leads to very strange scoping of variables, which I still don’t fully understand. But all globals are really in a secret table called _G. You can add variables to an “object” just by assigning them – better not make a typo in an assignment. This can be useful, for instance the SDK uses this when turning display object into physics bodies. You pass it a display object and it adds all the variables and functions needed for collision detection to it.

But then in other instances you will pass an “object” into a function that calls back later but when you get the callback you no longer have all the parts you passed in. And there is a “self” variable, which I never figured out.

What this means is you really have to give up on encapsulation. Once you realize everything should just be a global, life in Corona gets much easier.

The Corona Toolset is Primitive. The other problem with Corona is it lacks the support tools to make easy to use. Really there are no tools from Corona itself. You edit text files in whatever editor you want, then launch the simulator and point it to your main.lua file. Then things run.

The Documentation if Weak. Corona staff have freely said their docs suck. I wouldn’t go that far. I never found any API there wasn’t at least a minimal explanation of. (Except a break down of what fields are available in config.lua) I remember times Apple’s own docs have been worse. But there isn’t much depth. Not enough explanation of why things work they way they do. Also the overview/tutorials are spread across their blog and only occasionally linked to from the relavent API pages.

There’s no IDE. There are some third party ones, but none as slick and complete as say XCode.

There’s no Debugger. Well there is a command line debugger, but it was easier just to debug via print() than to figure that out. It really, really needs a visual debugger.

The Simulator is only kind of a simulator. Seems to me the Simulator is a OpenGL-only window. Since Corona is mainly for games, most of what it does is in OpenGL. The Simulator just shows you this stuff. This becomes obvious when you want to do something like put up a native alert, or use the keyboard for input. Can’t be done in the simulator. There are also performance differences between OpenGL on your Mac in the simulator and on your iPhone/iPad, which it seems a simulator should simulate.

“But Ron, you can always use the iOS Simulator.” No, you can’t debug in the iOS Simulator. Which I discovered and panicked the first time something ran fine in the Simulator and hung in the iOS Simulator.

This is partially a function of Corna and partially an Apple problem. The Corona side is they have separated you from the actual OS – that’s the price you pay for cross platform – and therefore you don’t get the access that would allow you to use a real debugger.

The other is classic Apple. When iOS 6 came out, Apple decided to limit app’s ability to output to console. Specifically they didn’t want apps like Corona let the Lua scripts output to console. So in order to debug via print() I had to write an entire set of logging routines (kind of an object) that would log to a file instead of stdout. A royal pain, but not one I blame Corona Labs for.

I won’t complain about the fact if you want to build something to run in the iOS Simulator or your device, Corona requires a round trip via the Internet to do the compile and build, and that roundtrip is purposefully delayed by 20-30 seconds if you aren’t a paying member. That’s a valid shareware limitation.

I do wonder how many of these complaints would go away if the Corona SDK were a library you included in XCode and did your coding and debugging there. But that doesn’t really work for the cross-platform nature of the framework. Also it doesn’t appear XCode understands Lua, but hey maybe they could change to Python which would solve almost all my Lua problems. (Ahh Corona that I could program in Python, that gives me a warm fuzzy feeling just reading it.)

This has gone on long enough, but I knew it would be long. I’ve essentially worked full-time on this project for a month, so I’ve had time to build up some complaints.

The other possibility is I’m full of it, since I haven’t used other tools, maybe I don’t know how easy Corona is. I’ll know by the end of the year. I’m going to do is rewrite my game using Cocos2d and Chipmunk. There are two reasons for this.

Firstly I need an iOS app in the AppStore. I’ve been looking for a programming job and most people who are looking for iOS programmers want them to have an app in the store. Don’t know how well an interview would go if I said, “Well it’s in the store but I didn’t write it in Cocoa.”

Secondly, this will let me work where I’m comfortable. I’ve done MacOS programming for almost 20 years now. About 9 of those using OSX/Cocoa/Obective-C. I can apply those skills to to my game if I write it in a native format.

One Comment

Comments are closed.