Main Menu

PlayBasicFX Screen Shot Updates

Started by kevin, February 16, 2007, 11:45:46 AM

Previous topic - Next topic

kevin


Particles + Terrain

 

kevin


  Zbuffer Support

       The addition of the Z buffering makes the DrawPerspectiveSprites render Mode  into a mini 3D engine.   Z buffering allows faces to intersect each other.   This means that when your card renders each pixel of a polygon,  it calculates the Z at this pixel then selectively (if it's Z is nearer to the camera) draws it.    So  polygons will be in the correct order, regardless of depth.

       In these simple pictures you can see the previous sprite terrain/particle scene drawn using the  zbuffer.


kevin

#32
 PB 1.70

   Back working on PB1.70 again.  So far i've just been adding the new features that were added during the recent PB1.63 refresh.   Here's the the old sprite rotation demo, 200 rotating sprites, scrolling backdrop. 1000 + fps.  And it's not even remotely opt'd yet... 


Draco9898

#33
If thats not optimized, that some scary kinda fast...what system are you using?

anyways, holy sh'mokes...
DualCore Intel Core 2 processor @ 2.3 ghz, Geforce 8600 GT (latest forceware drivers), 2 gigs of ram, WIN XP home edition sp2, FireFox 2.

"You'll no doubt be horrified to discover that PlayBasic is a Programming Language." -Kevin

kevin


kevin

#35
  PB1.70a Mapping Test

       Here's the first look see (for what's it worth) of the rebuilt mapping engine.  While I could I have 'modified' the original edition of the library, it really needed to be re-written around the new image system.   Which is the current little task.    Initially, I was expecting the first slapped together version it to be slower than the older mature version of the library found PB1.63 for example.   But interestingly the code bellow is running 80fps quicker in PB1.70a  than PB1.63n.   Which is more a collective improvement than just the map rendering thing I think.   



CreateMap 1,176

BlockWidth=32
BlockHeight=32

TileX=800/BlockWidth
TileY=(600/Blockheight)+1

   CreateLevel 1,50,tileX,Tiley

NumbOfBlocks=TileX*TileY
CreateMapGFX 1,BlockWidth,BlockHeight,NumbOfBlocks,$0

LoadImage "D:\Play_Basic\ScreenShots\PB_ForestBlast_V012.JPG",1
RenderToImage 1

Ypos=0
Xpos=0
for lp=0 to NumbOfBlocks-1
GetMapBlk 1,lp,Xpos,Ypos
Xpos=Xpos+BlockWidth
if Xpos>=GetSurfaceWidth()
Xpos=0
Ypos=Ypos+Blockheight
endif
next
RenderToImage 0


Block=0
For ylp=0 to GetLevelHeight(1,50)-1
For Xlp=0 to GetLevelWidth(1,50)-1
PokeLevelTile 1,50,Xlp,ylp,block
inc block
next
next

Do

Cls 255

t=timer()
DrawMap 1,50,0,0
tt#=tt#+(timer()-t)
inc frames

TileXpos=(mousex()/GetMapBlockWidth(1))
TileYpos=(mousey()/GetMapBlockHeight(1))
pokeleveltile 1,50,TileXpos,TileYpos,TileXpos ;rnd(100)


setcursor 0,0
print fps()

print TT#/frames

print GetMapBlockQuantity(1)


Print "status:"+str$(GetLevelstatus(1,50))
Print GetLevelWidth(1,50)
Print GetLevelHeight(1,50)
Print GetMapLevels(1)

Print GetMapBlockStatus(1)
Print GetMapBlockWidth(1)
Print GetMapBlockHeight(1)
Print GetMapBlockQuantity(1)
Print GetMapMaskColour(1)

print TileXpos
print TileYpos


Sync
loop


Draco9898

DualCore Intel Core 2 processor @ 2.3 ghz, Geforce 8600 GT (latest forceware drivers), 2 gigs of ram, WIN XP home edition sp2, FireFox 2.

"You'll no doubt be horrified to discover that PlayBasic is a Programming Language." -Kevin

kevin


PB V1.70b Mapping Test

    Slowly ticking off the conversion of the various commands/functions in the new mapping library.  As such more old demos are running in PB1.70 now.   Bellow a mapping test from around 2004 which uses the Xenon 2000 art work (again :) ).   With 2 layers it's about 50->60 fps faster than PB1.63n.       

kevin


PB 1.70e - Even faster Mapping

    The replacement mapping library is basically finished in PB1.70e.    So everything should be working again from Map Animation, Block importation  through to the level helper commands.  While the first rewrite of library was approximately 25% faster than the old library in PB1.63e and bellow,   I still had a few tricks up my sleeve optimization wise. :)  Which have been implemented into PB1.70e level render.    Which in turn give us approximately another 25% performance improvement.    Making the new engine around twice as fast as it was.

     The following pics are the previous examples running in the current update.   Both demos are around 90->100fps faster than the previous test.  If you run in  full screen exclusive it's even quicker.    For the example the Xenon test which runs around the 390->400fps in windowed mode, clocks around 480->490fps in full screen exclusive.
 

kevin

#39
PB 1.70f - Shape Rotation

     This piccy is very early test of the revised shape library for PB1.70f.   In the pic it's rotating & drawing 50,000 point the shape in dot mode.



kevin

#40
  Shape Rotation Modes

  Shapes now support both 2D & 3D rotation modes.  Here's the same demo above running with 3D rotation applied.

  Speed wise the new version is about 60->70fps faster than PlayBasic V1.63n retail




vertexcount=50000
EdgeCount=VertexCount
CreateShape 10,vertexcount,EdgeCount

w=GetSCreenWidth()
h=GetSCreenHeight()
w2=w/2
h2=h/2
for lp=0 to vertexcount-1
x=rnd(w)
y=rnd(h)
SetShapeVertex 10,lp,x-w2,y-h2
SetShapeEdge 10,lp,lp,lp
next

Do
Cls 0
drawshape 10,GetSCreenWidth()/2,GetSCreenHeight()/2,0
print fps()

Sync
loop




  Note:  Rotation Mode and rotation angles are actually bumped inside the library at the moment.     

kevin

#41
PB 170 Shape Particle Demos

   Here's the old shape particles demo (in your example pack under projects/demo/shapeparticles) running in Pb1.70.   This one's around 40fps faster than PB1.63n.

 

kevin

#42
 Particle Sprinkler

    This is the sprinkler demo (see projects/demos/shapeparticlesprinkler) running in PB1.70f, and it's another 35 fps faster than PB1.63n retail. 

kevin


PB1.70g - Closest Point To Shape

     Have pretty much re-written 90% of the shape library in the day few days.   It's not really optimized, but it's far clearer.  Anyway the following picture is of an internal function that been exposed.  What is does is lets you query a shape for the closest point upon and edge within a range.    Not pretty to look at, but handy :)
   



MyShape3=NewConvexShape(100,10)
MyShape4=NewConvexShape(70,5)

MergeShape MyShape3,MyShape4


Do

Cls RGB(0,0,0)

; CreateShape 20,50,50

RotateShape myshape4,angle#,2

ShapeXpos#=400
ShapeYpos#=300


mx=mousex()
my=mousey()
Radius=100

if ClosestPointOnShape(mx,my,Radius,MyShape4,ShapeXpos#,ShapeYpos#)

x1=GetIntersectX#(0)
y1=GetIntersectY#(0)
Circlec x1,y1,50,true,rgb(100,200,50)

ink rgb(255,0,0)
print "HITSHAPE"

Else

Ink RGB(255,255,255)
print "Missed Shape"
EndIF



DrawShape MyShape4,ShapeXpos#,ShapeYpos#,2
CircleC mx,my,Radius,false,rgb(200,100,200)
ink 255

angle#=WrapAngle(angle#,0.01)
print fps()

Sync
loop

kevin

#44
 PB1.70g

     Pretty much completed the shape library rewrite and are just hooking up a few extra commands.   Which so far is limited to the rotation mode and XYZ rotation angles.




MyShape3=NewConvexShape(100,10)
MyShape4=NewConvexShape(70,5)

MergeShape MyShape3,MyShape4

Do

Cls RGB(0,0,0)


RotateShape myshape4,angle#,2

ShapeXpos#=400
ShapeYpos#=300


mx=mousex()
my=mousey()

if Scaler#=<0 then Scaler#=1
if LeftMousebutton()
Scaler#=scaler#+0.01
endif
if RightMousebutton()
Scaler#=scaler#-0.01
endif

shaperotationmode myShape3,1

rotateShapeXYZ Myshape3,Anglex#,angley#,anglez#

ScaleShape myShape3,scaler#
DRawShape MyShape3,mx,my,2

print "Rotationmode:"+Str$(Getshaperotationmode(myShape3))
print "Rotationmode:"+Str$(Getshaperotationmode(myShape4))


result=ShapeHitShape(MySHape3,mx,my,MyShape4,ShapeXpos#,ShapeYpos#)

if result
Ink rgb(255,0,0)
print "HITSHAPE"
Else
Ink RGB(255,255,255)
print "Missed Shape"
EndIF


DrawShape MyShape4,ShapeXpos#,ShapeYpos#,2
; CircleC mx,my,Radius,false,rgb(200,100,200)
ink 255

angle#=WrapAngle(angle#,0.01)

anglex#=WrapAngle(anglex#,0.11)
angley#=WrapAngle(angley#,0.22)
anglez#=WrapAngle(anglez#,0.23)

print fps()

Sync
loop