# Creating a seamless open world 2d game map

I'm creating an open world game similar to Pokemon. Should I load the full map, or divide it into chunks and load only the the nearby area? I don't want my user to get to a point where it will transition between maps, like Pokemon.

If I were to split it into chunks, how could I load them seamlessly?

• Excuse me, but would you mind clarifying what you mean by "where it will the second map"? You seem to have left a word out :) – Lysol Jul 12 '14 at 4:09
• How large is your world going to be and what's your target platform? When it comfortably fits into the RAM of your target platform, there is really no reason to overcomplicate the engine with chunk handling. – Philipp Jul 12 '14 at 20:10
• For the record, generally speaking games like Pokemon load an entire area into memory, but the key is (as you mention) there are no endless areas. There are logical chunks that break up each area, such as groups of impassible objects. There's no reason why you can't use the same approach, but use a seamless transition (but depending on how you implement this you might end up having 2 large chunks in memory at once at certain boundries) – Selali Adobor Aug 9 '14 at 8:45

Short answer: Depends on size and type of world/map, but when in doubt use an tile based solution using an array.

You might benefit from creating your map as 2D jigzaw, where you load only the relevant pieces you actually need to show on screen. The simplest way to do this is to treat your map as made up of tiles, as is done in any kind of old scool tile-based game, from Mario to Civilization 1.

Tile-based games usually store the poisition of objects in an array, from which the rows and colums of tiles which need to be visible are extracted and drawn/positioned on screen. This is done based on the player's x/y coordinates in relation to the world coords.

To load new "rows" or "columns" of the map you might simply check if the player is getting close to the edge of the screen and then start to scroll the map and load/draw new rows or columns from the array as needed.

For some examples see this tutorial:

http://gamedevelopment.tutsplus.com/tutorials/an-introduction-to-creating-a-tile-map-engine--gamedev-10900

I picked up the techniques myself over 10 years ago when doing Flash games via these excellent (but outdated code-wise) tutorials. The code and examples still make sense, but will likely not work in newer versions of Flash):

http://oos.moxiecode.com/blog/index.php/tutorials/

Also check out this related question:

Whole map design vs. tiles array design

If not sure how to proceed ,You have 3 methods to do so:

• Keep map-sizes fixed and create same size maps, just manipulate navigation
• Use tiles, and create maps loading scenery each time,(use templates for faster access)
• GET one full big map

Now i have not implemented method 3, but it seems the obvious first attempt to do that, and it may end if you finally decide to limit your big world to array and int size =32;

FOR METHOD II you have to implement simple 2d array code, design some tiles (like your example from pokemon, containing desert,water,grass, and city style surroundings) and load it from your stored pointer referrence

function starter(args:Event)
{
thumb.startDrag(false, new Tile(track.x, thumb.y, track.width, 0));
}
function stopper(args:Event)
{
thumb.stopDrag();
}
function mover(args:Event)
{this.Tile={Tile.water[0],Tile.water[1],Tile.grass[3]};}//each as in constructor
void(int * point){//img here}


For method I You will need a bit work here ,and create templates to each design of tiles and fix them ...like saying array is fixed for 100 tiles [10X10] or as per your game window size And as per your question you want them to be seamless so load arrays

a[10][10] and a[10-20][10-20], alongwith add temporary array store for half list that is

b[10-15][10-15]=a[10-20][10-20]:

And implement a Camera type function that focuses your character, so map moves along with character and you move around seamlessly