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.
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.
Type level Field h Field x, z End Type Function Highlight(h) For l.level = Each level If l\h = h Then For x = -1 To 1 For z = -1 To 1 SecondaryH(l\x+x, l\z+z) Next Next EntityColor l\h, 255, 0, 0 Exit EndIf Next End Function Function SecondaryH(x, z) For l.level = Each level If l\x = x And l\z = z Then EntityColor l\h, 0, 0, 255 Exit EndIf Next End Function Function Clear() For l.level = Each level EntityColor l\h, 255, 255, 255 Next End Function Graphics3D 640, 480, 0, 2 SetBuffer BackBuffer() Global cam = CreateCamera() MoveEntity cam, 2, 2, -5 AmbientLight 255, 255, 255 For i = 1 To 25 l.level = New level l\h = CreateCube() : EntityPickMode(l\h, 2) ScaleEntity l\h, .25, .25, .25 j = j + 1 If j > 4 Then k = k + 1 If k > 4 Then k = 0 j = 0 EndIf PositionEntity l\h, j, k, 0 l\x = j : l\z = k Next Repeat If MouseHit(1) Then Clear() res = CameraPick(cam, MouseX(), MouseY()) If res > 0 Then Highlight(res) EndIf EndIf RenderWorld() Text 0, 0, res Flip Until KeyHit(1) End