Open-world with autocompleting map

Hi everybody !
I am wondering if it is possible to make a simulation game where the map is not completely set at the beggining but completes itself depending the path taken by the player. Like an open-world game but with (potential) infinite map.

Let me explain that with an example. If I make a car game, the player need to see the landscape around the car (especially in front of him), so let say the map is completed in a radius of 5 kms from the car. While the car is moving, this radius need to stay the same.
So the part of the map that was set and which is now outside the 5kms radius has to be erased of the memory and replaced by the new part of the map.

I hope I’m clear and you understand well :wink:

As far as I know, with an open-world game, you first download all the entire map and after you can go everywhere you want inside the map because it has bordure. Is it possible to make an open-world without bordures and import the new part of the map while the user is playing the game?

I apologize if my question was already asked before and thank you in advance for your answers ! :slight_smile:


@BluePrintRandom has based his very own existence on doing that in the BGE lol

But before he shims here, yes it is possible, but there are a lot of constraints to take into account.

The easiest way I think would be to have a script partitioning space in tiles, and evaluate which tiles need to be shown based on the position of the player. If your grid is a regular square pattern, then the look up can be made pretty easily manually, if someone talks about KDTrees just forgot about it here, really.

So once you are able to split space and lookup tiles, then you need to have your tiles be part of your simulation, not just a Python object in memory: At that point you can have a lot of “blocks” (meshes + materials) on an inactive layer, ready to be spawned. So a tile would be composed of a bunch of blocks arranged in some way, that you spawn proceduraly when you spawn your tile…

The process should be random-ish, but you don’t want it to be purely random. What you can use is perlin noise in that case, it is the same kind of noise that is used for some textures: instead of just outputting random values after each call to the random function, perlin noise always outputs the same value for a given (x, y, z) passed to the function. But the way that value evolves when you compute points around is smooth, but random.

Perlin noise example:

perlin noise

That’s just one way of obtaining random values for a 2d space (your infinite map).

BGE/Blender already has a module with some useful methods for randomness:

Or maybe you can simply use the Python standard library?

from random import Random

# ...
# tile fetching...
# ...

# a tuple can be hashed (to get a pseudo random value)
position_as_tuple = tuple(tile.worldPosition)

# we can seed the generator using the hash
generator = Random(hash(position_as_tuple))

# get a random value between 0 and 1
tile_random = generator.random()

# you are now free to process that value however you want!

Disclaimer: The Python script I showed you is just a snippet, some variable definitions are missing and it is up to you to fill the blank and make it work inside the BGE.

Overall it is not really hard to do, but there are some steps involved, such as creating a script that will:

  • Split space in tiles and lookup nearby tiles around player
  • Compute unique random value for each tile
  • Generate landscape by spawning blocks in a coherent-ish way
  • Delete tiles and spawned object when too far

Then it means you also need to create a building set of objects in order to populate your world.

If you feel overwhelmed, the first step can be to try to make a system that would spawn planes as if they were tiles and have a player move around and see how to add new tiles (planes) and remove the old ones.

If you manage to do that you already are on a good path :slight_smile:

Take a look at fury run. The levels were procedurally generated offline, however doing it in real-time and infinetly would be very simple.

In this project I’ve made an user editable map that loads in chunks, you can see the map spawning tiles as the character moves around the scenery. Don’t know if it’s what you’re looking for.

1 Like

Thanks for your answer WKnight02 !

It helps me a lot ! Let me summarize that just to make sure I understand weel :wink:

Every blocks (meshes + materials) that will spawn in a tile (for example the road, a tree, a stop sign…) has to be stored somewhere, ready to be called to spawn it on the next tile.

When the game engine is preparing the next tile, it has to be filled with (random or not) informations. If they actually are random, then it must be in a realistic way (with the Perlin noise for example). But it is also possible that I let something else outside of the game chosing how the next tile will looks like provided that this information is transmitted to the game.

Again, thank you for your answer !


thanks ! I remember also games like subway surfer or temple run, and it is true that those game are based on the autocompletion of the map. Thank you

Joelgomes1994, its seems that the map is actually closed with bordures, even if it is not shown completely while the game is running. That was not really what I was looking for my game. But anyway thank you for your answer :grinning:

I am loading in tiles/ building navigation A* snippets, building KD tree each frame for each tile that loads in.

I am in ‘eco’ mode while recording this - 1.2 ghz - but my pc goes us to 4.2 ghz.