Edit: 05/mar/2017
Added stress test 3 at the end of this post
NOTE: The team is aware of the problems.
Code: Select all
; Object creation And rendering stress TEST
; -------------------------------------
; Decrease/Increase the #XNUM And #YNUM
; ----------------------------------------------------
; Tested with PureBasic 5.43 and 5.60 Betas
; It's improved in beta 4 and 5 but still pretty slow
; when compaired to the older version.
;-----------------------------------------------------
DisableDebugger
InitEngine3D()
InitSprite()
InitKeyboard()
#XNUM = 25
#YNUM = 25
Structure _base
id.i
ms.i
ma.i
tx.i
EndStructure
Structure _TimDif
ms.i
Primitive.s
avgFrame.i
numOfMesh.i
PhysOn.i
EndStructure
Global Dim m._base(#XNUM, #YNUM) ; (625 objects)
Declare.i CreateTheObjects(Index.i = 1)
Global tx.s, Quit.i, RET.i, Index.i = 0
Global Dim da._TimDif(3)
OpenWindow(0, 0, 0, 1024, 768, "Stress test (Press 1,2,3 for testing different objects)", #PB_Window_ScreenCentered|#PB_Window_SystemMenu)
EditorGadget(1, 801, 0, 222, 20)
EditorGadget(2, 801, 30, 222, 20)
EditorGadget(3, 801, 60, 222, 20)
EditorGadget(4, 801, 90, 222, 20)
EditorGadget(5, 801, 120, 222, 20)
OpenWindowedScreen(WindowID(0), 0, 0, 800, 768)
CreateCamera(0, 0, 0, 100, 100)
MoveCamera(0, 0, 0, 65)
Index = 1
da(Index)\Primitive = "CreateCube"
da(Index)\PhysOn = #False
da(index)\numOfMesh = #XNUM*#YNUM
RET = CreateTheObjects(1)
CreatePlane(0, 10, 10, 10, 10, 1, 1)
CompilerIf #PB_Compiler_Version >= 550
CreateTexture(0, 10, 10, "PlaneTexture")
CompilerElse
CreateTexture(0, 10, 10)
CompilerEndIf
StartDrawing(TextureOutput(0))
Box(0, 0, 10, 10, $777777)
StopDrawing()
CreateMaterial(0, TextureID(0))
CreateEntity(0, MeshID(0), MaterialID(0), 0, 0, 0)
RotateEntity(0, 0, 40, 0)
MoveEntity(0, 0, -25, 0)
ScaleEntity(0, 20, 1, 20)
CreateEntityBody(0, #PB_Entity_StaticBody)
Repeat
Repeat
ev = WindowEvent()
If ev = #PB_Event_CloseWindow : Quit = #True : EndIf
Until ev = 0
For y = 0 To #YNUM
For x = 0 To #XNUM
RotateEntity(m(x,y)\id, 0.5, -1, 0.8, #PB_Relative)
Next x
Next y
RenderWorld()
FlipBuffers()
ExamineKeyboard()
If KeyboardReleased(#PB_Key_1)
Index = 1
da(Index)\PhysOn = #False
RET = CreateTheObjects(1)
da(index)\numOfMesh = #XNUM*#YNUM
da(Index)\Primitive = "CreateCube"
ElseIf KeyboardReleased(#PB_Key_2)
Index = 2
da(Index)\PhysOn = #False
RET = CreateTheObjects(2)
da(index)\numOfMesh = #XNUM*#YNUM
da(Index)\Primitive = "CreateCylinder"
ElseIf KeyboardReleased(#PB_Key_3)
index = 3
da(Index)\PhysOn = #False
RET = CreateTheObjects(3)
da(index)\Primitive = "CreateSphere"
da(index)\numOfMesh = #XNUM*#YNUM
EndIf
If KeyboardReleased(#PB_Key_Space)
EnableWorldPhysics(1)
da(Index)\PhysOn = #True
EndIf
SetGadgetText(1, "Type created: " + da(Index)\Primitive)
SetGadgetText(2, "Creation time: " + Str(da(Index)\ms))
SetGadgetText(3, "Average Fps: " + Str(da(Index)\avgFrame))
SetGadgetText(4, "Num of objects: " + Str(da(Index)\numOfMesh))
SetGadgetText(5, "Physics Active: " + Str(da(Index)\PhysOn))
da(index)\avgFrame = Engine3DStatus(#PB_Engine3D_AverageFPS)
Until KeyboardPushed(#PB_Key_Escape) Or Quit = #True
Procedure.i CreateTheObjects(Index.i = 1)
Protected elap.i
Protected x.i, y.i, ms.i, txt.s
EnableWorldPhysics(0)
;free everything And start over....
For y = 0 To #YNUM
For x = 0 To #XNUM
With m(x,y)
If IsEntity(\id) > 0
FreeEntityBody(\id)
FreeEntity(\id)
FreeMaterial(\ma)
FreeTexture(\tx)
FreeMesh(\ms)
EndIf
EndWith
Next x
Next y
;Populate everything once again...Time it...
elap = ElapsedMilliseconds()
For y = 0 To #YNUM
For x = 0 To #XNUM
With m(x,y)
Select Index
Case 1 ; cube
\ms = CreateCube(#PB_Any, 0.5)
txt = "Cube"
Case 2 ; cylinder
\ms = CreateCylinder(#PB_Any, 0.5, 0.5)
txt = "Cylinder"
Case 3 ; Sphere
\ms = CreateSphere(#PB_Any, 0.5)
txt = "Sphere"
EndSelect
CompilerIf #PB_Compiler_Version >= 550
\tx = CreateTexture(#PB_Any, 10, 10, "Texture_" + Str(Random(80000, 1000)))
CompilerElse
\tx = CreateTexture(#PB_Any, 10, 10)
CompilerEndIf
StartDrawing(TextureOutput(\tx))
Box(0, 0, 10, 10, RGB(Random(255,100), Random(255,100), Random(255,100)))
StopDrawing()
\ma = CreateMaterial(#PB_Any, TextureID(\tx))
\id = CreateEntity(#PB_Any, MeshID(\ms), MaterialID(\ma), -(#XNUM/2) + (x+1), -(#YNUM/2) + (y+1), 0)
Select Index
Case 1
CreateEntityBody(\id, #PB_Entity_BoxBody) ;edit..Tried with boxbody on each - now changed to the appropriate bodies.
Case 2
CreateEntityBody(\id, #PB_Entity_CylinderBody)
Case 3
CreateEntityBody(\id, #PB_Entity_SphereBody)
EndSelect
EndWith
Next x
Next y
da(Index)\ms = ElapsedMilliseconds()-elap
ProcedureReturn #True
EndProcedure
Escape to exit.
Code: Select all
;Stress test 2 (random objects)
;Results on my system - See signature
;Purebasic 5.43/5.44 LTS
;Approx. 730 objects created before fps begins to drop.
;-----------------------------------------------------------------
;PureBasic 5.60 (all betas)
;Approx. 270-290 objects created before fps begins to drop - drastically
;-----------------------------------------------------------------
InitEngine3D()
InitSprite()
InitKeyboard()
Structure _object
id.i
ma.i
ms.i
tx.i
EndStructure
Structure _Box
left._object
right._object
front._object
back._object
bottom._object
EndStructure
Declare.i MakeNewObject()
Declare.i MakeBox()
Global NewList ob._object(), b._Box
Global elap.i
AntialiasingMode(#PB_AntialiasingMode_x6)
OpenWindow(0, 0, 0, 1024, 768, "Stress test 2", #PB_Window_ScreenCentered|#PB_Window_SystemMenu)
OpenWindowedScreen(WindowID(0), 0, 0, 800, 768)
StringGadget(0, 801, 0, 224, 25, "")
StringGadget(1, 801, 26, 224, 25, "")
StringGadget(2, 801, 52, 224, 25, "")
StringGadget(3, 801, 79, 224, 25, "")
StringGadget(4, 801, 110, 224, 25, "")
CreateCamera(0, 0, 0, 100, 100)
MoveCamera(0, 0, 0, 25)
MakeBox()
SetGadgetText(4, "Version: " + #PB_Compiler_Version)
Repeat
Repeat
ev = WindowEvent()
Until ev = 0
If ElapsedMilliseconds() - elap > 100
MakeNewObject()
elap = ElapsedMilliseconds()
EndIf
RenderWorld()
FlipBuffers()
SetGadgetText(0, Str(ListSize(ob())-1) + " objects")
SetGadgetText(1, Str(Engine3DStatus(#PB_Engine3D_AverageFPS))+ " fps")
SetGadgetText(2, Str(Engine3DStatus(#PB_Engine3D_NbRenderedTriangles)) + " triangles")
SetGadgetText(3, Str(Engine3DStatus(#PB_Engine3D_NbRenderedBatches)) + " batches")
ExamineKeyboard()
Until KeyboardPushed(#PB_Key_Escape)
Procedure.i MakeBox()
Protected tx.i, ma.i
CompilerIf #PB_Compiler_Version >= 550
tx = CreateTexture(#PB_Any, 100, 100, "Glassy")
CompilerElse
tx = CreateTexture(#PB_Any, 100, 100)
CompilerEndIf
StartDrawing(TextureOutput(tx))
DrawingMode(#PB_2DDrawing_AlphaBlend)
Box(0, 0, 100, 100, $11FDC045)
StopDrawing()
ma = CreateMaterial(#PB_Any, TextureID(tx))
MaterialBlendingMode(ma, #PB_Material_Color)
With b\front
\ms = CreatePlane(#PB_Any, 12, 14, 1, 1, 1, 1)
\id = CreateEntity(#PB_Any,MeshID(\ms), MaterialID(ma), 0, 0, -5)
RotateEntity(\id, 90, 0, 0)
EndWith
With b\back
\ms = CreatePlane(#PB_Any, 12, 14, 1, 1, 1, 1)
\id = CreateEntity(#PB_Any,MeshID(\ms), MaterialID(ma), 0, 0, 5)
RotateEntity(\id, 90, 0, 0)
EndWith
With b\left
\ms = CreatePlane(#PB_Any, 14, 12, 1, 1, 1, 1)
\id = CreateEntity(#PB_Any,MeshID(\ms), MaterialID(ma), -5, 0, 0)
RotateEntity(\id, 0, 0, -90)
EndWith
With b\right
\ms = CreatePlane(#PB_Any, 14, 12, 1, 1, 1, 1)
\id = CreateEntity(#PB_Any,MeshID(\ms), MaterialID(ma), 5, 0, 0)
RotateEntity(\id, 0, 0, 90)
EndWith
With b\bottom
\ms = CreateCube(#PB_Any, 1)
\id = CreateEntity(#PB_Any,MeshID(\ms), MaterialID(ma), 0, -5, 0)
ScaleEntity(\id, 10, 1, 10)
EndWith
CreateEntityBody(b\back\id, #PB_Entity_StaticBody)
CreateEntityBody(b\front\id, #PB_Entity_StaticBody)
CreateEntityBody(b\bottom\id, #PB_Entity_StaticBody)
CreateEntityBody(b\left\id, #PB_Entity_StaticBody)
CreateEntityBody(b\right\id, #PB_Entity_StaticBody)
EndProcedure
Procedure.i MakeNewObject()
Protected Index.i = Random(100)
AddElement(ob())
CompilerIf #PB_Compiler_Version >= 550
ob()\tx = CreateTexture(#PB_Any, 10, 10, "Texture_" + Str(Random(20000,100)))
CompilerElse
ob()\tx = CreateTexture(#PB_Any, 10, 10)
CompilerEndIf
StartDrawing(TextureOutput(ob()\tx))
DrawingMode(#PB_2DDrawing_AlphaBlend)
Box(0, 0, 10, 10, RGBA(Random(255,30), Random(255,30), Random(255, 30), Random(255,20)))
StopDrawing()
ob()\ma = CreateMaterial(#PB_Any, TextureID(ob()\tx))
MaterialBlendingMode(ob()\ma, #PB_Material_Add)
CompilerIf #PB_Compiler_Version <= 545
Select Index
Case 0 To 25
ob()\ms = CreateCube(#PB_Any, 0.5)
ob()\id = CreateEntity(#PB_Any, MeshID(ob()\ms), MaterialID(ob()\ma), 0, Random(10,8), 0)
CreateEntityBody(ob()\id, #PB_Entity_BoxBody)
Case 26 To 50
ob()\ms = CreateCylinder(#PB_Any, 0.5, 0.5)
ob()\id = CreateEntity(#PB_Any, MeshID(ob()\ms), MaterialID(ob()\ma), 0, Random(10,8), 0)
CreateEntityBody(ob()\id, #PB_Entity_CylinderBody)
Case 51 To 75
ob()\ms = CreateCone(#PB_Any, 0.5, 0.5, 16, 16)
ob()\id = CreateEntity(#PB_Any, MeshID(ob()\ms), MaterialID(ob()\ma), 0, Random(10,8), 0)
CreateEntityBody(ob()\id, #PB_Entity_CapsuleBody)
Default
ob()\ms = CreateSphere(#PB_Any, 0.5)
ob()\id = CreateEntity(#PB_Any, MeshID(ob()\ms), MaterialID(ob()\ma), 0, Random(10,8), 0)
CreateEntityBody(ob()\id, #PB_Entity_SphereBody)
EndSelect
CompilerElse
Select Index
Case 0 To 25
ob()\ms = CreateCube(#PB_Any, 0.5)
ob()\id = CreateEntity(#PB_Any, MeshID(ob()\ms), MaterialID(ob()\ma), 0, Random(10,8), 0)
CreateEntityBody(ob()\id, #PB_Entity_BoxBody)
Case 26 To 50
ob()\ms = CreateCylinder(#PB_Any, 0.5, 0.5)
ob()\id = CreateEntity(#PB_Any, MeshID(ob()\ms), MaterialID(ob()\ma), 0, Random(10,8), 0)
CreateEntityBody(ob()\id, #PB_Entity_CylinderBody)
Case 51 To 75
ob()\ms = CreateCone(#PB_Any, 0.5, 0.5, 16, 16)
ob()\id = CreateEntity(#PB_Any, MeshID(ob()\ms), MaterialID(ob()\ma), 0, Random(10,8), 0)
CreateEntityBody(ob()\id, #PB_Entity_ConeBody)
Default
ob()\ms = CreateSphere(#PB_Any, 0.5)
ob()\id = CreateEntity(#PB_Any, MeshID(ob()\ms), MaterialID(ob()\ma), 0, Random(10,8), 0)
CreateEntityBody(ob()\id, #PB_Entity_SphereBody)
EndSelect
CompilerEndIf
EndProcedure
Code: Select all
;Stress test 3 (Needs permission to write to file)
;PB 5.43/5.44 Versus PB 5.50 and up to 5.60 FINAL
;--------------------------------------------------------------------------------------
;KEYS
;SPACE KEY - START/STOP THE CREATION OF PHYSICS OBJECTS
;RETURN KEY - RESETS THE STRESS TEST AND BEGINS ANEW (IT DOES NOT RESET PHYSICS CREATION PROCESS IF TURNED ON)
;NOTE:
;Decrease the number of objects in d\max (INIT() - procedure), when you add physics objects.
;1500 as maximum is way too many - unless you got a real beast of a machine.
;
;ESCAPE KEY EXITS PROGRAM
;
;If the framerate gets too low, a message appears, the log file is displayed and the program ends.
;--------------------------------------------------------------------------------------
DisableDebugger
InitEngine3D()
InitSprite()
InitKeyboard()
Structure _object
id.i
ma.i
ms.i
tx.i
EndStructure
Global NewList ob._object(), ground._object
Structure _Data
count.i
Max.i
start.i
interval.i
txt.s
phy.i
phynum.i
cam.i
nod.i
EndStructure
Global d._Data
Declare.i Init()
Declare.i MakeNewObject()
Declare.f NewPos()
Declare.i ResetObjects()
Declare.i WriteTheTest()
Global quit.i, elap.i, node.i, ret.i, isSet.i = #False
AntialiasingMode(#PB_AntialiasingMode_x6)
OpenWindow(0, 0, 0, 1024, 768, "Stress test 3", #PB_Window_ScreenCentered|#PB_Window_SystemMenu)
OpenWindowedScreen(WindowID(0), 0, 0, 800, 768)
StringGadget(0, 801, 0, 224, 25, "")
StringGadget(1, 801, 26, 224, 25, "")
StringGadget(2, 801, 52, 224, 25, "")
StringGadget(3, 801, 79, 224, 25, "")
StringGadget(4, 801, 110, 224, 25, "")
StringGadget(5, 801, 140, 224, 25, "")
StringGadget(6, 801, 170, 224, 25, "")
TextGadget(7, 801, 200, 224, 25, "Physic object creation: " + Str(phy))
Init()
Repeat
Repeat
ev = WindowEvent()
If ev = #PB_Event_CloseWindow : quit = #True : EndIf
Until ev = 0
If ListSize(ob()) < d\start
ret = MakeNewObject()
Else
If d\start < d\Max
d\start + d\interval
ResetObjects()
ElseIf d\start > d\Max-1 And isSet = #False
d\txt + GetGadgetText(0) + #CRLF$
d\txt + GetGadgetText(1) + #CRLF$
d\txt + GetGadgetText(2) + #CRLF$
d\txt + GetGadgetText(3) + #CRLF$
d\txt + GetGadgetText(5) + #CRLF$
d\txt + GetGadgetText(6) + #CRLF$ + #CRLF$
WriteTheTest()
isSet = #True
EndIf
EndIf
RotateNode(d\nod, 0, 0.6, 0, #PB_Relative)
RenderWorld()
FlipBuffers()
If isSet = #False
SetGadgetText(0, Str(ListSize(ob())-1) + " objects")
SetGadgetText(1, Str(Engine3DStatus(#PB_Engine3D_CurrentFPS))+ " fps")
SetGadgetText(2, Str(Engine3DStatus(#PB_Engine3D_NbRenderedTriangles)) + " triangles")
SetGadgetText(3, Str(Engine3DStatus(#PB_Engine3D_NbRenderedBatches)) + " batches")
CompilerIf #PB_Compiler_Version >= 550
SetGadgetText(5, "Time spent: " + Str(ElapsedMilliseconds()-elap) + " ms.")
CompilerElse
SetGadgetText(5, "Time spent: " + Str(ElapsedMilliseconds()-elap) + " ms.")
CompilerEndIf
SetGadgetText(6, "Physics objects: " + Str(d\phynum))
EndIf
ExamineKeyboard()
If KeyboardReleased(#PB_Key_Space)
If d\phy = #True : d\phy = #False : Else : d\phy = #True : EndIf
SetGadgetText(7, "Physic object creation: " + Str(d\phy))
EndIf
If KeyboardReleased(#PB_Key_Return) ; Reset test
d\start = d\interval
d\txt = ""
ret = ResetObjects()
isSet = #False
EndIf
If ListSize(ob()) > 200 And Engine3DStatus(#PB_Engine3D_CurrentFPS) < 10
MessageRequester("Fps too slow!!", "The fps is way to low! Decrease the d\max value accordingly (Init() procedure)" + #CRLF$ + "and run test again")
d\txt + GetGadgetText(0) + #CRLF$
d\txt + GetGadgetText(1) + #CRLF$
d\txt + GetGadgetText(2) + #CRLF$
d\txt + GetGadgetText(3) + #CRLF$
d\txt + GetGadgetText(5) + #CRLF$
d\txt + GetGadgetText(6) + #CRLF$ + #CRLF$
WriteTheTest()
isSet = #True
End
EndIf
Until KeyboardPushed(#PB_Key_Escape) Or quit = #True
Procedure.i MakeNewObject()
Protected Index.i = Random(100)
AddElement(ob())
CompilerIf #PB_Compiler_Version >= 550
ob()\tx = CreateTexture(#PB_Any, 10, 10, "Texture_" + Str(Random(20000,100)))
CompilerElse
ob()\tx = CreateTexture(#PB_Any, 10, 10)
CompilerEndIf
StartDrawing(TextureOutput(ob()\tx))
DrawingMode(#PB_2DDrawing_AlphaBlend)
Box(0, 0, 10, 10, RGBA(Random(255,30), Random(255,30), Random(255, 30), Random(255,20)))
StopDrawing()
ob()\ma = CreateMaterial(#PB_Any, TextureID(ob()\tx))
MaterialBlendingMode(ob()\ma, #PB_Material_Add)
CompilerIf #PB_Compiler_Version <= 545
Select Index
Case 0 To 25
ob()\ms = CreateCube(#PB_Any, 1)
ob()\id = CreateEntity(#PB_Any, MeshID(ob()\ms), MaterialID(ob()\ma), NewPos(), NewPos(), NewPos())
If d\phy = #True : CreateEntityBody(ob()\id, #PB_Entity_BoxBody) : d\phynum + 1 : EndIf
Case 26 To 50
ob()\ms = CreateCylinder(#PB_Any, 1, 1)
ob()\id = CreateEntity(#PB_Any, MeshID(ob()\ms), MaterialID(ob()\ma), NewPos(), NewPos(), NewPos())
If d\phy = #True : CreateEntityBody(ob()\id, #PB_Entity_CylinderBody) : d\phynum + 1 : EndIf
Case 51 To 75
ob()\ms = CreateCone(#PB_Any, 1, 1, 16, 16)
ob()\id = CreateEntity(#PB_Any, MeshID(ob()\ms), MaterialID(ob()\ma), NewPos(), NewPos(), NewPos())
If d\phy = #True : CreateEntityBody(ob()\id, #PB_Entity_ConeBody) : d\phynum + 1 : EndIf
Default
ob()\ms = CreateSphere(#PB_Any, 1)
ob()\id = CreateEntity(#PB_Any, MeshID(ob()\ms), MaterialID(ob()\ma), NewPos(), NewPos(), NewPos())
If d\phy = #True : CreateEntityBody(ob()\id, #PB_Entity_SphereBody) : d\phynum + 1 : EndIf
EndSelect
CompilerElse
Select Index
Case 0 To 25
ob()\ms = CreateCube(#PB_Any, 1)
ob()\id = CreateEntity(#PB_Any, MeshID(ob()\ms), MaterialID(ob()\ma), NewPos(), NewPos(), NewPos())
If d\phy = #True : CreateEntityBody(ob()\id, #PB_Entity_BoxBody) : d\phynum + 1 : EndIf
Case 26 To 50
ob()\ms = CreateCylinder(#PB_Any, 1, 1)
ob()\id = CreateEntity(#PB_Any, MeshID(ob()\ms), MaterialID(ob()\ma), NewPos(), NewPos(), NewPos())
If d\phy = #True : CreateEntityBody(ob()\id, #PB_Entity_CylinderBody) : d\phynum + 1 : EndIf
Case 51 To 75
ob()\ms = CreateCone(#PB_Any, 1, 1, 16, 16)
ob()\id = CreateEntity(#PB_Any, MeshID(ob()\ms), MaterialID(ob()\ma), NewPos(), NewPos(), NewPos())
If d\phy = #True : CreateEntityBody(ob()\id, #PB_Entity_ConeBody) : d\phynum + 1 : EndIf
Default
ob()\ms = CreateSphere(#PB_Any, 1)
ob()\id = CreateEntity(#PB_Any, MeshID(ob()\ms), MaterialID(ob()\ma), NewPos(), NewPos(), NewPos())
If d\phy = #True : CreateEntityBody(ob()\id, #PB_Entity_SphereBody) : d\phynum + 1 : EndIf
EndSelect
CompilerEndIf
ProcedureReturn #True
EndProcedure
Procedure.i Init()
d\cam = CreateCamera(#PB_Any, 0, 0, 100, 100)
MoveCamera(d\cam, 0, 0, 150)
CameraLookAt(d\cam, 0, -30, 0)
d\nod = CreateNode(#PB_Any, 0, 0, 0)
AttachNodeObject(d\nod, CameraID(d\cam))
;Create ground
With ground
\ms = CreateCube(#PB_Any, 1)
TransformMesh(\ms, 0, 0, 0, 180, 5, 180, 0, 0, 0)
UpdateMeshBoundingBox(\ms)
CompilerIf #PB_Compiler_Version >= 550
\tx = CreateTexture(#PB_Any, 10, 10, "Groundtexture")
CompilerElse
\tx = CreateTexture(#PB_Any, 10, 10)
CompilerEndIf
StartDrawing(TextureOutput(\tx))
DrawingMode(#PB_2DDrawing_Gradient)
FrontColor($AAAAAA) : BackColor($D600A3)
LinearGradient(0, 0, 10, 10)
Box(0,0,10,10)
StopDrawing()
\ma = CreateMaterial(#PB_Any, TextureID(\tx))
\id = CreateEntity(#PB_Any, MeshID(\ms), MaterialID(\ma), 0, -60, 0)
CreateEntityBody(\id, #PB_Entity_StaticBody)
EndWith
SetGadgetText(4, "Version: " + #PB_Compiler_Version)
elap = ElapsedMilliseconds()
d\Max = 1500 ; UNLESS YOU'RE RUNNING FAST PC, YOU MAY MAY TO LOWER THIS NUMBER!! RAISE IT IF YOU GOT A MUSCLE PC.
d\interval = d\Max / 4
d\start = d\interval
EndProcedure
Procedure.f NewPos()
Protected max.f = 20, min.f = -20
Protected Seed = Date()
ProcedureReturn (Min + (Max - Min) * Random(Seed) / Seed)
EndProcedure
Procedure.i ResetObjects()
ForEach ob()
If IsEntity(ob()\id)
FreeEntity(ob()\id)
FreeMaterial(ob()\ma)
FreeTexture(ob()\tx)
FreeMesh(ob()\ms)
EndIf
Next
ClearList(ob())
d\txt + GetGadgetText(0) + #CRLF$
d\txt + GetGadgetText(1) + #CRLF$
d\txt + GetGadgetText(2) + #CRLF$
d\txt + GetGadgetText(3) + #CRLF$
d\txt + GetGadgetText(4) + #CRLF$
d\txt + GetGadgetText(5) + #CRLF$
d\txt + GetGadgetText(6) + #CRLF$ + #CRLF$
d\phynum = 0
elap = ElapsedMilliseconds()
ProcedureReturn #True
EndProcedure
Procedure.i WriteTheTest()
Protected pa.s = GetPathPart(ProgramFilename()) + "StressTestLog_phy_" + Str(d\phy) + "_" + Str(#PB_Compiler_Version) + ".txt"
Protected fl.i = CreateFile(#PB_Any, pa,#PB_UTF8)
If IsFile(fl)
WriteString(fl, d\txt, #PB_UTF8)
CloseFile(fl)
RunProgram(pa, "", GetPathPart(pa),#PB_Program_Open)
EndIf
d\txt = ""
ProcedureReturn #True
EndProcedure