7
\$\begingroup\$

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?

\$\endgroup\$
  • \$\begingroup\$ 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 :) \$\endgroup\$ – Lysol Jul 12 '14 at 4:09
  • 3
    \$\begingroup\$ 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. \$\endgroup\$ – Philipp Jul 12 '14 at 20:10
  • \$\begingroup\$ 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) \$\endgroup\$ – Selali Adobor Aug 9 '14 at 8:45
1
\$\begingroup\$

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

\$\endgroup\$
0
\$\begingroup\$

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

Hope this answers your question...

referrence http://pygame.org/project-pyMap+-+2D+Tile+Mapping-2769-.html

http://students.4j.lane.edu/~bortega23/ArcuzGuide.html map section in game arcuz, you may alos implement minimap, and create further zoom on same data as in this game

unity 3d tutorials for game point lightsource & camera view

\$\endgroup\$
0
\$\begingroup\$

When developing open sandbox games you always have to deal with this problem, sometimes the map is splited in grid(DayZ Standalone), sectors(Battlestar galactica), voxels(EVE) or zones (like pokemon) and sometimes it's stored in RAM, it only depends on the mapsize.

If you have a 255x255 map that stores just integers (0: water, 1: grass, etc) it'd be (255x255x4) 260100 bytes (254 kB), so you can store the entire map in an array on ram, else, if you have a more complex datastructure for each tile or you have more tiles you gonna have tu chunk the data.

In 2D games I like chunk it in tiles, and load the current cell and adjacents that i need every time "currentcell" changes, remember that this is just a "logic" division.

You can store the entire map in different ways, form DDBB to .dat files or .JSON, it doesn't matter just load the new cells from storing before your char goes in and you will have an enviable performance.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.