The_dude8080 Posted December 29, 2016 Share Posted December 29, 2016 Hello. I was wondering how you handle huge maps in a game. I am more like a phaser user but I guess the idea behind it must be the same too all other cases. I know phaser bitmap has a limit size (it seems like it) so I can't just load millions of tiles into a bitmap for example. I can't load them "one by one" in the game because that would make the fps horrible... so what? Should I create lots of bitmaps and load them according to player position in the map? Like some kind of "map pooling"? Link to comment Share on other sites More sharing options...
Ralph Posted December 31, 2016 Share Posted December 31, 2016 I don't really understand what you are asking, but for my game, my mapping system is a giant 2x2 array that acts as a map. Each entry in the array is a 32x32 pixel block on the map, the entries are all numbers 0-11 which correspond to what kind of tile to place there. When a player walks around I just get info from the array to see what to load next. This was easier for me than what you suggest. Link to comment Share on other sites More sharing options...
The_dude8080 Posted January 5, 2017 Author Share Posted January 5, 2017 Hmm then if map is something like this: var map = [0,0,0,0, 1,1,1,1, 1,1,1,1, 0,0,0,0] // Would you do something similar to this? function GenerateMap (player_position) { for(var x = 0; x < map.length; x++) { if(player.position.x > 300 && player.position.y > 300) { // just random values if(map[x] == 1) // add the sprite equivalent to type "1"; if(map[x] == 2) // add the sprite equivalent to type "2"; } } } Link to comment Share on other sites More sharing options...
Xesenix Posted January 6, 2017 Share Posted January 6, 2017 What is huge map for you? I am currently working on maps up to 400x400 tiles something like this: The_dude8080 1 Link to comment Share on other sites More sharing options...
Recommended Posts