"Unlimited World"

Blitz3D Forums/Blitz3D Programming/"Unlimited World"

xmlspy(Posted 2007) [#1]
I'm designing a little "Unlimited World" In theory it works, but practically with B3D who knows. It depends a lot on the resources. Tell me what you think of my theory. Do you have any tips?

The basic idea is that the player can walk around the world and areas/levels will be loaded depending on it's location. This will stop the clasic use of "portals" (removing the previous game level and loading the new one)

I'm utlizing a grid like system to figure out what needs to be loaded and unloaded.

a = currently used area by player (interactive stuff is updated)
n = neighbor area, big items can be loaded (terrain, big buildings but not updated for interactive stuff)
x = off area

xxxxx
xnnnx
xnanx
xnnnx
xxxxx


If the player moves from one area to another area then:
Compare new and old.
Remove unused areas
Load new used areas


old:
xxxxx
xnnnx
xnanx
xnnnx
xxxxx

new:
xnnnx
xnanx
xnnnx
xxxxx
xxxxx

Difference:
xnnnx
xsasx
xsssx
xdddx
xxxxx

x = off
n = new
s = remains the same
d = delete (change to x)
a = player position


To improve performance player view direction should be added.

Example if player facing north
xxxxx
xnnnx
xxaxx
xxxxx
xxxxx

Example if player facing north and getting closer to top area:
xxxxx
xxnxx
xxaxx
xxxxx
xxxxx


I have seen a cool technique used by Guild Wars to remove polys. When going further from an object GW takes a picture of the mesh, puts in a quad and removes the mesh. When you get closer it does the opposite. It's pretty neat.



Some code, but not yet with all the goodies.



Mortiis(Posted 2007) [#2]
When going further from an object GW takes a picture of the mesh, puts in a quad and removes the mesh. When you get closer it does the opposite. It's pretty neat.


Well, It's called LOD, a lot of modern video games use this technique.Try the Elder Scrolls:Oblivion.


Dreamora(Posted 2007) [#3]
With B3D you will get some serious implementation problems on a streaming world, reason is that Blitz does not allow you async loading. each read call and openfile call is blocking, the whole app will be put on halt.

It is possible to stream the stuff up to a given point by opening the file at beginning and write world format and loading code which allows streaming loading in 2D dimensions (as you can move in 2 dimensions when we assume that the height does not make a serious difference to the art seen)


Fuller(Posted 2007) [#4]
Speaking of Oblivion, I always liked the effect it lesser know prequel, Morrowind did to keep down the poly count. It would have this sudden abrupt fog that would change in color and consistency depending on the region. (Morroind's a better game than Oblivion, BTW)


Eviltoes(Posted 2007) [#5]
Morrowind seemed a bit too slow-paced for me.

sorry, had to say it.


xmlspy(Posted 2007) [#6]
Hey Dreamora, so basically the idea of a streaming world is pretty much impossible with B3D since it halts the app when loading.

What if I load all the files I need, hide them and keep them in memory and then use commands like CopyMesh? Wouldn't that partially fix my problem, I know that it would be a lot of memory if a big world is to be created. This wouldn't work too good with B3D terrains.

Another option, since B3D SDK has been released would it be possible to add async loading? I would have to move to BMax or C# but it could be done.


A Little update:



Dreamora(Posted 2007) [#7]
Preloading has the problem that the stuff must fit into the RAM. No problem for meshes, serious problem for textures unless you want low size DDS textures.


B3D SDK won't change anything, the loading code is still part of the SDK not of your code, so you can not get the loading done async from rendering, rendering will still wait for loading to be finished.


What you need to do is create your own streaming world format which allows you to read just the data you potentially will need instead of reading everything.
This sounds harder than it actually is ...

main problem is that you will need to get some basic understand of how such files need to be built up to work efficientely.

With B3D SDK this streamed loading naturally would be possible to be done in its own thread, so this would give you a serious benefit.

BUT:
1. threaded programming is always a potential cause for serious and hard/un debugable bugs.
2. As you already realized you will need to port the code you already have, add some own stuff (sound library most likely). And even moving to C# (BM is no solution, non threaded as well) won't remove the need of an own streaming world format.


Leon Drake(Posted 2007) [#8]
unless you make your own 3d format and make your own loading function that builds the file slowly during each loop of the program.

do like n openstream read a few lines containing geometry.. build a few polygons.. do the next set of data on the next loop.


Andy(Posted 2007) [#9]
You should preload stuff like textures, and then build landscapes and buldings, roads etc. on the fly. Much can be done algorithmically. You just load a few bytes at a time and build your mesh in the background poly by poly.

Andy


Dreamora(Posted 2007) [#10]
Andy: If one can afford to preload textures, the rest shouldn't be an issue at all as the textures are the main problem in this whole story due to their massive size in RAM / VRAM.


Andy(Posted 2007) [#11]
>Andy: If one can afford to preload textures, the rest >shouldn't be an issue at all as the textures are the main
>problem in this whole story due to their massive size in
>RAM / VRAM.

No, the problem is how to manage a massive world.

Textures can be combined or loaded on the fly. I reuse extensively because in the end, how to build a variety of buildings using data loaded on the fly was more important to me.

Andy


xmlspy(Posted 2007) [#12]
I think that since B3D can't do async then you have to implement a slower but constant loading on the main loop.

Here's a small example:
http://www.alldevs.com/downloads/load.zip
(Spacebar to begin)

If the data in the file can be loaded first and progressively media be constructed in the engine that would help reduce the effects of load time on gameplay.

If any of you have seen the Farbrausch demos then you know that many things can be done by the engine and not have to load a lot. However that is too much for a novice like me. I can do the simple stuff but not the stuff that they do with werkzeug.


Subirenihil(Posted 2007) [#13]
What do you mean you can't have a streaming world?

All you have to do is write a little loader function that can load only as much as it can without slowing down the game. It would have to construct the models, textures, and so forth on its own instead of using the "LoadTexture", "LoadMesh", but it isn't really all that hard to have a streaming world.

Streaming worlds are also nice for being able to play intro movies while loading game data. :)

It's getting late, otherwise I'd put a sample in here.