Deciding on Corona

Hi,

I’ve been spending the past couple of weeks looking at different cross-platform development systems and I think I’m close to deciding on Corona. Bit of background, I’m coming from developing for iOS using cocos2d. Anyway, I’ve taken the code for a tutorial (Fat Freddy for those interested, a nice starting point) and basically taught myself Corona (and Lua as it happens) from pulling it apart, extending and playing around with that over the last few days.

What I’ve found, however, is that I’ve come across a number of issues with Corona where it doesn’t operate or provide facilities that I’d really consider standard. Despite searching these forums a lot recently, I haven’t been able to find answers to them. These are:

  1. Z Ordering. There seems to be no built in support for z ordering, which I’ll be honest seems like it should be a basic. Am I just missing something (more than possible) or is there no real z ordering support in Corona, save for removing, sorting and re-adding objects to the view manually?

  2. Packed textures. I’ve been using TexturePacker for a while and I see support for it for sprite sheets specifically with functions just for animating frames. This seems strange, I’m used to packing pretty much all static images into textures which is much more memory efficient. Fortunately I have come across SpriteGrabber which provides this functionality but is there something in the core of Corona now that does away for the need for that? Otherwise, I’ll basically use SpriteGrabber and extend it to deal with different res packed textures for different devices.

  3. On textures again, am I right in thinking that Corona loads everything into memory as 32-bit textures? cocos2d had a nice trick that allowed you to change the texture mode before loading a texture into memory so where 32-bit wasn’t needed, you didn’t have to gobble up more memory than you needed. Again, am I missing something in Corona that provides similar functionality? When dealing with mobile devices, with restrictive memory, this really does seem like a needed facility.

  4. Audio. Admittedly I haven’t looked into this in detail, but is there no audio panning for sound effects? I’d kind of expect this to be in the audio.play() function call but I can’t see reference to it in the API docs.

  5. Content clipping. This was actually an issue with cocos2d as well, but there was a third party ClippingNode class that was released that provided a solution to it. Basically, is there any built in way in clipping the contents of a group to a given rectangle, so anything in the group outside this will not be displayed. From reading on the forum, it seems like masks might be the way this is done but that seems quite wasteful in terms of texture memory.

Anyway, I’d appreciate any feedback or help on the above points. It’s more than likely that I’ve missed some obvious things (there’s a lot to go through here). I’m really liking the speed of development with Corona (especially using the Corona Project Manager) but coming to an essentially closed development environment where you can’t just break out at a lower level if needed, I’m a bit concerned about coming across problems that I simply won’t be able to find a solution for unless Corona has the facility added in.

Cheers,

Gareth [import]uid: 115159 topic_id: 20463 reply_id: 320463[/import]

I can’t answer most of these questions, but on the Z-ordering issue, you can when inserting an object into a group, set its index.

There are also .toFront() and toBack() methods which can also be used.

But moving things up and down in a display group is a bit more tedious. Hopefully one day we will get up and down functions.

[import]uid: 19626 topic_id: 20463 reply_id: 80208[/import]

Ah, thank you for that. That makes things a little more manageable I guess, although it looks like I’ll still need to do some manual removing and inserting to change orders if needed. I think out of all my points (well, maybe apart from audio panning), this seems like the biggest omission currently from Corona, for me anyway. I’ll be working later this year on a project that is isometric at its heart, and changing ordering is something that I’ll have to a lot of there. I’m a little concerned at the potential overheads of removing and inserting to achieve this in that scenario. [import]uid: 115159 topic_id: 20463 reply_id: 80216[/import]

You don’t have to remove first just reinsert into group or another group and it’s automatic removed from its original position [import]uid: 7911 topic_id: 20463 reply_id: 80227[/import]

Audio pan not in the API but there is a work around
http://blog.anscamobile.com/2011/07/the-secretundocumented-audio-apis-in-corona-sdk/ [import]uid: 7911 topic_id: 20463 reply_id: 80231[/import]

Thank you for that, I was looking at that audio post a little earlier (just happened to find a link to it from somewhere else, as I’ve found most things here to be honest). The problem with that is it’s unofficial and could be removed at any time (the devs even say that in their disclaimer). In a closed system such as Corona that sends alarm bells ringing for using it as I’d be left high and dry if they actually did remove it.

Honestly, panning should be in as standard - that’s a pretty big basic omission on audio. I simply can’t understand why it’s not already implemented.

This is kind of what’s really worrying me about investing in Corona (not just in money but mainly in development time and going down a dead end). After only a few days with it I’ve come across some areas that are lacking fundamentals, and I’m only scratching the surface. I’m concerned I’m going to find lots of other areas that aren’t going to be easy to deal with.

It’s definitely the more rounded cross-platform option of the ones I’ve tried in the past few weeks, but it’s also the most closed. [import]uid: 115159 topic_id: 20463 reply_id: 80233[/import]

I understand but since this has been left for a couple releases and a lot of daily builds I don’t see them removing it without havering a built in API option [import]uid: 7911 topic_id: 20463 reply_id: 80234[/import]

For packed textures, I thought we supported Zwoptex and TexturePacker. I think it can be (ab)used for non-animations, though don’t quote me on that.

For texture formats, currently we only support 32-bit RGBA. So far our user base has pushed us on the quality side. They were able to spot bugs/limitations on the Android side that was down-converting to 16-bit and we were getting demands to fix that because most of our users have really sharp eyes for this kind of thing. We recently fixed that (assuming a new enough Android version and display hardware that actually supports it). We are interested in other texture formats, but I can’t give you a time table on that.

For clipping, masking is probably the best approach for now. General purpose clipping in OpenGL is actually kind of tricky/hard.

For audio, there are several different issues you’ve touched. First, just getting high performance audio to work correctly has been a challenge. Android audio is the pits, particularly before Android 2.3. iOS is much better, but iOS 5.0 is a perfect case study where Apple accidentally breaks something and we spend an enormous amount of time trying to work around it.

As for the secret audio APIs, while we could theoretically remove it, I think there are only two realistic scenarios that would happen. 1) If we roll out officially supported APIs in which case we ask everybody to migrate (the secret API binding is currently small so we would probably leave it in for awhile) or 2) if it was crashing. But in that case, it wasn’t useful in the first place because it didn’t work. As I understand it, there are already shipping apps that use pitch shifting and maybe some positional audio.

Finally ‘panning’ actually is actually a myopic view of an effect. OpenAL gets it right in that panning is just a subset of positional audio. Left/right forgets front/back/up/down. And if one argues that nobody cares about those directions, then it also must be argued nobody on mobile devices really cares about left/right because most mobile devices only have a single/mono speaker or not enough space to spatialize if they did have multiple speakers.
[import]uid: 7563 topic_id: 20463 reply_id: 80255[/import]

I’ve been using Corona for a few months trying to get a handle on the ins and outs of the API as well as Lua, so this is my perspective:

  1. There is no automatic handling of z-order, and it seems what most people do is remove objects from a display group and re-insert them at an index. Luckily none of the games I’ve been working on really need intensive z-order handling, like you would need in an isometric game for example.

  2. I’ve used spritesheets for holding most of the graphics for a given level just by making sprite animations one frame in length. There was a noticeable speed increase, but I don’t think spritesheets support all of the methods that display objects do, so I couldn’t pack everything into one texture. I also did this only using the spritesheet API, not the spritegrabber helper module. It’s probably more trouble than its worth, so I hope they improve on texture atlasing in the future.

  3. I think the explanation for this is that everything gets converted to 32-bit in the opengl engine anyway, and there’s no way around it.

  4. None that I know of.

  5. What’s the difference, memory-wise, between a clipping node and a mask? The problem I’ve run into with masks is that not all objects support them, and there are limits to nesting et c. that vary across devices.
    Despite some problems I’ve run into, I plan on sticking with Corona. The whole ‘closed system’ thing worried me at first too; I didn’t like the idea of certain hardware features being simplified or locked out completely, but in reality the team is working around the clock to make awesome things available to us every day. Right now I don’t see it as a limitation, but rather as a constraint, and spec my games accordingly. And for small teams looking to release apps on Android, iOS, Kindle, and Nook, what other practical option is there?
    [import]uid: 120 topic_id: 20463 reply_id: 80258[/import]

@ewing Actually, I would find fully positional audio to be incredibly useful to have in Corona, as I have a game design I’d like to execute that relies heavily on it. I figure the user would have to use headphones to play it anyway. [import]uid: 120 topic_id: 20463 reply_id: 80261[/import]

Hi ewing,

Thank you for your reply, it’s nice to get a response from somebody at Ansca.

I think as I already said, I’m aware of the TexturePacker support, but as you say as standard it needs to be “(ab)used” for static images rather than animations. SpriteGrabber makes it easier to use for static images, I was just wondering if there was now a better way built into Corona (as SpriteGrabber appears to be over a year old and not updated since last April).

On texture formats. I have a sharp eye as well (I’m an artist as well as a developer), but there are many situations where 32-bit is not required and helps to limit texture memory used. It has everything to do with what is the most efficient format for a particular purpose, without a noticeable drop in quality. My last app mixed 16-bit and 32-bit as a trade-off to limit texture memory used. I doubt many people would know where I’ve used one rather than the other. I’m not surprised that devs were unhappy about everything being treated as 16-bit on Android - yes, you would notice that as some imagery just would not work well at anything other than 32-bit.

On clipping. Take a look at http://www.learn-cocos2d.com/2011/01/cocos2d-gem-clippingnode/ which added the ability to clip any node in cocos2d. It’s not massively complex and it uses OpenGL. That’s not to say it would be that simple to implement in your code base, I completely understand that, but I’d be surprised if it wasn’t possible. The use of textures to do this, especially as textures are all loaded as 32-bit and I presume (based on my little knowledge of Corona so far) I can’t take a mask from a packed texture, is wasteful.

On audio, whilst I’ve read about Android issues with audio, I’d have to say that your view that on mobile devices nobody cares about positional audio is myopic (to use your word). Are you suggesting that many people don’t use headphones with their devices? I don’t quite follow your line of reasoning there. [import]uid: 115159 topic_id: 20463 reply_id: 80317[/import]

Hi Bryan,

Thank you for taking the time to reply.

  1. Yes, I’m concerned about this aspect as I’ll be producing something isometric later this year. It’s going to be a pig to handle and I wonder about the overheads of reinserting.

  2. I’ll have to check what sprites don’t support, I haven’t looked deeply into the differences yet, so thanks for the heads up.

  3. No, that’s not true. Everything’s being converted to 32-bit by Corona. OpenGL will handle different bit depths (mixed together in the same app, on the same screens).

  4. It appears it can be done with the secret audio APIs so I’ll have to go down that route.

  5. The difference is not having to load a texture into memory, and as Corona loads everything as 32-bit, depending on the size of mask the texture memory consumed could be quite a lot.

I do like Corona a lot. It’s quick to develop with and is fairly bedded in now. Don’t get me wrong, I think Corona is my best bet, I just want to see what the attitude is to the limitations I’ve found in it so far. [import]uid: 115159 topic_id: 20463 reply_id: 80319[/import]

@bryan.vaccaro Thanks for the vote on full positional audio.

@moopf:
TexturePacker: I don’t think anything has changed publicly. Internally, I know there is some activity on improving texture atlases in general, but there is no date on when this will happen.

Clipping: I’m not ruling out glScissor as a future possibility, but glScissor is limited to axis-aligned rectangles. You can’t rotate it or mask arbitrary shapes with it. That is why the current system was implemented. (We got a ton of requests for page curl effects which our current system can solve.)

Positional audio: Your original claim was panning was an obvious omission. I say introducing a neutered panning API we set in stone would be a mistake particularly when we are already built on a full positional audio sound system. Introducing a bad panning API may conflict with future attempts to complete the full positional audio system. We decided to be conservative and not box ourselves into a corner so we could one day roll out something better that wouldn’t necessarily break any thing we’ve already done. The secret audio APIs are our concession that some people want access to these features now.

As for actual use of positional audio, I have been one of OpenAL’s longest advocates and a strong believer in full positional audio. (Some people say I literally wrote the book on OpenAL because I’m the only one who has thus far attempted to write and got published a comprehensive book on OpenAL.) However, antidotally, I see very few users caring about positional audio on their mobile devices and rarely using headphones for gaming on their mobile devices.

[import]uid: 7563 topic_id: 20463 reply_id: 80330[/import]

Hi again ewing, thanks again for replying.

TexturePacker: I’m happy to use something based on SpriteGrabber if there’s nothing better in the core yet. I just didn’t want to alter that for my needs if there’s already a better option. As there isn’t, that’s no problem at all. Better texture atlases would be a big benefit, at present it appears that to do some things you have to use individual image files, which is wasteful for texture memory (unless you’re sizing everything by a power of 2, which is restrictive).

Clipping: Whilst I appreciate that masking gives massive flexibility for arbitrary shapes (and I can certainly see myself using this in some places), I’d be surprised if most people didn’t just want to clip rectangular areas the majority of time, for scrolling areas etc. As it stands it’s wasteful to do this with textures, but if that’s all that’s available then that’s the answer to my original question.

Positional Audio: Yes, panning is an obvious omission. I completely stand by that. I’ve never come across an audio SDK in a development system that actually doesn’t provide basic left/right panning. I’m sure there must be some, but I’ve never used them. It’s strange about headphones, I see people playing games on their mobile devices lots wearing headphones (I do a lot of the time, for instance). But, if the secret audio APIs are going to stick around until something better comes along integrated into the core API, then I’m happy to use them as they provide what I want to use. My concern about using them was just in terms of them being dropped without an alternative being in place.

I really appreciate you taking the time to answer and it’s nice to get a reply from somebody who obviously has technical knowledge as well. Thank you again. [import]uid: 115159 topic_id: 20463 reply_id: 80336[/import]

@moopf: I had mistakenly assumed that you could use vector shapes as masks… hope this is remedied soon as well

@ewing: While I’ve got your attention, allowing developers to set filtering to nearest neighbor is also a must. Not so much for performance, but for aesthetic reasons. [import]uid: 120 topic_id: 20463 reply_id: 80376[/import]

@bryan.vaccaro Would you do me a favor and submit a bug report explaining you want glNearest filtering and why you want it (how you would use this). This will hopefully prevent us from losing track of your feature request and help management decide how to prioritize this feature.
[import]uid: 7563 topic_id: 20463 reply_id: 80769[/import]

I’ve come across another one which is ubiquitous in games that is missing from Corona - the ability to pause/resume a display object. By that I mean pause timers, transitions etc. on an object (for instance a group)

I can’t believe this isn’t in the core already. There aren’t many games without a pause button, so why is it we have to rely on wrapping our own code around everything in order to pause and resume?

I’ve seen a comment on the board from a member of staff that it works better writing your own pause code, and I’m afraid I just don’t subscribe to that at all. Writing your own code to pause transitions, especially ones with easing, is not better nor can keeping track of everything that needs pausing ever be considered easier. Most of the time people don’t need anything other than ‘pause everything on this object’ to facilitate a pause option and it’s something that nearly 100% of developers writing games would need. Whilst I understand it’s not trivial to implement, really in a system that supposedly provides a framework that’s so quick to build in, it should be there.

Is there any chance that this will be coming soon? By that I mean within the next month?

There are some strange design decisions and omissions in Corona. [import]uid: 115159 topic_id: 20463 reply_id: 81652[/import]

+1 for suspend. This would make a nice addition to storyboard, actually.

Now, the way that I’ve architected my projects allows me to pause the entire game with a few lines of code, but those games are relatively modest by any measure. It would still be useful to be able to call storyboard.Pause(), or storyboard.getPrevious().Pause() when displaying a menu overlay.

moopf, I’m going to forecast the next thing you’ll find missing from Corona: virtual camera control. This was probably the most annoying thing I found about making games in Director and Flash, so when I found frameworks like Flixel that included camera control, I didn’t want to go back to creating the functionality from scratch.

The thing about Corona is that it’s not really a game framework like Flixel, not yet anyway. There are a ton of things that you just have to roll yourself. [import]uid: 120 topic_id: 20463 reply_id: 81688[/import]

I am a little worried that no one from Corona said anything about z-ordering in this thread.

Is there anything planned to automate this process for the developer?
[import]uid: 99737 topic_id: 20463 reply_id: 97854[/import]

Hi moopf,

I’m also an artist and I’ve come across the same issues.
I’m still evaluating Corona so I’m wondering why didn’t you stick with Cocos2d if you already have invested time in learning Obj-C, etc?
Is the speed of development the only reason why you want to switch?

The limitations that you have cited also make my development slower : z-sorting, masks and clipping options.
“I had mistakenly assumed that you could use vector shapes as mask”
Same here.

Apart from that I’m very pleased with Corona and several third parties that I own (LevelHelper, Spriteloq, Coronacomplete). [import]uid: 95346 topic_id: 20463 reply_id: 98182[/import]