Use large image as terrain?

So my idea is to take a large image ( f.e. 5000 x 5000 ) and let the player move on it.

so camera should follow across the terrain. ( i mean only 1000 x 1000 should be shown on screen )

hope u understand my idea…

so i need a hint or an example how to get my idea to work…

thanks :slight_smile:

Won’t work - you’re limited by the texture size on relevant devices - which is power of two: 1024x1024, 2048x2048, 4096x4096, etc…

you need to split up your terrain in tiles.
for many reasons by the way.

one of them is that your use of texture ram will be enormously high:

1024x1024 = 4mb

2048x2048 = 16mb

4096x4096 = 64mb

and so on

and that has nothing to do with the filesize(in mb) of your actual png.
texture ram is calculated by 4bits per pixel, so it doesnt care how much you compress your file, that will just change the filesize of your app.

to keep your ram usage low, and your game working without lags (and working at all, as your 5000pixel terrain wouldnt work at all as correctly pointed out by segaboy) i suggest splitting your terrain in multiple 256x256px tiles.
each of them will be 256kb in your ram, keep in mind that if there is the possibility of reusing one of them you save another 256kb.
so even smaller tiles = even better because you can reuse for example simple grass and breaking up the repetetive look by adding a tile with for example a rock here and there.

what you’d do next is loading and removing the tiles on the go while you check where the player is right now. so that you wont have all your tiles in your ram all the time.
some engines do that automatically and its called occlusion culling, i dont know if corona has something similar to it, a search for occlusion culling didnt give me any results, so it might be called different in corona or simply has to be done by your code, what isnt that big of a deal either.

i dont know how new this all is to you but here are some terms you could look up in the search:
tiled map
imagesheets
spritesheets
map generation with tables

By the way,

here is a good article on ram, with a nice short breakdown of the tiles of “rayman origins”:
https://www.scirra.com/blog/112/remember-not-to-waste-your-memory

I’ve used lua since years, but the point is that the api is new in corona.

I’m scripting my own functions to increase working quality.

Nevermind im new to this section:D

nice,
at least my post might be of some help for new ones stumbling over this thread :wink:

cheers,
michael

oh wait, now i am confused?!
where do i find a documentation of the new graphics api?

sorry mate,
seems i have missed something.

I mean the api in corona is different to others.

Different to what? I’m confused by what you’re saying.

P.S That’s a good link MrFox - thanks for sharing.

to for example mta:sa’s api

ahhh, ok, now i get it.

@SegaBoy
you’re welcome, even tho that link is about a different game engine it helped me very much to understand how ram is calculated. when i was checking my ram usage the first time ever i was totally confused that the ram is so much higher than my actual png filesizes, back then i simply didnt know that they’re not related to each other.

btw. i guess bambenek was using another game engine / framework that works with LUA script, before.
correct me if i am wrong.
 

EDIT:
@bambenek i see, you answered the question already. MTA looks like fun, never heard of it before.

you’re right mrfox. that’s is correct. 3D engine.

So, anybody can give me a hint?

http://forums.coronalabs.com/topic/36405-touch-event-is-triggered-false/

anytime I use my move-buttons, the character shoots-.-

Won’t work - you’re limited by the texture size on relevant devices - which is power of two: 1024x1024, 2048x2048, 4096x4096, etc…

you need to split up your terrain in tiles.
for many reasons by the way.

one of them is that your use of texture ram will be enormously high:

1024x1024 = 4mb

2048x2048 = 16mb

4096x4096 = 64mb

and so on

and that has nothing to do with the filesize(in mb) of your actual png.
texture ram is calculated by 4bits per pixel, so it doesnt care how much you compress your file, that will just change the filesize of your app.

to keep your ram usage low, and your game working without lags (and working at all, as your 5000pixel terrain wouldnt work at all as correctly pointed out by segaboy) i suggest splitting your terrain in multiple 256x256px tiles.
each of them will be 256kb in your ram, keep in mind that if there is the possibility of reusing one of them you save another 256kb.
so even smaller tiles = even better because you can reuse for example simple grass and breaking up the repetetive look by adding a tile with for example a rock here and there.

what you’d do next is loading and removing the tiles on the go while you check where the player is right now. so that you wont have all your tiles in your ram all the time.
some engines do that automatically and its called occlusion culling, i dont know if corona has something similar to it, a search for occlusion culling didnt give me any results, so it might be called different in corona or simply has to be done by your code, what isnt that big of a deal either.

i dont know how new this all is to you but here are some terms you could look up in the search:
tiled map
imagesheets
spritesheets
map generation with tables

By the way,

here is a good article on ram, with a nice short breakdown of the tiles of “rayman origins”:
https://www.scirra.com/blog/112/remember-not-to-waste-your-memory

I’ve used lua since years, but the point is that the api is new in corona.

I’m scripting my own functions to increase working quality.

Nevermind im new to this section:D

nice,
at least my post might be of some help for new ones stumbling over this thread :wink:

cheers,
michael

oh wait, now i am confused?!
where do i find a documentation of the new graphics api?

sorry mate,
seems i have missed something.

I mean the api in corona is different to others.

Different to what? I’m confused by what you’re saying.

P.S That’s a good link MrFox - thanks for sharing.