"Unlimited World"

Blitz3D Forums/Blitz3D Programming/"Unlimited World"

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:
Type level
	Field h
	Field x, z
End Type

Dim nl(8)
Dim ol(8)

Function Highlight(h)
	For l.level = Each level
		If l\h = h Then
			j = 0
			For x = -1 To 1
				For z = -1 To 1
					nl(j) = SecondaryH(l\x+x, l\z+z)
					j = j +1
					DebugLog j
				Next
			Next
			EntityColor l\h, 255, 0, 0
			
			Exit
		EndIf
	Next
	RemoveOld()
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
			
			EntityAlpha l\h, 1
			Return l\h
		EndIf
	Next
End Function

Function RemoveOld()
	For i =  0 To 8
		b = False
		For j = 0 To 8
			If ol(i) = nl(j) Then
				b = True
				Exit
			EndIf
		Next
		
		If b = False Then
			For l.level = Each level
				If l\h = ol(i) Then
					EntityColor l\h, 255, 255, 255
					EntityAlpha l\h, 0
				EndIf
			Next
		EndIf
	Next
	
	For i = 0 To 8
		ol(i) = nl(i)
	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
	If i >1 Then EntityAlpha l\h, 0
	
	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 
		res = CameraPick(cam, MouseX(), MouseY())
		If res > 0 Then
			Highlight(res)
		EndIf
	EndIf
	
	RenderWorld()
	Text 0, 0, res
	Flip
	
Until KeyHit(1)
End