support for very wide levels, without impacting performance?

Question (or suggestion):

Is it possible to have very large levels without having to worry about performance/memory?    Let’s say it’s a horizontal scroller that is 20 screens wide say.  

This is the user requirement for the suggestion, however I’m assuming translates into things like only rendering / creating display objects (background images, object images) when required, and discard them when required.   Effectively therefore doing the heavy lifting for the user so special libraries aren’t required to be integrated etc… 

Perfectly possible. Depending on the complexity you could take a “dumb” approach (i.e. just dump everything in there and let Corona’s engine do off screen culling for you), or if that turns out too slow, build your own smarter approach (e.g. creating and discarding, switching off certain functionality in the enterframe loop for objects out of view, and reusing sprites a la tile based engines).

But in short, this is routine stuff in Corona.

By default, Corona does not render off-screen objects, but…

Physics can mess this up,  

  • Either the object won’t render and some important physics object will go to sleep, OR

  • The object will not sleep (because you forced it) and will render off screen wasting CPU/Mem.

So, if you do have lots of physics objects in your scene, make sure they are allowed to sleep (default behavior), and not supposed to keep moving, etc. when off screen.

Note:   I often suggest this, but make a dummy level populated with N objects (not specifically laid out nicely) and see how it performs.

You can simply make an object builder function that makes objects with and without bodies, then in a loop call it and pass in X,Y coords to place lots of stuff in the world.  Then, monitor FPS and memory usage (on device) using a roll-your-own solution or one from elesewhere.

Oh, and don’t forget MTE does make huge scenes: http://forums.coronalabs.com/topic/33119-million-tile-engine-beta-release/

I have a game right now that is about 20 screens wide and about 5 screens high and run at about 22mb texture memory and around 1.2mb normal memory but I use sprite sheets so its pretty light weight.

So whilst there’s lots of things you can do programmatically in Corona my suggestion to achieve this, my thinking here was that in terms of Corona’s goal to “make things easy for developers”.  So that a beginner wanting to build say a “Tiny Wings” with lots of different backgrounds layout out end on end could do this with the Composer GUI (or the GUI engine/library) taking care of things.  A valid ideal future feature for the product no?  (users builds or designs what they want in the GUI and the engine optimizes as required)

@Christopher - I assume you built in some smarts to load/unload the backgrounds?  I haven’t recently researched the memory limits of the latest IOS devices etc, but I’m assuming you can’t load too many large background images all at the same time without hitting memory limits?

@Greg,

I don’t know much about the corona viewer as I have never been one for drag and drop programming, but in the case of “tiny wings” there really isn’t that much graphic resources going on, it just gives you the appearance of that.

On any game (doesn’t matter what engine you use, or if you just use native opengl/directx) you are going to hit limits on any device or desktop computer, this has always been the case. I remember pushing the limits of a 4mb video card (yes that is 4 megabytes).

The trick with building super large worlds is really not about loading/unloading, yes that is a part of it but the other part is knowing how to get the most out of your resources.

For example if you take “Tiny Wings” (I just watched the video).

They have a fixed background and fixed clouds so those are not really part of every “screen” they are part of the master scene, so they get loaded once.

I am not exactly sure what “they” are doing for the ground, but off the top of my head I would say that the bottom ground is tiled and imagine it is pretty lightweight as I see a lot of repeating shapes.

So if you think of a shape like in that game maybe a 512x512 square that is lets say transparent and has some round mountain type look and feel but is a solid color “like a shape in photoshop” and lets say you have 20 “unique” tiles what you can do is swap the texture fill out as needed and just tile the graphics across the screen and because the images are already loaded you are not going to take a big hit when you create another object with the same shape/texture etc. and so forth.

Have a look at below.

0a09e2de-1d87-11e4-aeb0-12313d1c3a13-ori

This was something I was goofing around with over the course of a week I had off, It can climb about 5-10 screens high and about 30-50 screens wide depending on the level, it has particle effects, black and white vs. color effects in real-time, about 100 sprites (characters, monsters etc.), physics and some other goofy effects like damage blinking etc.

Now graphics whys I would say that I am pushing more effects that Tiny Wings but like I said above my texture memory floats around 20-30mb and “peak” times for normal memory is about 1.2 - 2.4mb which is really light weight.

Keep in mind I am not doing any loading/unloading of assets I load the entire game level resources when the level starts but because of my use of image sheets everything remains lightweight.

Not sure if I answered your question, or if I am even making sense but short answer is it is all doable in Corona and they have made it really easy to achieve these types of effects. 

On the Corona Viewer, I understand your point but I have never seen a drag and drop game maker that could do exactly what you want unless the game maker was “specifically” designed for that type of game. You can’t be all things to all people so a lot of times you have to go with a very broad stroke and hope you make it good enough for the majority.

Christopher

@Christopher,

Your ‘goofing around’ produced something awesome looking.  I hope turns into a game?

Very nice work regardless.

Cheers,

Ed

lol thanks ed, 

The funny part is it is only about 1000 lines of code :), not sure if I will publish it or not I was mostly playing around with some control concepts which turned into what you see, then remembered playing ultima online way back in the day “ghost mode” when you died and thought hey that would be neat lol

The left side of the screen 1/2 screen space is split in two so the first 1/4 is left and second 1/4 is right and the right side is jump so sliding your finger left/right on the screen moves your character left and right and the right side makes him jump.

Was looking for away to get rid of buttons and controllers while at the same time still maintain real fluid, fast and fun game play which turned out to be very fun and addictive lol about 60% of my time was just playing the dang thing lol

thanks Chris

Here is a quick video, and by quick I mean I just opened up snagit and recorded it so not the cleanest lol

https://www.youtube.com/watch?v=OAbw6s3iRA8&feature=youtu.be

Indeed! The art alone is fantastic dude :slight_smile:

Thanks Gemlin, 

Just created a new thread for my goofing around stuff as my daughter has me building her a new matching game lol

Here is link if you want to have a look :slight_smile:

http://forums.coronalabs.com/topic/50524-goofing-around/

Christopher

Perfectly possible. Depending on the complexity you could take a “dumb” approach (i.e. just dump everything in there and let Corona’s engine do off screen culling for you), or if that turns out too slow, build your own smarter approach (e.g. creating and discarding, switching off certain functionality in the enterframe loop for objects out of view, and reusing sprites a la tile based engines).

But in short, this is routine stuff in Corona.

By default, Corona does not render off-screen objects, but…

Physics can mess this up,  

  • Either the object won’t render and some important physics object will go to sleep, OR

  • The object will not sleep (because you forced it) and will render off screen wasting CPU/Mem.

So, if you do have lots of physics objects in your scene, make sure they are allowed to sleep (default behavior), and not supposed to keep moving, etc. when off screen.

Note:   I often suggest this, but make a dummy level populated with N objects (not specifically laid out nicely) and see how it performs.

You can simply make an object builder function that makes objects with and without bodies, then in a loop call it and pass in X,Y coords to place lots of stuff in the world.  Then, monitor FPS and memory usage (on device) using a roll-your-own solution or one from elesewhere.

Oh, and don’t forget MTE does make huge scenes: http://forums.coronalabs.com/topic/33119-million-tile-engine-beta-release/

I have a game right now that is about 20 screens wide and about 5 screens high and run at about 22mb texture memory and around 1.2mb normal memory but I use sprite sheets so its pretty light weight.

So whilst there’s lots of things you can do programmatically in Corona my suggestion to achieve this, my thinking here was that in terms of Corona’s goal to “make things easy for developers”.  So that a beginner wanting to build say a “Tiny Wings” with lots of different backgrounds layout out end on end could do this with the Composer GUI (or the GUI engine/library) taking care of things.  A valid ideal future feature for the product no?  (users builds or designs what they want in the GUI and the engine optimizes as required)

@Christopher - I assume you built in some smarts to load/unload the backgrounds?  I haven’t recently researched the memory limits of the latest IOS devices etc, but I’m assuming you can’t load too many large background images all at the same time without hitting memory limits?

@Greg,

I don’t know much about the corona viewer as I have never been one for drag and drop programming, but in the case of “tiny wings” there really isn’t that much graphic resources going on, it just gives you the appearance of that.

On any game (doesn’t matter what engine you use, or if you just use native opengl/directx) you are going to hit limits on any device or desktop computer, this has always been the case. I remember pushing the limits of a 4mb video card (yes that is 4 megabytes).

The trick with building super large worlds is really not about loading/unloading, yes that is a part of it but the other part is knowing how to get the most out of your resources.

For example if you take “Tiny Wings” (I just watched the video).

They have a fixed background and fixed clouds so those are not really part of every “screen” they are part of the master scene, so they get loaded once.

I am not exactly sure what “they” are doing for the ground, but off the top of my head I would say that the bottom ground is tiled and imagine it is pretty lightweight as I see a lot of repeating shapes.

So if you think of a shape like in that game maybe a 512x512 square that is lets say transparent and has some round mountain type look and feel but is a solid color “like a shape in photoshop” and lets say you have 20 “unique” tiles what you can do is swap the texture fill out as needed and just tile the graphics across the screen and because the images are already loaded you are not going to take a big hit when you create another object with the same shape/texture etc. and so forth.

Have a look at below.

0a09e2de-1d87-11e4-aeb0-12313d1c3a13-ori

This was something I was goofing around with over the course of a week I had off, It can climb about 5-10 screens high and about 30-50 screens wide depending on the level, it has particle effects, black and white vs. color effects in real-time, about 100 sprites (characters, monsters etc.), physics and some other goofy effects like damage blinking etc.

Now graphics whys I would say that I am pushing more effects that Tiny Wings but like I said above my texture memory floats around 20-30mb and “peak” times for normal memory is about 1.2 - 2.4mb which is really light weight.

Keep in mind I am not doing any loading/unloading of assets I load the entire game level resources when the level starts but because of my use of image sheets everything remains lightweight.

Not sure if I answered your question, or if I am even making sense but short answer is it is all doable in Corona and they have made it really easy to achieve these types of effects. 

On the Corona Viewer, I understand your point but I have never seen a drag and drop game maker that could do exactly what you want unless the game maker was “specifically” designed for that type of game. You can’t be all things to all people so a lot of times you have to go with a very broad stroke and hope you make it good enough for the majority.

Christopher

@Christopher,

Your ‘goofing around’ produced something awesome looking.  I hope turns into a game?

Very nice work regardless.

Cheers,

Ed