Showing all entries for: April 2011

Corona SDK is the Future. Even the famous tech-writer, John Siracusa, recognizes the need to simplify the programming experience on iOS—someone should really tell him about Corona!

He even goes as far as saying that it’s even worth a performance penalty:

All other things being equal, when faced with two technologies, one less abstracted but higher performance, and one more abstracted but slower, the more abstracted, slower technology will always win in the long run. While hardware performance increases over time, the human capacity to deal with complexity does not[.]

Thankfully, for us Corona developers, we can program apps using the simplicity of Lua over languages like Objective-C without taking a performance hit. And as an added (HUGE) benefit, apps are cross-platform by default. :–)

Corona SDK is the future; once again, it’s time to open our eyes to the era of modern app development.

Managing Your Runtime Listeners

Proper event listener management is something that is crucial to every app created with the Corona SDK. Failure to monitor and remove unused listeners can bog your app down, and in many cases, cause it to crash. The bigger your app gets, the harder it is to keep track of just what listeners you’ve added, and when you’re ready to remove all of the listeners you’ve added, there’s always that nagging question in the back of your head that asks, are you SURE you got all of them??

For that very reason, I created a couple functions that you can add to your main.lua file that should help you manage your Runtime listeners (because event listeners attached to objects are automatically removed when you remove the object, per the latest Corona release).

So remember, the code I’m about to give you only applies to “Runtime” event listeners, which include but are not limited to things like (just examples):

Runtime:addEventListener( "touch", myObject )
Runtime:addEventListener( "enterFrame", onScreenUpdate )
Runtime:addEventListener( "system", onSystemEvent )
-- etc. etc.

And here it is:

listenersTable = {}

-- runtimeListener(): use instead to add or remove new "Runtime" listeners

runtimeListener = function( addRemove, eventType, listenerFunction )
    local aR = addRemove or "add"
    local theType = eventType or "enterFrame"
    local theFunc = listenerFunction

    if aR == "add" then
        Runtime:addEventListener( theType, theFunc )

        local newItem = { theType, theFunc }
        table.insert( listenersTable, newItem )

    elseif aR == "remove" then
        Runtime:removeEventListener( theType, theFunc )

        -- Since we are going to be removing from the same table we are iterating,
        -- iterate backwards to avoid conflicts:
        for i=#listenersTable,1,-1 do
            if listenersTable[i][1] == theType then
                table.remove( listenersTable, i )

-- removeRuntimeListeners(): remove all listeners added with runtimeListener() function.

removeRuntimeListeners = function()

    -- Since we are going to be removing from the same table we are iterating,
    -- iterate backwards to avoid conflicts:
    for i=#listenersTable,1,-1 do
        Runtime:removeEventListener( listenersTable[i][1], listenersTable[i][2] )
        table.remove( listenersTable, i )

    listenersTable = {}

So, whenever you want to add a new Runtime event listener, instead of using the conventional:


Instead, use the runtimeListener() function like so:

runtimeListener( "add", "touch", onScreenTouch )
runtimeListener( "remove", "touch", onScreenTouch )

-- Then, when you want to remove all of them:

I haven’t tested the above code in an actual project, so let me know if you come across any bugs. The theory is all correct though, and should definitely work in practice.

Good luck, and here’s to programming high performance apps using the Corona SDK!

Corona SDK vs. Objective-C and Java. This is the new “comparison” page, which only has two examples so far (displaying an image), but they are very impressive nonetheless.

It’s extremely scary to think of what mobile developers have to go through without Corona, and makes me that much more happy that I came across it when I did last year.

Also, because Corona outputs native code (behind the scenes), the comparison page above sheds some light on what Ansca’s “Corona Core” engineers have to go through to make things so damn simple for us Corona/Lua developers—let’s not forget about that!

Additive Blends in Corona Daily Build 497. The blog post describes exactly what it does, and how to use it (just a simple one-liner).

Yet another tool to add to the ever-growing Corona SDK tool box.

I was trying to think of how I would use the feature in a real-world scenario, and the closest thing I could come up with was maybe something like the floating shapes effect you see in the background of the game, Tilt-to-Live—one of my all-time favorites.

It’ll definitely be very interesting to see what people do with this new graphics feature.

Actually: Android is NOT Beating the iPhone. Lots of eye-openers in this article. Here’s the gist:

Now, let’s take a look at the operating systems in the U.S. According to reports released this month by comScore, if you factor in all of the devices that use iOS including iPhones, iPads and iPod touches, Apple reached 37.9 million people. Android, according to the data, reached 23.8 million on phones and tablets.

I’ve observed it many times—and never really paid it much thought until now—but why in the world does everyone compare the entire Android OS reach (to include the few tablets on the market) to that of a single iOS device (iPhone), without including iPads and iPod touches?!?

iPhone/iPad Competitors: How to Beat Apple. Jason Kottke with some great advice that seems obvious enough that you’d think Apple competitors would be following by now.

Personally, I’m a big fan of Apple, mostly for what they’ve accomplished and what they are currently doing with their iOS devices, the tablet market, and of course, the Mac. People view Apple as the “big guy”, just waiting for the underdog to come and show them up. People forget that Apple is the underdog—who blew everyone away, starting with the iPhone in 2007.

However, I believe competition is healthy, and right now Apple’s competitive advantage is starting to look very, very sad—especially in the tablet space. Every time I see a crappy “me too” tablet, I see piles of cash being burned.

In my opinion, the only one I really see moving in the right direction is Barnes & Noble with their Nook device—how they are trying hard to create a unique experience for their own audience, instead of market themselves as the next best “Android” tablet.

3 Ansca Paid Internship Positions Open. To sum it up, here are the positions Ansca is hiring for this summer:

  • Developer Advocate Intern
  • Mobile Marketing Rotational Intern
  • Product Designer

This is a paid, full-time summer internship in Palo Alto, CA (32-40 hrs/wk), with potential opportunities in Fall/Winter and beyond

Here’s your chance to join the Ansca team, so start submitting your resumes!

Technical Reasons to Choose Corona SDK. I told you why you should choose Corona from a modern developer’s standpoint. Well, it’s also a great choice for those looking at it from a technical standpoint (e.g. a highly technical, low-level developer debating on whether or not to go with Corona).

Ted Patrick (Chief Developer Evangelist for Barnes & Noble) broke apart the technical details of Corona SDK back in January (just came across it now):

One of the big mental hurdles to get past with Lua is that interpreted does not mean slow. Here is a good set of benchmarks to look at. Lua is well within the required range of performance for interactive development. I would suggest spending all of 5 minutes looking into Lua performance and then forget about it. Lua 5.1 within Corona SDK is fast enough for any mobile application and hardware will only improve things moving forward.

Also keep in mind, Corona has improved vastly since January :–)

Corona SDK Approved for NOOK Apps. That’s right, coming summer 2011, you’re gonna be able to program apps for Barnes & Noble’s exclusive NOOK Color app store using the Corona SDK.

Oh wait, there’s already a Nook app created with Corona SDK on sale!

image removed

More information on the “Animal Show” app on Chronicle Books’ website—made with the one and only Corona SDK by Ansca, Inc.

Correction: There are actually 4 Corona-made apps already available in the Nook App Store:

Cranking. Here’s to Merlin Mann for outstanding courage. I think we all spend a significant portion of our lives “cranking”, but it’s those with the courage to rise above it who make a real difference in their lives, and sometimes even the world.

Great inspiration for anyone, in any niche or industry.

On Being an Ansca Staff Member

As many of you may have already noticed due to the orange “Ansca Staff” badge recently attached to all of my forum posts, I’m officially a member of the Ansca staff—it’s no secret.

The main reason I’m mentioning it here is because there’s a large amount of content on my blog that is very pro-Corona, and many of you have used the content on my website (my experiences, opinions, etc.) as a basis for making your own decision to subscribe.


Now, being on the Ansca staff and all, I can see where you might think the information here could be heavily biased—for obvious reasons.

Well, I’ll have you know that all content on this website written prior to becoming a staff member (which is a recent development, so anything posted prior to this month), is all valid stuff. I was a consumer of Ansca’s product—and a very happy one at that.

With that said, the two past reviews I wrote on the Corona SDK can still be considered very credible:

When I wrote those reviews, I had no “motive” to say good things, other than the fact that I was a happy end-user of the product. I hadn’t planned on trying to become an Ansca staff member, I had no intentions of applying for a staff position—and frankly—didn’t know that being on the Ansca staff would ever be in my cards.

So if you’re still deciding on whether or not you want to become a Corona SDK subscriber, and not sure you want trust the words of an “Ansca Staff Member” when it comes to making your decision, take comfort in knowing that the reviews mentioned above, and anything written prior to very recently is all stuff from just a happy consumer of Ansca’s amazing product. Nothing more. Nothing less.

But it’s not like you have to read any reviews anyway. The Corona trial period is unlimited, and basically gives you access to the entire product—just shy of what you need to publish apps to the App Store(s).

So if you haven’t gotten as far as downloading the trial yet, what are you waiting for?!? That should be the first thing you do :–)

Excited? You Bet…

Now that I got all that out of the way, it’s worth mentioning that I’m very excited for what the future holds (such an understatement). And it goes without saying—but I’ll say it anyway—I’m very thankful to have the opportunity to work with such a great team, and to directly contribute to a startup whose product I fully stand behind—staff member or not.

Lua Garbage Collection Tip

By default, Lua handles garbage collection automatically—meaning, in most cases, you don’t have to think about it (in case you didn’t know, garbage collection is the act of freeing up memory on unused resources, e.g. variables that have been set to nil).

However, there are cases where you might not want Lua to perform a garbage collection cycle, such as intense gameplay moments when you have multiple objects moving about the screen, where any slight hiccup could affect the user’s gameplay experience.

For example, in my game Tilt Monster, the gameplay is pretty fast-paced. The screen scrolls quickly for the duration of each round while the player tilts the device to avoid collisions, and any slight bit of lag could cause an adverse affect on the player’s experience. To prevent that (as much as possible), I’d want to do anything and everything I could to make sure performance takes first priority.

I’m not exactly sure how much “energy” it takes for Lua to perform a garbage collection cycle, but since rounds are relatively short in Tilt Monster to where I know uncollected “junk” isn’t going to pile up for the duration of a game, I’d rather Lua not perform a garbage collection cycle during gameplay.

Therefore, I would simply stop the garbage collector like so:

collectgarbage( "stop" )

Then, once the round is over and there is a break in gameplay (e.g. the “Game Over” screen), then I would allow the garbage collector to resume normal activity, and force a collection cycle as well:

collectgarbage( "restart" )
collectgarbage( "collect" )

Of course, I’d call that after removing and nil’ing out the objects from the previous round.

Like I said, I’m not sure how much “juice” a Lua garbage collection cycle sucks up, but since it’s just one line of code to prevent it from happening, it’s worth it for whatever performance it could potentially bring your app when you are in need of every ounce of “horsepower” for a specific portion of your app’s runtime.

Note: Do not—I say again—do not forget to restart the garbage collector at some point though! If you do forget, your app could crash from having too many objects just sitting in memory that need to be cleaned up.

Quick Primer on App Marketing. A great piece by Shawn Blanc that gives some important pointers when it comes to pitching your app to potential reviewers via email.

A must-read-and-remember for any app developer.

A Job Well Done. Walter Luh, on Corona SDK’s first days of development:

The real challenge was to package everything up so that people would find it simple and enjoyable to work with.

Simple? Check. Enjoyable? Check.

Although Corona SDK’s development is ongoing, I think everyone can agree that the overall “vision” of the product is coming along very nicely.

Moving an Object on a Bezier Curve. Awesome tutorial by Carlos Icaza for those working with curves and objects in your Corona SDK projects. And that’s just part one!

Corona SDK: Birthing Modern App Development

In light of Corona SDK’s recent birthday, I thought I’d take a moment to appreciate one of the most important things that Ansca’s amazing product helped give birth to within the mobile software industry, something that I’ve unofficially dubbed modern app development.


Let’s break that term apart a little. You already know what app development is, so why exactly has Corona contributed to the modern aspect of it?

The non-Corona way of developing an iOS app would be to use a language called Objective-C, which is what most people had to use, pre-Corona. It’s worth mentioning that Corona also does cross-platform Android development as well, but I’ll just focus on iOS for now. Before I explain any more though, I’ll show you two code examples that’ll illustrate 90% of what I’m trying to say.

The first example is an app, using Objective-C, that simply displays the words “Hello World” on the iPhone screen. Unsurprisingly, the code is too much to paste into this blog post. Take a look at it here:

And here’s how to do that same thing using Corona:

local textObject = display.newText( "Hello World", 50, 50, nil, 24 )
textObject:setTextColor( 255, 255, 255, 255 )

And that’s it!

And it’s not only about reducing lines of code, which is a drastic improvement from the Objective-C example, but you’ll also notice that Corona’s code is much, much more user-friendly.

Not only do you really have to know what you’re doing to figure out what’s going on in the Objective-C app, but that’s a boatload of stuff you gotta remember just to place two simple words on the screen!

I’ll go as far as to say that you probably don’t even have to be a programmer to figure out what the Corona code example is supposed to do.

Modern app development is all about leaving all the technical details for your software development kit to deal with, so you have the mental focus, energy, and motivation to figure out the logic and make it happen.

Old vs. New

Originally, way before my time, you’d have to feed the computer a series of 0’s and 1’s (rather than the code in the examples above).

Then, to make things easier, there were programming languages that came along such as Assembly, which gave the computer a little bigger slice of the work for the sake of human readability. At that point, programmers could focus just a little more on the logic because now they had letters to work with, instead of just two numbers (0, 1).

As time progressed, programming languages such as C and C++ and several others came about which were even more readable and easy to work with. With these languages, the computer took a bigger slice of the overall workload (converting the human-code to “computer code”), which freed up more time and energy for humans to focus on what’s really important: the end-user experience.

Now, thanks to Corona SDK, we can give the computer an even bigger slice… and do so without having to sacrifice performance. Enabling developers to create top-notch apps at unheard of development times, using code that is human readable and most of all, practical, is Corona’s forté.

Corona SDK is the modern app developer’s toolkit of choice, and it’s only getting better.

Moved to and Posterous

After using Tumblr for so long and battling my way through several custom themes, I just couldn’t settle on one.

Then, I came across a site that uses Posterous and I actually liked the basic default theme the site uses. After signing up, I played with the colors until I settled on something I liked and started to get to know the service a little more.

I decided that overall, I like Posterous better, except the actual URL (how do you spell Posterous again???). So I decided to finally register a domain for my site: Thankfully, their service makes that a breeze too.

Awesomely Written Sales Page for a WP Theme. It’s all pretty funny, but here’s my favorite section:

For Mac-Loving Minimalists

Life’s better when it’s simple and beautiful. Why shouldn’t your website reflect the other stuff that’s passed through your life? Your iMac, your MacBook, your iPad, the iPhone, iPhone 3G, iPhone4 and — heck — even the Apple TV you weren’t sure about but have since grown to love, cradle in your arms, and whisper to on cold nights. They each called to you; you bought them by following your heart, not following a cost-benefit analysis, feature list, or fad.

We think that Zen Kitten is perfect for people like you. People with a thirst for the pared-down-to-the-minimal and the not-quite-white. People in search of a better life; a more simple life. People who can’t help wonder when the iPhone 5 is due out.

Biffy says the above section is talking about me. She was joking … I think (lol).

Even if I didn’t like the theme, I’d consider buying it for giving me such a good laugh (but it is pretty nice for any Wordpress bloggers out there).

Recent Corona SDK Forum Activity Page. Did you know about this? It’s a page that aggregates the most recently updated forum threads.

I highly recommend you bookmark this link for future reference.

It’s a great place to start if you want to get in on the latest Corona SDK community discussions, but don’t know where to start amongst the multitude of forum boards.

Using this “Recent posts” page, I’ve been able to be A LOT more active in the forums, answering many questions that often go unanswered by others.

If you’re knowledgeable about Corona and would like to give a little back to Ansca (besides subscribing, of course), then take a moment every now and then to browse the forums and help your fellow developers :-)

Corona SDK Build 484 Released Yesterday

This is a truly monumental Corona SDK release, which brings the latest stable version to build 484.

There’s no need for me to describe all the new additions/fixes—you can read about them all here:

One thing that’s not mentioned on that page, however, is the fact that this release also supports fast-app switching (!!!). That means when you press the home button, get a phone call, or switch out of your app in any way, when you go back into your app, it’ll resume right back where it left off.

But in order to take advantage of that new feature, you must be sure to add this to your build.settings file:

settings =
    iphone = {
        plist = {
            UIApplicationExitsOnSuspend = false


My New Twitter Account: @jonathanbeebe. Since I mostly tweet about Corona SDK and mobile development, I figured I should have a more fitting twitter account (instead of using @beebegames for everything).

Follow me at my new account @jonathanbeebe

My old twitter account is still active, but it will now be used for Beebe Games-related things from now on.

Special thanks to everyone who follows me on twitter. Also, don’t forget to follow my wife, @BiffyBeebe, she’s by my side throughout this entire mobile development journey.

My Thoughts on Capacitive "Hardware" Buttons

There have been supposed leaked images of the next generation iPod touch (5th), which show a capacitive home button, meaning the button is like many Android phones where you can’t actually push it—it’s touch sensitive like the rest of the screen.

Personally, I like how the home button is on current iDevices.


I hardly ever—if ever—accidentally push the button when playing games or when I’m in an app.

On my Android phone (Galaxy Fascinate), I’m always accidentally pushing the capacitive buttons—especially in games that are oriented horizontally.

I couldn’t imagine going through that in iOS with apps that don’t support fast-app switching—the annoyance is bad enough even when apps can just bounce back into place (as with pretty much any Android 2.2 app).

So when it comes to capacitive home buttons (or any buttons that are usually hardware buttons)… my vote is a big fat NO.

Corona SDK Banners for Your Website. Just added to my site.

Help spread the word about Corona SDK—the world’s best software development kit for iOS & Android—by adding one of their banners to your website.