Open World Template

Well, Someone the other day wanted a simple setup for an open world game that dynamically loads whatever the player is near. So I made one!
-----------------------------------------------------------------------------------------------
What it does:
Dynamically loads and frees blend files that are near the player based on a naming scheme (a 3x3 grid around the player)

What it does not do:
Manage saves/loads of world sections - if you do something, move away and come back, it will probably be undone.
If the player moves to fast, sections of world may not have loaded in time. So as the game creator: make the tiles big enough the player can’t cross them really fast, but small enough to load fast.

Read the readme in the zip file for more information.

i got bored making colored tiles for the world sections, so it’s 5x5 with some gaps, I see no reason why this couldn’t be 1000x1000, and there’s no problem with gaps in places ie: water so you don’t have to have the underwater sections. Just use the names to represent where you want the pieces to be loaded.

Things to consider doing later (probably won’t unless someone really asks for it):
Load things in a 5x5 grid around the player to minimize the probability of the player seeing the edge.
Prevent the player moving to within viewing range of the edge using invisible collision walls
World Wrapping

Well, here’s the blend/zip of lots of blends:
Open World Template.zip (1.1 MB)

I tried to change line 3.So i changed it to what was in the console.Which is this.PLAYER_OBJECT = ‘cubeactive_camera’
I still get a error.

You can change it either to:
PLAYER_OBJECT = ‘active_camera’

Or you can pick any object in character.blend and chance line 3 to:
PLAYER_OBJECT = ‘object_name_here’

Okay thankyou.

if i start the base file with my player, the view does’t switch to the characters view. how can i fix this?

I made line 3 PLAYER_OBJECT = ‘active_camera’.And i get this error.

I am using 2.73.

Blender Game Engine Started
Loading chunk (0, 1)
Loading chunk (0, 0)
Loading chunk (2, -1)
Warning: Unable to open 'C:\Users\barbara\Desktop\Open World Template\World Sections\world_2_-1.blend': No such file or directory
Continuing anyway. Hopefully it is the edge of the world!
Loading chunk (2, 1)
Loading chunk (2, 0)
Loading chunk (0, -1)
Loading chunk (1, 0)
Loading chunk (1, -1)
Warning: Unable to open 'C:\Users\barbara\Desktop\Open World Template\World Sections\world_1_-1.blend': No such file or directory
Continuing anyway. Hopefully it is the edge of the world!
Loading chunk (1, 1)
Blender Game Engine Finished

You may notice the line:

Continuing anyway. Hopefully it is the edge of the world!

That is because the system does not know how big the world is, and if it can’t load a segment, it prints out the warning.

Anyway, the problem is that … I made a typo. Change line 3 into:

PLAYER_OBJECT = 'Cube'

And the world should now load around the player.

I did not know you had to move around the ground planes in the areas they should be.This does not dynamically load and free the terrains.It loads them all at ounce from each blend.I was expecting more than this.

No, it dynamically loads and frees them. It loads a 3x3 grid around the player. Anything outside that is freed from memory.
Check the code. See the function called ‘remove.’ Add a print statement next to the libfree, and you’ll see that stuff is being loaded and freed from memory as the player moves.

It is not freeing.Nothing is disappearing when the player moves away.Here is your openworld template back with my modifications.I got rid of the errors in the console.

Attachments

Open World Template2.zip (1.39 MB)

changing the line to: PLAYER_OBJECT=‘Cube’
will just spawn a cube and no terrain is loading.

changing the line to: PLAYER_OBJECT=‘player_mover’…(my character) will load the world, but the view will not switch to fps view.

Can I use this for a game?

I just read the readme… oops.