; Blood Alley - External Media Free Screensaver ; 2006 Mental Illusion Graphics3D 640,480 Dim vert(15,16) Type Cell Field Mesh Field Phys End Type Camera = CreateCamera() CameraFogMode Camera,1 CameraFogColor Camera,50,0,0 CameraFogRange Camera,0,255 Global Spread = 30 light = CreateLight(1) RotateEntity light,-40,0,0 box = CreateCylinder(32) RotateMesh box,90,0,0 ScaleEntity box,-spread,-spread,-1000 EntityColor box,100,0,0 Global Cell = CreateCell() Function CreateCell() Cell = CreateMesh() Surface = CreateSurface(Cell) For a# = 0 To 15 For p = 0 To 16 ; Set the radius and y position for each of the points to lathe If p = 0 Then r# = 0.0: y# = 0.06 If p = 1 Then r# = 0.2: y# = 0.06 If p = 2 Then r# = 0.4: y# = 0.118 If p = 3 Then r# = 0.46: y# = 0.175 If p = 4 Then r# = 0.58: y# = 0.23 If p = 5 Then r# = 0.75: y# = 0.23 If p = 6 Then r# = 0.87: y# = 0.175 If p = 7 Then r# = 0.93: y# = 0.118 If p = 8 Then r# = 0.96: y# = 0.00 If p = 9 Then r# = 0.93: y# = -0.118 If p = 10 Then r# = 0.87: y# = -0.175 If p = 11 Then r# = 0.75: y# = -0.23 If p = 12 Then r# = 0.58: y# = -0.23 If p = 13 Then r# = 0.46: y# = -0.175 If p = 14 Then r# = 0.4: y# = -0.118 If p = 15 Then r# = 0.2: y# = -0.06 If p = 16 Then r# = 0.0: y# = -0.06 ; do not add addtional middle verts If a = 0 Or (p > 0 And p<16) Then vert(a,p) = AddVertex(Surface,Sin(a*22.5)*r,y,Cos(a*22.5)*r) Next Next ; Create fans For a=0 To 15 aa = a -1 If aa= -1 Then aa=15 ; Inner Fans AddTriangle(Surface,vert(0,0),vert(a,1),vert(aa,1)) AddTriangle(Surface,vert(0,16),vert(aa,15),vert(a,15)) ; The rest of it For n=1 To 14 AddTriangle(surface,vert(a,n),vert(a,n+1),vert(aa,n+1)) AddTriangle(surface,vert(aa,n),vert(a,n),vert(aa,n+1)) Next Next FlipMesh cell UpdateNormals Cell Return Cell End Function Function MakeCell() O.Cell = New Cell o\mesh = CopyEntity(cell) o\phys = CreatePivot() resetcell(o) EntityShininess o\mesh,1 End Function Function ResetCell(o.Cell) ; Place cell just out of site of camera a = Rand(0,359) r = Rand(10,spread) PositionEntity o\mesh,Sin(a)*r,Cos(a)*r,1 PositionEntity o\phys,Rnd(-.2,.2),Rnd(-.2,.2),Rnd(0,.5) RotateEntity o\phys,Rnd(-.5,.5),Rnd(-.5,.5),Rnd(-.5,.5) RotateEntity o\mesh,Rnd(0,360),Rnd(0,360),Rnd(0,360) EntityColor o\mesh,Rand(100,200),Rand(0,50),0 End Function Function UpdateCell(o.Cell) TranslateEntity o\mesh,EntityX(o\phys),EntityY(o\phys),EntityZ(o\phys) TurnEntity o\mesh,EntityPitch(o\phys),EntityYaw(o\phys),EntityRoll(o\phys) ; Edge boundry x# = EntityX(o\mesh) y# = EntityY(o\mesh) z# = EntityZ(o\mesh) If (x*x) + (y*y) > ((Spread-1)* (spread-1)) Then TranslateEntity o\phys,-EntityX(o\phys)*2,-EntityY(o\phys)*2,0 ; Accelerate alway from camera TranslateEntity o\phys,0,0,.01 ; If entity is out of sight reposition If EntityZ(o\mesh) > 260 Then ResetCell(o) End Function Function DeleteCell() ; Delete the first cell in the list and free the entities o.Cell = First Cell FreeEntity o\mesh FreeEntity o\phys Delete o End Function Repeat ; Get the mouse movement ms = MouseXSpeed() + MouseYSpeed() t = MilliSecs() ; Update all the cells For o.Cell = Each Cell UpdateCell(o) Next ; turn the cam TurnEntity camera,0,0,1 ; and render RenderWorld tt = MilliSecs() ; if the screen is updating too fast create more cells and delay If tt - t < 16 Then makeCell():Delay 20-(tt-t) ; if the screen is too slow then delete a cell If tt - t > 25 Then deleteCell() Flip ; if the mouse has moved exit out or a key pressed Until ms <> (MouseXSpeed() + MouseYSpeed()) Or GetKey() > 0
Blood Alley - External Media Free screensaver
Miscellaneous Forums/Blitz Showcase/Blood Alley - External Media Free screensaver pretty sweet :)
I get a 'Program has ended' message straight away, and a MAV if I run with debug off.
Debugger stops at
Debugger stops at
Until ms <> (MouseXSpeed() + MouseYSpeed())
dont touch anything, its a screensaver, cant move your mouse or hit any key.
It's a screen saver. It'll end with any mouse movement.
I also get a MAV with Debug off.
I also get a MAV with Debug off.
I don't get the MAV here. Maybe it's the number of polys/vertices it generates. It was pushing 300,000 in full screen. Impressive :o)
I don't understand why anyone should be getting mavs. The number of cells increase until you get a stable 60fps, if the fps drops below 60 cells will be destroyed....
Unless it's deleting cells that don't exist? But that would only happen on a really slow machine.
Where does it mav?
Unless it's deleting cells that don't exist? But that would only happen on a really slow machine.
Where does it mav?
Ok, I fixed the MAV. Apparently on some machines, there is a delay while Blitz3D does some internal setup. Just put a "Delay 500" right before the Repeat statement on line 129 and it should work.
Edit:
Better option, Change the DeleteCell() function like this
Edit:
Better option, Change the DeleteCell() function like this
Function DeleteCell() ; Delete the first cell in the list and free the entities o.Cell = First Cell If o <> Null FreeEntity o\mesh FreeEntity o\phys Delete o End If End Function
Works.
Looks cool. Nice and relaxing.
Looks cool. Nice and relaxing.