Performance and z-index

Hi!

I am currently creating a game in MOAI SDK, but I am thinking about changing back to Corona which I used to use a couple of years ago. Therefore I have a few questions before I possible change. It is  a pixel art, platform/adventure game by the way.

How is the performance when you have a lot of objects? Some levels has in the 2000 range number of objects. I also program my own “physics”. What kind of frame rates can I expect it to handle?

Another thing that MOAI solves very elegantly which I have not found I good substitution for in Corona is z-indices, which objects are drawn on top. I know about display groups in corona, is the best way to solve it just creating a lot of groups and sorting inside them? Are groups expensive when it comes to performance?

Lastly how do you deal with resource loading. Do you load everything beforehand? Do you create objects etc. while moving around the level?

:smiley: that’s a lot of questions in one post, so expect abbreviated answers.  (and the answers would be basically the same no matter which engine you choose, just slight differences in implementation)

more objects = more performance hit, but there’s no single magic number.  it will vary on your usage and target device.  only actual device testing will reveal how many is too many.

groups can be used to z-sort, but you can also sort your sprites as desired then :toFront() them in order within a single group.  if you have a forced-perspective, where increasing y directly implies z, then you can precreate an array of groups for each scanline, then somthing like:  zgroups[math.floor[sprite.y]]:insert(sprite) or such.  groups are more commonly used for “overall” depths (fe: ui layer is above sprite layer, which is above tile layer, which is above background layer, etc)

it’s best to preload/precreate as much as possible, you don’t want “resource activity” interrupting your game loop.

Hi @pfeiring,

Welcome back to Corona! As you mention this as a “platform/adventure game”, you may want to explore either the “Dusk Engine” or “Million Tile Engine” for Corona SDK, one of which could be a very smooth path to getting your game converted over to Corona.

Dusk:

http://gymbyl.com/programming/dusk.html

MTE:

http://forums.coronalabs.com/topic/33119-million-tile-engine-beta-release/

I can’t provide details or feedback on which one would be more suited to your game, but go ahead and search the forums for these topics and see what current/previous users recommend.

Take care,

Brent

:smiley: that’s a lot of questions in one post, so expect abbreviated answers.  (and the answers would be basically the same no matter which engine you choose, just slight differences in implementation)

more objects = more performance hit, but there’s no single magic number.  it will vary on your usage and target device.  only actual device testing will reveal how many is too many.

groups can be used to z-sort, but you can also sort your sprites as desired then :toFront() them in order within a single group.  if you have a forced-perspective, where increasing y directly implies z, then you can precreate an array of groups for each scanline, then somthing like:  zgroups[math.floor[sprite.y]]:insert(sprite) or such.  groups are more commonly used for “overall” depths (fe: ui layer is above sprite layer, which is above tile layer, which is above background layer, etc)

it’s best to preload/precreate as much as possible, you don’t want “resource activity” interrupting your game loop.

Hi @pfeiring,

Welcome back to Corona! As you mention this as a “platform/adventure game”, you may want to explore either the “Dusk Engine” or “Million Tile Engine” for Corona SDK, one of which could be a very smooth path to getting your game converted over to Corona.

Dusk:

http://gymbyl.com/programming/dusk.html

MTE:

http://forums.coronalabs.com/topic/33119-million-tile-engine-beta-release/

I can’t provide details or feedback on which one would be more suited to your game, but go ahead and search the forums for these topics and see what current/previous users recommend.

Take care,

Brent