A tutorial on splitting your game world up into chunks and progressively handling it as the player moves around.

Article by Richard Davey. Posted on 18th Oct 2018.   @phaser_


Jerome Renaux writes: "Tilemaps are great data structures to store all kind of useful information about your game world. However, if you world is very big (like, several million tiles in width and height), you will have to deal with a correspondingly big map, of potentially enormous size. In that case, loading the entire tilemap in one go becomes problematic and has to be avoided. One solution for dealing with huge maps is to compartmentalize your world in several moderately sized areas, which can only be accessed through controlled bottlenecks, such as valleys or gates. That way, you know when to load each area and have only a much smaller amount of map data in memory at any time (the guys of Firewatch do something like that.)

Another solution, which I use myself for Westward, is to split your world map in a mosaic of many many smaller “chunks”. The idea is then to only load and draw the chunks surrounding the player, and to do so on the fly as the player moves. This approach has the advantage over the previous one that it does not constraint the topology of your world at all (no need for controlled access points), and is the one I’ll be implementing in this tutorial."

Read More