Making a large tilemap
#1 Members - Reputation: 100
Posted 17 March 2012 - 08:48 AM
Thanks guys!
#3 Marketplace Seller - Reputation: 8955
Posted 17 March 2012 - 11:15 AM
Why not load each tile separately, and only load the ones you need at the time?
I think more details are needed, I'm not sure I understand the exact situation.
What is the resolution of each tile?
How many tiles are in each level?
All glory be to the Man at the right hand... On David's throne the King will reign, and the Government will rest upon His shoulders. All the earth will see the salvation of God.
Of Stranger Flames - [indie turn-based rpg set in a para-historical French colony] | Indie RPG development journal
#4 Members - Reputation: 100
Posted 17 March 2012 - 06:15 PM
Thanks for the help so far.
#5 Marketplace Seller - Reputation: 8955
Posted 17 March 2012 - 06:34 PM
Unless every single tile on-screen is unique, you'll end up saving several million pixels you have to load.
Your maps can be as large as you want, just split them into chunks and load each chunk only when the player comes within range of it.
If you make each chunk 16 by 16 tiles, they'd be the exact same size as your 1024 by 1024 images, so you just load the 9 chunks around the player, and free any old chunks that are now out of range.
Make the chunks share the tiles; if chunk (0,1) and chunk (1,1) are both onscreen at the same time, and they both use tile "../tiles/rock.png", then you only need to load that tile once, and have both chunks use that same tile. And each chunk might be using and drawing that same image several dozen times... but they don't need to load it several dozen times, only load it once, and free it when no longer needed. This is easier if you don't let the chunks own the image, but have another class own the images and load the images and free the images, that the chunks can talk to when they need a tile image.
All glory be to the Man at the right hand... On David's throne the King will reign, and the Government will rest upon His shoulders. All the earth will see the salvation of God.
Of Stranger Flames - [indie turn-based rpg set in a para-historical French colony] | Indie RPG development journal
#6 Members - Reputation: 100
Posted 17 March 2012 - 06:42 PM






