Rogue

Apr 172014
 

In October we started on a new project for iOS. This is a much bigger project in scope than our prior mobile apps, so we wanted a better way to manage our development than what we had with Ansca’s Corona SDK. There are a number of choices available today, and a LOT of them are free and Open Source. Compare that to a closed source SDK like Corona and it was a no brainer that we would move to something else.

Yes, the Corona SDK is LUA based and therefore extensible (mostly by the community), but that doesn’t help you when you need to access a Native API that Ansca didn’t feel was important enough to provide with their SDK. The functionality that you get with Corona is pretty good for the price, but if you want to do more than what it provides you have to spend $3000 on their “Enterprise” solution and that model only works for large developers, not the indie crowd.

The Pros and Cons of using Cocos2d-x

On the plus side, Cocos2d-x is open source, c++ based, and pretty easy to learn. You can using nice development tools like Visual Studio and do most of your development on a PC and then deploy your builds from your Mac. Or, if you have a little extra time to figure it out, you can use Marmalade with Cocos2d-x and deploy your apps right from your PC. How cool is that? Cocos2d-x has online documentation, but that is both a pro and con. The class hierarchy is all laid out nicely.

On the negative side, Cocos2d-x is a framework. That means a lot of things like IAP and Social Network integration are left to the developer. There is a decent community for Cocos2d-x and sometimes people share their code, but forum questions don’t seem to be actively responded to. That is just my initial experience with the forums, so it may change as I take the time to help other developers and get some assistance in return. The negative part of the Cocos2d-x documentation is that the online Reference pretty much is nothing more than a class hierarchy. I really don’t understand this since the .h files all appear to use Doxygen style comments, so it would have been very easy to have that put into the online documentation. Instead, if you want to know what a class does, or how a method works, you have to go to the .h file and read what is there, and if that isn’t enough go to the cpp file and figure out what the method is doing.

Using Cocos2d-x

Despite my comment in the Cons section that Cocos2d-x is just a framework, it is a pretty nice framework. In my next blog I will discuss getting started with Cocos2d-x and show how to write a simple app.

 Posted by at 4:53 pm
Oct 132012
 

My apology for taking so long to complete this two part post. I’ve been consumed with a large mobile project for the past few months.

As you can probably guess from the title of the post, the new project was developed with something other than Corona. Before I talk about what we are using now for mobile development, I’d like to make a few final comments about Corona.

Due to the issues I mentioned in Part 1, and because we needed more control over features, integrating third-party SDK’s and shipping on time, we opted to switch to Cocos2d-x. More about that later; I’m just mentioning that to lead into my point about Corona. We had effectively stepped away from Corona a few months ago, but then a situation arose with our Nook builds.

Nook is about to release their new HD and HD+ devices and were asking developers to resubmit their apps for approval on those devices. Because we hadn’t touched our 4 stand-alone Nook apps in months, it meant that our only option to get the resubmitted in a short time frame was to use Corona; we hadn’t taken the time to port them over to Cocos2d-x [yet!]. So a quick build of the four apps and I resubmitted them to Nook. There wasn’t much else I could do since the hardware is’t yet released (November is the target street date).

About a day later I got an email from Nook letting me know that all 4 apps were rejected due to DRM. I was clueless what this meant since we don’t use any DRM other than what Nook adds to our apps. I got on the Nook Developer forum and posted a query about the reason for the rejection. Two days later and I still didn’t have a response on the forum other than another user mentioning that he was rejected for the same reason so I opened a support ticket.

It took a day, but I finally got a response from my support ticket saying to use the error code in the email. About the same time I received a new email from Nook elaborating on the reason for the DRM rejection. The only problem was, they just said “refer to the error table below” and the error code they gave me was still “DRM” which wasn’t in the error code table. *sigh*. A little after that I received a comment from Tom Chavez at Nook. He said something like “you wouldn’t be using Corona, would you?” He commented further that “…CoronaSDK is doing something at load time that isn’t allowed”.

About the same time I got that from Nook, I read Walter Luh’s post saying that build 925 would fix submission issues for Nook. I immediately downloaded CoronaSDK build 925, built my apps and resubmitted them. They were rejected again. Turns out that despite what the blog post said, you need CoronaSDK build 927 or later to pass submission. Sounds, like that would end my submission woes, right? Wrong.

My submission was rejected again due to “The user interface of your app is not appropriately scaled for the Nook family of devices and their displays”. Since I had no idea what they meant and the only change was moving to the new CoronaSDK, I (incorrectly) assumed it was another Corona issue. Since I couldn’t get any useful info from that rejection reason and Nook doesn’t allow you to just respond to the reviewer and ask a question, I resubmitted again and in the submission test notes I asked “can you please be specific what about the user interface is not scaled?” This got me a quick rejection, but with the additional info I needed.

It turns out that Nook is now VERY picky about apps using Letterbox. Except for some specific exceptions (video players, etc), you can no longer use letterbox with your apps and expect them to pass. Obviously this has nothing to do any bugs or problems with Corona, so I looked at my options for scaling and found a post on the CoronaLabs Forums by Joshua Quick saying that they had just found out letterbox based apps would be rejected and the ONLY acceptable mode would be zoomEven (in your config.lua file). A quick test using zoomEven showed how horrible a choice that was. Everything on the top and bottom of my landscape based app was cut off. Since there is where the HUD elements are, this was not an option.

As bad as it looks to change the aspect ratio, my only solution to let the user see all of the content and still pass Nook’s new UI standards, was to switch to zoomStretch. Seems like a trivial fix despite the odd aspect ratio, right? Not using Corona! Why? Because you cannot determine that it is a Nook based device. Sure you can use system.getInfo(“model”) and look for certain strings like “BNTV200”, “BNRV200”, “BNTV250”, “BNTV250a”, etc. that only works for the model codes people have figured out. Since the Nook HD and Nook HD+ are not yet released, there is no safe way to know the model string for those devices. This means you cannot easily add if/then/else statements for nook, ios, etc.

This shortcoming has been a problem for as long as I have been using Corona. I provided a SIMPLE solution for Ansca (I mean CoronaLabs) to solve this issue about 6 months ago, but still nothing. All they have to do is add a system.getInfo(“buildPlatform”) function and you would know you are building for iTunes, Nook, Amazon, or generic Android. Basically some way of knowing what market you were building for. This would have allowed all of this to be controlled from within my config.lua. Instead I had to find my own work-around to get around the limitations of Corona.

These types of problems (along with those mentioned in Part 1) are the main reasons that I have decided to move away from Corona. Of course when moving away from one thing, you have to move toward another. The criteria I used to choose a new engine was pretty straightforward. I needed

  • Cross-platform support for iOS, and Android
  • Able to use development tools on either Mac or Windows machines
  • Complete source code provided – Open Source preferred
  • Ability to integrate third-party SDK’s
  • Road map updated regularly
  • Full transparency on bug fixes
  • C++ preferred

I had heard great things about Cocos2d, but it was just for Mac/iOS. This meant it would be problematic to use it on a Windows machine. However, there was a C++ version of Cocos2d called Cocos2d-x. I found that it matched all of my requirements so we gave it a try on a much more ambitious project. Other than the initial learning curve, I have to say that Cocos2d-x was an awesome choice! We plan on converting all of our other apps to Cocos2d-x soon, and resubmitting them with some extra features we couldn’t get in using Corona.

I will write a number of posts about Cocos2d-x when I have time. Just as I had done with Corona, I plan on sharing what I have learned about Cocos2d-x so other people can leverage off of that. Hopefully other people will do the same and we can continue to build the Cocos2d/Cocos2d-x community.

P.S.: Like this article?! Want to support?! Be free to donate with bitcoins! 19r39vr2zs14aHW6DMNtPjmRga9xERQTTP

May 232012
 

We recently started on a fairly large mobile app. Our previous apps have been written using Ansca’s CoronaSDK (http://www.anscamobile.com/). For the most part Corona has met our needs, however recently we have had a lot of issues with stability. These issues have caused some negative reviews in the iTunes App Store. Also, there are some other features we would like to take advantage of that Corona does not currently support and may never support. There is no clear timeline for upcoming features.

Stability Issues
Some of the stability issues in the past few months include:

  • Full Screen Inneractive Ads lock up the app. This was recently fixed, but I reported this back in January. It is now May. Given that Ansca and Inneractive have both pushed using the Inneractive ad system since it was first introduced, you would have thought that this would have been a high priority bug to fix and not one that took 5 months to address.
  • Nook Color crashed at start up. Fixed in Build 819, but all that was required was a simple regression test to know it was broken. Read more here.

Additional Features Needed
These items really aren’t anything to complain about since there are plenty of apps that have no need for the same things we do, but for us these are issues worth noting:

  • LUA modules cannot be placed in sub folders
  • Texture memory is not optimized
  • Unable to extend the Corona API

LUA modules cannot be placed in sub folders
One of the key elements in our upcoming app is that it is essentially a collection of games in a single app. This means a LOT of assets, and a lot of different code modules to handle each games logic. Currently Corona does not support putting lua files in sub folders for all target devices. I’ve had success getting that to work on iOS devices, but it fails miserably on Android devices.

Texture memory is not optimized
Another issue with Corona has to do with texture memory. Corona uses one of two functions to load a texture:


-- Assume the image is 1024x768 and we want to display it
-- on a 480x320 device

local image1 = display.newImage( "image1.png" )
image1.scaleX = 480/1024
image1.scaleY = 320/768

local image1 = display.newImage( "image1.png", 480, 320 )
-- no need to scale since that is what the two params did,
-- BUT it still takes the same memory as the first call

In both cases the memory that the system will use for the texture is 1024x768xdepth. Ideally, we would want the second version to only take up 480x320xdepth bytes. This would mean we could have ONE high resolution image and use it on all platforms. Yes, we can do that now, but on the low resolution devices it will take the same amount of in app memory as the high resolution devices. This means that we have to create separate versions of the art for each resolution we want to support in order for the game to fit into memory. I really do not understand why they implemented it this way when all that had to be done was load the image into memory, resize it in code, then use the resized image for the actual texture display memory.

So the way we handle it is to create low, medium and high resolution versions of most images and put those in folders named “low”, “medium” and “high”; and a few we just have one version and dump those in a “common” folder.

Corona has something similar with their dynamic content scaling solution. However, this doesn’t address the texture memory issue, nor the bloat that comes from having to have multiple versions of key images.

With a proper load function we would be able to just have a common image and use it for whatever resolution we want by dynamically scaling the width and height for the actual device display resolution. Nice and memory efficient and we don’t double our APK or IPA size with copies of assets at different resolutions.

Unable to extend the Corona API
This issue along with the stability problems are probably the biggest reasons to consider moving away from Corona. Because Corona is not open source, we have to way to add features using platform API’s. I realize that is probably not the typical use of Corona as it was really targeted for Game Designers and not Game Programmers.

It would be fine if the community could request a feature and have a reasonable expectation that Ansca would add it to their API, but something as simple as pixel access to textures is still not in Corona and people have requested it for over a year.

Part 2 coming soon

P.S.: Like this article?! Want to support?! Be free to donate with bitcoins! 19r39vr2zs14aHW6DMNtPjmRga9xERQTTP

 Posted by at 2:28 am
May 152012
 

I’ve been using Ansca’s Corona SDK for almost a year. I made the decision to use Corona because it allowed rapid development via Lua, and the SDK met almost all of my needs at the time I chose it.

I’ve made numerous contributions to the Corona Community, and even donated my time in solving other people’s issues. Because of my strong belief in the SDK I signed up to be a Corona Ambassador.

Over the past few months something has become painfully obvious to me and a number of other Corona developers. Corona just doesn’t have the support it should. The software development process is flawed and because of this they keep pushing out Daily Builds that are buggy and cause any of a number of issues for developers.

Just go into the Corona Forums and you will see what I mean. One common thread goes something like this:

“I’ve had lots of problems with Corona. I write up the issues on the Forums and hear nothing back from Ansca. If I do get support it’s almost always from another developer who has gone down the same road and run into the same issue. It seems like the community is figuring out solutions to more of the problems than Ansca is. What gives?”

The above isn’t an exact quote, but it is a compilation of a number of complaints developers have had. As a Corona Ambassador I try and jump in and solve the issue whenever possible, but that doesn’t work when it is a fundamental issue with Corona.

For instance, recently I submitted 3 apps to the Barnes and Noble Nook store. All 3 passed for Nook Tablet, but all 3 were rejected for the Nook Color. I searched high and low for differences between the platforms, but other than the Color having half the memory of the Tablet and some differences in the video card and clock speed, they are supposed to be identical. Our apps only use 80MB of memory so it shouldn’t have been due to memory. After spending days trying to figure out what might be happening, I contacted Ansca and asked them about any issues they might know regarding the Nook Color. This was Ansca’s response:

yes we are aware of this issue. We think it’s due to some rendering changes a week ago on Android

On the one hand, I was glad to hear it was a known issue. However, why didn’t they post something in the Corona Developer Forum letting people know to hold off on Nook Color submissions? I mean really, if you know there is an issue, then why keep it a secret?

One typical response goes something like this: “the daily builds are NOT stable and we make that very clear”. Sure, that is very true. However, since the stable builds only come out a few times a year, and because there are KNOWN crash bugs that have been fixed ONLY in the Daily Builds what is a developer to do? What until the next stable build? That could be weeks or months away and we have no idea when it will occur.

Here’s another example of the instability of Corona. We recently submitted 3 apps to iTunes. All 3 were accepted and are now available in the iTunes store. Almost immediately we started getting complaints in our reviews from users that the game wouldn’t load. These negative comments materially affect our business. Having people make comments that our games are crap or that our company sucks is NOT good for business.

So we posted an update to our description asking people who experience the problems to let us know what device and OS they are using. The response so far is iPhone 4, OS 5.1.1. Of course we had tested on this device, but we believe the user is having an issue so we do some more testing. Our app runs fine for us. If you know much about software development then you can probably guess that the issue is almost certainly an uninitialized variable. That would cause it to work fine sometimes and not other times.

Guess what? Any uninitialized variables have to be in the Corona SDK as it uses Lua for the developer coding and Lua sets all variables to “nil” unless you explicitly set them to some other value. That means that our code will run the same way from one run to another, unless you are past the load and into the game where random numbers get used. Since the app just gets a black screen at start-up for the user, it is clear this is not in our code, but something in Corona.

Ansca, PLEASE fix these issues. PLEASE stop with the Daily Unstable Builds. PLEASE put out regular stable builds every 2 weeks, every month, whatever period works for your team size.

I want to continue using Corona as it is a very nice solution when it works. However, if these issues aren’t resolved soon I will be forced to move to another SDK (and there are a number of them now).

P.S.: Like this article?! Want to support?! Be free to donate with bitcoins! 19r39vr2zs14aHW6DMNtPjmRga9xERQTTP

 Posted by at 5:32 pm
Oct 132011
 

This example demonstrates a progress bar that updates while assets are being loaded.  The typical use is when your assets are large enough that the user might think your app has frozen if there isn’t some sort of feedback.

A few notes about the code below:

  • Because of the way that the Corona SDK scopes modules, I chose to have a global “World State” variable declared in main.lua so I can share values between modules. The name I chose for that variable is: gWS.  So if you see values prefaced with “gWS.” they are global values declared in main.lua
  • The gWS.nScaleX and gWS.nScaleY values are used to let me switch devices and have everything scale properly.
  • This example uses the “ui” and “director” modules from Ansca (included in the complete code on GitHug
  • The code is under the MIT license so feel free to use, modify, etc the code to your hearts content.

You can get the full source code along with assets from GitHub here

---------------------------------------------------------------------------------------
-- Date: October 12, 2011
--
-- Version: 1.0
--
-- File name: cSceneLoad.lua
--
-- Code type: Example Code
--
-- Author: Ken Rogoway
--
-- Update History:
--
-- Comments: The space images used are from NASA and are in the public domain.
--           The horse image sheets are from the horse demo provided by Ansca.
--
-- Sample code is MIT licensed:
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal
-- in the Software without restriction, including without limitation the rights
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:

-- The above copyright notice and this permission notice shall be included in
-- all copies or substantial portions of the Software.

-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-- THE SOFTWARE.
--
-- Copyright (C) 2011 Ken Rogoway. All Rights Reserved.
---------------------------------------------------------------------------------------

module(..., package.seeall)

local bUseListener = false
local nMeterX = 272     -- final X position of the meter bar when at 100 percent
local nMeterY = 562     -- Y position of the meter bar
local nMeterW = 480     -- Width of my meter bar image
local nMeterH = 30      -- Height of my meter bar image

-- This is set to 1/2 second (500 ms) so let it go slow enough to
-- see the bar advance since we are using a very small set of data
-- You would want to set this to a much smaller value, so there is
-- minimal delay between chunks, but probably at least 1/30 of a
-- second (33 ms) so there is time to update the display.
local nDelayBetweenChunks = 500

-- Main function - MUST return a display.newGroup()
function new()
    local splashGroup = display.newGroup()
    local loadingImage, loadingBar, loadingMask

    loadingImage = display.newImageRect( gWS.pImageDir.."load_bkgd.png", display.contentWidth, display.contentHeight )
    splashGroup:insert( loadingImage )
    loadingImage.x = display.contentCenterX
    loadingImage.y = display.contentCenterY

    loadingBar = display.newImageRect( gWS.pImageDir.."load_bar.png", math.floor( nMeterW * gWS.nScaleX ), math.floor( nMeterH * gWS.nScaleY ) )
    splashGroup:insert( loadingBar )

    loadingBar:setReferencePoint( display.TopLeftReferencePoint )
    loadingBar.x = math.floor( (nMeterX-nMeterW) * gWS.nScaleX )
    loadingBar.y = math.floor( nMeterY * gWS.nScaleY )

    loadingMask = display.newImageRect(	gWS.pImageDir.."load_mask.png", display.contentWidth, display.contentHeight )
    splashGroup:insert( loadingMask )

    loadingMask.x = display.contentCenterX
    loadingMask.y = display.contentCenterY

    -- Update the percent complete bar
    function updateBar()
        local nPercent = math.floor( 100 * (gWS.nLoadIndex-1) / gWS.nLoadCount )
        --print( "Percent = ", nPercent )
        loadingBar.x = math.floor( (nMeterX-nMeterW + (nMeterW*nPercent/100)) * gWS.nScaleX )
        if ( nPercent >= 100 ) then
            -- final resting place at 100 percent
            loadingBar.x = math.floor( nMeterX * gWS.nScaleX )
        end
    end

    function myLoadChunk()
        -- Load a chunk of data
        gWS.pAssetLoader.LoadChunk()

        if ( bUseListener == false ) then
            -- update the loading bar.  See the comments above
            -- regarding using a event to trigger this
            updateBar()
        end

        -- Are there any chunks remaining?  If so, set a timer to
        -- load the next one.
        if ( gWS.nLoadIndex <= gWS.nLoadCount ) then
            timer.performWithDelay( nDelayBetweenChunks, myLoadChunk )
        else
            -- Done, so finish any data stuff
            gWS.pAssetLoader.Shutdown()

            if ( bUseListener == true ) then
                Runtime:removeEventListener( "enterFrame", updateBar )
            end

            -- Onward and outward
            director:changeScene( "cSceneGame" )
        end
    end

    -- Set everything up so we can start going
    gWS.pAssetLoader.Initialize()

    updateBar()	-- update it once for 0 percent

    -- Start it going
    timer.performWithDelay( nDelayBetweenChunks, myLoadChunk )

    if ( bUseListener == true ) then
        Runtime:addEventListener( "enterFrame", updateBar )
    end

    clean = function()

        if loadingImage then
            display.remove( loadingImage )
            loadingImage = nil
        end

        if loadingBar then
            display.remove( loadingBar )
            loadingBar = nil
        end

        if loadingMask then
            display.remove( loadingMask )
            loadingMask = nil
        end
    end

    -- MUST return a display.newGroup()
    return splashGroup
end

 

P.S.: Like this article?! Want to support?! Be free to donate with bitcoins! 19r39vr2zs14aHW6DMNtPjmRga9xERQTTP

 Posted by at 5:50 am

Please excuse my mess

 Uncategorized  Comments Off on Please excuse my mess
Oct 132011
 

For some reason my prior install of WordPress stopped working. I could see the blog entries, but couldn’t log in or admin the site.  Rather than wait on my ISP to update the version of PHP to something more recent, so I could reinstall the latest WordPress, I decided to use my ISP’s idiot proof installer to redo my site.

After getting the site set up, I had to go into my MySQL database for the prior blog entries and copy them into this new site.  Unfortunately this resulting in my site having a couple of the blog entries in the wrong order.  Everyone knows that “Hello World” should come first.

So please excuse my mess as I try and get things up and running again.

P.S.: Like this article?! Want to support?! Be free to donate with bitcoins! 19r39vr2zs14aHW6DMNtPjmRga9xERQTTP

 Posted by at 3:41 am

iPhone – Why do you taunt me?

 Rants and Ramblings  Comments Off on iPhone – Why do you taunt me?
Oct 132011
 

Overall I love my iPhone. Almost all of the features you’d want in a phone are there, and the User Interface is intuitive and easy to learn. However, there are some things that Apple just doesn’t seem to understand. For me, most of these issues revolve around their email application.

Pop Email Hell

If you have had your email account for more than a few months you get Spam. I get 400+ Spam emails a day. If I turn my ISP’s automatic Spam filter to be more aggressive to reduce the emails in my Inbox, then it also tosses important emails. Sure I could go in and check my web mail spam folder every day, but I don’t always have web access throughout the day. This results in getting a LOT of emails on my iPhone for my personal email account.

Since I get a lot of mail, once I have scanned it I want to be able to select all of the messages and delete them. You’d think that Apple would have a “Select All” feature. Nope! This means I have to select each email individually. Annoying and a waste of time; especially if I haven’t checked mail in a while. However, even MORE annoying than having to select each email so I can delete them, is the bug where your selected mails spontaneously deselect! So I have just selected 30+ emails and am about to press Delete, when BAM! they all deselect. This happens randomly, with no pattern that I can discern.

I don’t recall seeing the deselection bug happen prior to iOS 4.2. Apple, can you fix these two items? Surely you have people smart enough to address these bugs/features? If not, I am willing to volunteer my time (for free) to help you address these items.

While I am on the topic of the iPhone, can anyone tell me why you cannot end a call by pressing the big red “End” button? Yes, it works most of the time, but about 20% of the time I press the End button and it doesn’t hang up. So I press it again. Still no disconnect. I press it again and again. No luck. Then 10-20 seconds later it hangs up on it’s own. Maybe the Apple engineer that wrote the code to handle the End button wanted to write a game and wasn’t allowed to, so he made hanging up a game; albeit a lousy and frustrating game.

Apple, if I press the button, I see it depress, then PLEASE hang up the phone! If you need help, the offer I made above for your email bugs applies to this as well.

P.S.: Like this article?! Want to support?! Be free to donate with bitcoins! 19r39vr2zs14aHW6DMNtPjmRga9xERQTTP

 Posted by at 3:22 am

printf( “Hello world!” );

 Uncategorized  Comments Off on printf( “Hello world!” );
Oct 132011
 

“Hello World” is an apt title for my first blog post. Typically when you are learning a new programming language you start with a trivial application that outputs the message “Hello World” and since a person’s first blog post tends to be perfunctory it seems appropriate to leave the post with that title.

Let me introduce myself. My name is Ken Rogoway. I have been programming professionally for almost 30 years. The majority of that time has been spent writing video games, but I have also developed software for industries such as: insurance, audio processing, project management, biomedical and video processing for golf training. Currently I am developing casino games for the Class II and Class III markets.

I have a game centric biography on Moby Games that can be found here. My LinkedIn profile can be found here. Currently I am the Principal Engineer and Studio Director at a small casino development company.

The purpose of this blog should be fairly self evident based on the domain name. However, for those of you that prefer a written explanation, I decided to create this blog to discuss anything that comes to mind; whether or not it is programming related. In general I will tend to keep to technical issues, but as often happens in blogs I may digress into more personal and mundane topics from time to time.

P.S.: Like this article?! Want to support?! Be free to donate with bitcoins! 19r39vr2zs14aHW6DMNtPjmRga9xERQTTP

 Posted by at 3:17 am
Oct 132011
 

I wanted to work on an iPhone/Android port of Arrow Antics; one of my older games. The original game was written using SDL, but the current state of SDL 1.3 is still a bit flaky and not ready to release products with.

I started looking at various 2D iPhone solutions. The two most popular 2D iPhone SDK’s appear to be Corona by Ansca, and Cocos2D.

Cocos2D
Cocos2D has an Objective-C based API. Personally, if I wanted to use Objective-C I would just code directly to the iOS SDK. However, for less experienced programmers there is a lot of value in not having to write the functionality included in the Cocos2D SDK. So, for me, I quickly ruled out Cocos2D.

Corona
Corona SDK is a Lua based solution that supports iOS based apps (iPhone/iPad) and Android based apps (Droid, NexusOne, myTouch, GalaxyTab). Since all of the app logic is written in Lua, it is a “write once, run anywhere” type solution; at least for iOS and Android based systems.

Corona Pros
Obviously the biggest strength of Corona is that it is a cross platform solution. If you are only targeting iOS then you can go with the iOS SDK or Cocos2D. However, if you think that you might want to deploy your app on other platforms then you will want a solution like Corona. There are a lot of nice features that Corona supports, including physics using Box2D, Facebook Connect, OpenFeint support, and most importantly native device features.

Corona Cons
The most obvious drawback to Corona is the lack of a UI Layout tool. If you want to place images, buttons, widgets, etc on the screen you have to do it all in Lua like this:


local helpGroup = display.newGroup()
local backgroundImage = display.newImageRect( "Background.png", 480, 320 )
backgroundImage.x = 240; backgroundImage.y = 160
thisGroup:insert( backgroundImage )

Sure, this is only a few lines of code. However, it means you have to do something like this for EVERY display object in your app. Why not have a layout tool that writes out a layout file in XML or JSON? Then for each screen in your app you could just load the data file and it would create your display objects and add them to the display group.

Conclusion
I will no doubt find other strengths and weaknesses with Corona as I continue the port of Arrow Antics. Look for more info soon.

P.S.: Like this article?! Want to support?! Be free to donate with bitcoins! 19r39vr2zs14aHW6DMNtPjmRga9xERQTTP

 Posted by at 3:15 am