Jump to content

Large unique level background


anonrab
 Share

Recommended Posts

I making game with pretty large unique levels (10000x10000 pixels) with unique picture at background. If i just load that image, it consume around of 500Mb of memory and work very slow. 

 

I can split this big image, to plenty of small images, but i have no idea, how to show them only when player see them, and destroy, when user do not see them.

Thanks.

Link to comment
Share on other sites

Why not do exactly that? Split your image into a bunch of tiles, name them something like "image#x#.png" (where # is the x or y coordinate of the tile), and then convert the camera's view into an intersection of those tiles. At worse case you'll be showing four of the tiles when near the tile boundaries.

 

You probably want to look at this camera property to figure out where you are in the world. You could use the JS modulo operator to help. Make sense?

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...