Massive Freeroam Environment

Blitz3D Forums/Blitz3D Programming/Massive Freeroam Environment

ClayPigeon(Posted 2012) [#1]
OK, better question this time. :) What are some of the methods that can be used to render a massive freeroam environment that is completely entity based? (no terrain) I am thinking something along the lines of some kind of grid system where I save a list of entities to create when you enter the region? I'm just not sure how to approach this problem and was wondering if I could get some advice from anyone who has experience with this sort of thing. Thanks!

P.S. By "massive" I mean that certain parts are so far away that rendering them would be trivial and a waste of render time.

Last edited 2012


Yasha(Posted 2012) [#2]
With Krischan's BlitzTiles system!


ClayPigeon(Posted 2012) [#3]
(no terrain)


XD I didn't mean I wanted terrain without using blitz terrains. I meant the environment has NO terrain. It's more of a city environment and all the content will be loaded as meshes.

I have seen BlitzTiles though, and I play with it all the time cause it's so cool :D

Last edited 2012


RemiD(Posted 2012) [#4]
I have researched this subject and done some tests.

If you want to have a far view range without fog, there are some tips to achieve this illusion.

You have to use several zones with several lod (level of detail).

For the active zone (where the player is), you can show highly detailed meshes for the environment and for the characters, and activate a smart ai for the npcs in this zone.

For the zones connected to the active zone you can show less detailed meshes for the environment and for the characters, and desactivate the ai or activate a simplified ai.

For the zones far away, the best approach i have found is to use a texture which is a photo of the environment of the zone viewed from the active zone (8 shots at 45°). A kind of skybox (i call it FarAwayThingsBox) but with only the parts of the terrains, of the buildings, shown, the others parts of the image is black in order to be able to use the mask (4).

You can also create zones with irregular shapes if you use "portals" or connections between some zones, you can then determine in which zone a player or a npc is, and therefore hide and show the appropriate zones.

I add some precisions for those who are interested about this :
It is easy to know in which zone the Player or a npc is, because they can only enter or exit a zone by going through specific portals.
With this data, you know in which zone the player is, you know what are the portals of this zone, and you also know to what others portal of others zones the portal of this zone are connected, and thus you know what is the active zone, and what are the zones connected to this zone. You can then display them accordingly.

One more thing : if you want to create a streaming engine (like Morrowind or Boiling Point) it seems most of the meshes are preloaded in the ram, only the meshes of the buildings and of the terrains are loaded in streaming.


ClayPigeon(Posted 2012) [#5]
That's something along the lines of what I was thinking... how exactly are you finding which zone the player is in? Also, if you make only the zone you are actually in high detail, then couldn't you see the other meshes in low detail when you're near the border of your current zone?


Captain Wicker (crazy hillbilly)(Posted 2012) [#6]
ClayPigeon, I thought you were moving away from bb3d? I'm currently using C++ with the Dark SDK and love it! Your choice though :/


ClayPigeon(Posted 2012) [#7]
I went through like a million engines for several different languages, but I just kept coming straight back where I started.. I liked nuclear glory, though... I'll have to scrape $100 together sooner or later. :) The Dark GDK did look cool though. I might take a look at it, too.


Ross C(Posted 2012) [#8]
I have created a nice system for blitz3d. It uses an array to store tile information, a bit like a 2d tilemap. Each quad has a texture assigned, from a larger composite texture, essentially giving you a single surface system. Each mesh (like house or building) is stored in a layer of this array, and only drawn when in range/view. This is a top down view (isometric) and isn't really designed for fps view etc.

I have a floating quad mesh which just covers the viewable screen area, and scrolls/updates with the array data. It seems to be quite efficent. One thing I did learn however. Never use the blitz alpha flag for texture blending. It still doesn't work on alot of system.


Bobysait(Posted 2012) [#9]
@ClayPigeon :
What you're looking for is probably a matter of Octree or eventually a simple 3D partitionning.

whatever ...

If you use an array based system to store lists of entities in cells, then it is quit simple to find the position of the "player" in the array :

Let's Have :
- {CityX, CityY, CityZ} = position of the minus position of the bounding box of the city
- BlocSize = size of a cell in 3D unit
- {x#,y#,z#} = position of the player (or camera...)

IdX = floor((x-CityX)/BlocSize)
IdY = floor((y-CityY)/BlocSize)
IdZ = floor((z-CityZ)/BlocSize)

Then, if you have a single dimension array to store cells (e.g: a bank)
(like "CityCell = CreateBank(MaxX*MaxY*MaxZ*4)")
you'll find the Cell Id using :

Id = IdX+IdY*(MaxX)+IdZ*(MaxX*MaxY)
Id = Id * 4

Local MyCell = peekint(CityCell, Id)

(so, you can peek/poke your city "strip" with linked-list of entities or anything that allow to store lists of entities

hope it helps.

Last edited 2012


Captain Wicker (crazy hillbilly)(Posted 2012) [#10]
@ClayPidgeon:
Do give the GDK and C++ a chance.
Here is a simple code to create a sphere and move it with the arrow keys
#include "DarkGDK.h"

void DarkGDK ( void )
{
	dbSyncOn   ( );
	dbSyncRate ( 60 );
	
	dbMakeObjectSphere ( 1, 1 );


	while ( LoopGDK ( ) )
	{

		if ( dbRightKey() )
		{
			dbMoveObjectRight ( 1, .5 );
		}

		if ( dbLeftKey() )
		{	
			dbMoveObjectLeft ( 1, .5 );
		}

		if ( dbUpKey() )
		{
			dbMoveObject ( 1 , .5 );
		}

		if ( dbDownKey() )
		{
			dbMoveObject ( 1, -.5 );
		}

		dbSync ( );
	}

	return;
}



Yasha(Posted 2012) [#11]
Don't give C++ a chance. It doesn't deserve it.

Also, Captain, you're now not only off-topic but also technically spamming. Kindly desist.


ClayPigeon(Posted 2012) [#12]
@Yasha:
I don't mind his suggestion. I like the syntax of Dark GDK, and would like to move on to a more complex language. My favorite part is the fact that it's 30 US dollars. :D

@Bobysait:
I think that makes sense.. lists of entities in a grid? Would it be safe to put a handle to a bank in each grid unit? Because the banks could hold information like entity paths. Or, I could just use types.


Bobysait(Posted 2012) [#13]
You don't need a bank/list in each cell, you just need one if there is entities in the cell, else it just store a "0" value.

Then the way to store datas in the cells is up to you.
As it really depends on what you need to store, you 'll have to manage the structur of the list/type/bank (or whatever you decide to use) by yourself.
When that is done, you 'll really glad with this kind of system, that allow you to update at specific frame rate each cells around the player, so you'll be able to control and optimize the area you need in a very simple manner.

e.g : (let's say we have a type for non-empty cells that contain the "last loop identifier" form the last updated loop of the cell)

LoopIp=LoopIp+1
for i=-2 to 2 : for j=-2 to 2
   Local cell.tCell=GetCellAtPos(player,i,j)
   If cell<>Null
      rate=i*i+j*j
      If cell\LastLoop<LoopIp+rate
           UpdateLogic(cell)
           cell\LastLoop=LoopId
      Endif
   Endif
next


It is just an empty sample to explain the main theory.


RemiD(Posted 2012) [#14]
ClayPigeon>>

how exactly are you finding which zone the player is in?



See my previous post, i have added some explanations.




Also, if you make only the zone you are actually in high detail, then couldn't you see the other meshes in low detail when you're near the border of your current zone?



For zones with a square shape, you can calculate 9 "subzones" in each zone (9 squares). Depending on what were the player previous coordinates (X,Z) and what are the player current coordinates (X,Z), you know if player is going to the zone at +Z, +Z+X, +X, -Z+X, -Z, -Z-X, -X, +Z-X With this, you know when to start to load/delete hide/show the appropriate meshes.

For zones with irregular shapes, even if the Player can see the meshes of others zones, he can only go from one zone to another zone by going through a portal. He can't see the border of a zone because there are meshes that block his way. The player can only go from one zone to another zone through one or several portals. With this, it is possible to calculate the distance from the coordinates of the player and from the coordinates of the portals of the active zone, and to know when to start to load/delete show/hide the appropriate meshes.
However this system is useful only if you have a game where the player can't fly.

If you want to have a game where the player is able to fly, then i guess you have to use zones with a square shape.


Captain Wicker (crazy hillbilly)(Posted 2012) [#15]
I like the syntax of Dark GDK, and would like to move on to a more complex language. My favorite part is the fact that it's 30 US dollars. :D

Actually,You could get the Dark Game Studio Package for only $50 including:
DarkMatter1 - A set of royalty free 3d models compatible with Blitz3D, DBP and GDK.
DarkBasic - The horribly slow DX7 programming language for games
DarkBasic Pro - Slow language with DX9 features. shaders etc
Dark Voices - Advanced lip sync software for Windows
Cartography Shop - Advanced world/level editor
Plant Life - Create realistic low poly and high poly plants for games
Tree Magik - Create realistic trees for use in games
Dark GDK - Fast game engine for C++ with the power of DirectX9
Trial Software - T.ED demo, Leadwerks trials and others
The Bananza discount is only $50, €38, £31 and includes:
DarkPhysics - An advanced Physics engine
DarkLights - Advanced DX9 lightmapping functions
DarkAI - Advanced A.I. system
These are just a few features that I can name from memory.
Here is the bundle product page: http://www.thegamecreators.com/?m=view_bundle&id=52


Bobysait(Posted 2012) [#16]
Captain Wicker :
This is the blitz3d forum/section and the topic title is "Massive Freeroam Environment"
So please, Stop spamming your off-topic advertising.