RenderWorld bug?

Archives Forums/Blitz3D Bug Reports/RenderWorld bug?

Flame(Posted 2007) [#1]
Ok so I'm busy coding an SL clone for my school for a project, and suddenly all of the sudden, mid way of making Land editing work, I get a weird error message saying RenderWorld has done an memory access violation! To top it off, I even put renderworld in the loop of when it makes sprites for the landediting and it freezes after making 31*512 (so it seems to not like making more than 15872 sprites or what ever). Anyways, here's the code (I just got started on this project):
Graphics3D 640,480,32,3
SetBuffer(BackBuffer())

client_name$="Flame"
client_password$=""

Dim land(10)

land(0)=CreateTerrain(1024)
TerrainDetail land(0),4000,True
ScaleEntity land(0),1,25,1

main_camera=CreateCamera()
MoveEntity main_camera,512,10,0

UpdateWorld
landedit_spr_main=LoadSprite("data\sprites\land edit.bmp")
Dim landedit(512,512)
For y=0 To 512
	For x=0 To 512
		landedit(x,y)=CopyEntity(landedit_spr_main)
		EntityAlpha landedit(x,y),.5
		PositionEntity landedit(x,y),x*2,TerrainHeight(land(0),x*2,y*2),y*2
	Next
	DebugLog "Round "+y+" completed!"
Next

While Not KeyHit(1)

	Cls
	
	UpdateWorld
	RenderWorld
	
	Flip
	
Wend

The sprite can be anything you want (it doesn't really matter). Can someone tell me what's going on?

-Flame The Great


Flame(Posted 2007) [#2]
Like I said, if you put renderworld in the for loop, as soon as you hit 31 on y, it'll give you the error.


DJWoodgate(Posted 2007) [#3]
Yes, too many sprites I would guess. Think I have run into that myself in the past. In any event you cetainly do not want over 260000 of the little rascals knocking around. You will need to rethink your approach in that respect.

IMO This is an implementation limit rather than a bug, though you should be alerted to it in Debug mode and/or it should be documented.

Speculating on the reason for the limit, perhaps sprite geometry is stored in a single vertex list? I suspect that the way b3d allocates memory to this list may explain the slight shortfall from the maximum 64k verts. You get a similar effect when you exceed the max number of verts in a surface. Pure speculation of course but it will do until BRL explains it properly...


Flame(Posted 2007) [#4]
Ok thanks!