Large game worlds

Blitz3D Forums/Blitz3D Beginners Area/Large game worlds

Buggy(Posted 2006) [#1]
How do games with huge worlds load the landscape? Do they have files for it in some sort of array, and when the player gets close enough to almost see it, they load a small file portion of it?

If this is true, then do they not make the entire world on one map editor, but make individual parts instead?

Also, how do they handle things like - for instance - whether or not a secret door is open or an item has been taken? With global variables? That seems rather inefficient...


Andy(Posted 2006) [#2]
>How do games with huge worlds load the landscape?

Divide and conquer!

>Do they have files for it in some sort of array, and when
>the player gets close enough to almost see it, they load a
>small file portion of it?

Put very simply, yes.

>If this is true, then do they not make the entire world on
>one map editor, but make individual parts instead?

It depends on the tool you use. Generally the developer will build their own tools, so that it enables easy editing.

>Also, how do they handle things like - for instance -
>whether or not a secret door is open or an item has been
>taken? With global variables? That seems rather
>inefficient...

Just as you can load data on the fly, you can save data on the fly.


Andy


Ross C(Posted 2006) [#3]
That's where types come in handy. Say you make every entity be stored in a type collection.

Type Entity
   Field x,y,z
   Field Object_Type
   Field Object_Data
End Type



Now, in your code you would have a piece of code, such as a line of if statements.

IF (the field Object_Type) is 0 then (this entity is a door)

So, if that field equals zero, then the object is a door. Now, the object_data field will hold say a 0 or 1 for example, 0 being closed, 1 being open... etc


Buggy(Posted 2006) [#4]
Ahh...

Is there a formula or algorithm for determining when to use the landscape?


Gladen(Posted 2006) [#5]
HI all!
Buggy, I am no expert, but I woul dhtink that there is only a formula or algorythm if you make one for yourself and use it.

For example, if I were making a very large terrain, I'd note where my borders are. Most to all landscapes in Blitz are a perfectly square grid (with a power of 2 for the side dimensions). So I would divide up my 'world map' into pieces that had some sort of physical borderat the edges. by keeping track of the player-entity position (or camera attached to the player: which is more or less the same thing) I would then use a procedure (a function) to check the position and load the new terrain map accordingly.

Let's say you had a small 'world' with 3 squares on it (arranged up and down). The top terrain is a wild forest, the middle terrain is a rolling countryside and the bottom terrain is the town. If each terrain is a map of 512X512 then 0-512 on the Z axis (assuming that is your distance on the 3D grid) would be in the town, 513-1024 would be the rolling countryside, and 1025-1536 would be the forest.

I'd run a function to check position to see if we had entered new territory and thusly need to load a new map

***psuedo Code****
function checkmymap()

case camera positionZ

0-512: check to see if we're using the right map. If not then load the next map

513-1024: check to see if we're using the right map. If not then load the right map

etc....

****end psuedo code

Flame On


mindstorms(Posted 2006) [#6]
Gladen, wouldn't you need to load the parts before they came into sight so as not to have a mountain all of a sudden appear in front of you? I would check to see if the player(camera) was just outside of the camera range, then load it.


Andy(Posted 2006) [#7]
>Gladen, wouldn't you need to load the parts before they >came into sight so as not to have a mountain all of a
>sudden appear in front of you?

Loading a mesh doesn't display the mesh, it only loads the mesh into memory. You can usualy have many meshes in memory(loaded) without displaying them.

Displaying a mesh is something else entirely.

You really should use the 'CameraFog' commands to avoid pop-up.

I started writing a FAQ some time ago, which was never finished. It still lacks the part on DRM, but the first part tells you how to create large worlds.

http://www.blitzbasic.com/Community/posts.php?topic=55146#613983


Andy


Wings(Posted 2006) [#8]
Well you cold always take a look at TES editor for Oblivion. It gives you some clue how real companys edit large worlds.

basacly word is stored in a matrix.

me myself have a custom mesh that i adjust the height of vertex. making my little voidrpg world verry big. its over 1.000.000 vertices in my world mesh. (But i only show 64x64 at one time)