News:

Function Finder  Find all the functions within source code files

Main Menu

PlayBasic V1.64M (Work In Progress) Gallery

Started by kevin, May 25, 2010, 01:37:57 AM

Previous topic - Next topic

kevin

#45
  PlayBASIC V1.64M  Beta #27 - Quad Hit Map Pixels Collision

   Another day and another feature collision featured ticked off the To do list.     Yesterday I was getting the vector version of this command running, now we have the pixel version running.  The vector versions of collision commands detect a collision with the mathematical region that shape in question represents.   The pixel versions that this further and attempt a pixel to pixel level impact.   Where and when you'd use them largely depends upon what you're trying to do.  


 Here's the test code bellow


PlayBASIC Code: [Select]
 Dim Vertx#(4)
Dim VertY#(4)


BackdropColour=$ff0000

screen=newfximage(6400,6400)
rendertoimage screen
cls BackdropColour
circlec 800,400,400,true,$8f8f8f
circlec 1700,400,400,true,$0f8faf

for lp=0 to 150
ellipsec rnd(2400),rnd(800),rndrange(50,150),rndrange(10,50),true, BackdropColour
next

BlockWidth =64
BlockHeight=64

Map=Newmap(50)
createmapgfx Map,BlockWidth,BlockHeight,4096,BackdropColour,2; CREATE 4096 FX BLOCKS

Level=NewLevel(Map,GetSurfaceWidth()/BlockWidth,GetSurfaceHeight()/BlockHeight)
leveltransparent Map,Level,0

GetMapBlk Map,0,0,0
Tile=1

For ylp=0 to GetLevelHeight(map,level)-1
Ypos=ylp*BlockHeight
if Ypos+BlockHeight<=GetSurfaceHeight()
For xlp=0 to GetLevelWidth(map,level)-1
Xpos=xlp*BlockWidth
ink $ffff00ff
; text Xpos,ypos,Tile
ink $ffffffff
GetMapBlk Map,Tile,Xpos,ypos
; text Xpos,ypos,GetMapBlockTransparent(Map,Tile)
; GetMapBlk Map,Tile,Xpos,ypos
if GetMapBlockTransparent(Map,Tile)>-1
PokeLevelTile Map,Level,xlp,ylp,tile
tile++
else
PokeLevelTile Map,Level,xlp,ylp,0
endif

if Tile=>GetMapBlocks(Map) then exitfor ylp
next
endif
next


Screen=NEwfxIMage(800,600)

rendertoimage Screen

cam=newcamera()
cameracls cam,off

c1=rndrgb()
c2=rndrgb()




BackDrop=NEwfxIMage(800,600)
rendertoimage Backdrop
shadebox 0,0,getsurfacewidth(),GetsurfaceHeight(),c1,c1,c2,c2
rendertoscreen

RadiusX=100
RadiusY=200


Do

setcursor 0,0
MouseWorldXpos=MouseX()-1+GetCameraX(Cam)
MouseWorldYpos=MouseY()-1+GetCameraY(Cam)

capturetoscene
clsscene

capturedepth 200
drawimage BackDrop,GetCameraX(Cam),GetCameraY(Cam),false

capturedepth 100

; draw the map level

drawmap map,Level,0,0
; DRaw the the Mouse pointer within the world space
capturedepth 10

; t=timer()

Angle#=wrapangle(Angle#,1)


capturedepth 1

inkmode 1+32

Count=0
Height=70
For ylp=100 to 1000 step 150
Width=70
For xlp=00 to 2000 step 150
Collision=DRawQuad(Map,level,Xlp,ylp,Width,Height,Angle#+width)
Width+=5
Count++
next
Height+=5
next

te=timer()-t

Collision=DRawQuad(Map,level,MouseWorldXpos,MouseWorldYpos,RadiusX,RadiusY,Angle#)
inkmode 1

if Collision
Colour=$ff0000
Message$="Hit"
else
Colour=$0000ff
Message$="Missed"
endif


; draw whatever the camera can see
drawcamera cam
rendertoscreen

drawimage screen,0,0,false



setcursor 0,0
ink $ffffffff
print "Quad Hit Map Pixels"
Print "testing "+Str$(Count)+" times"
print Message$
print te


if LeftMouseBUtton()
RAdiusX+=1
Login required to view complete source code





PlayBASIC V1.64M  Beta #27 - Triangle Hit Map Pixels Collision

   Quickly tacked in the Triangle versions of the function.   Obviously they're really the same routines behind the scenes, we're just piping in 3 verts for a triangle and 4 for a quad.   Performance wise it's perhaps a little faster, but that'd be due to the reduction in area the triangles are covering.    





PlayBASIC V1.64M  Beta #28 - Shape Hit Map Collision

  Working on the ShapeHitMap routine, so far it's just started to work.  There's a few gremlins though when it's scaled for some odd reason, but that'll have to wait till i've had some sleep.







kevin


   PlayBASIC V1.64M  Beta #28 - Shape Hit Map Collision

     After a little bit of detective work it seems the odd issues with the ShapeHitMap function were caused from bounding radius of the shape.  So i've ended up replacing the bulk of that part of the library, which was unexpected, but should be for the better across the board.       The shot bellow shows the shape (the donut thing) mapped around a hard region of a block.   So it's seems to be working fairly well for the most, but there's a few annoying little overheads when calling it 1000's of  times, mostly when there's a near miss.   Which In real world situation is pretty unlikely.

   

kevin

#47
   PlayBASIC V1.64M  Beta #28 - Shape Hit Map Pixels Collision

   This is the Pixel Version of the command, which is currently about 95% up and running, there's a few little oddities left to iron out (namely when the shape is moved to a  negative y position it crashes).    Shapes unlike the Triangle and Quad polygon routines (which are always convex) are a little more of a hand full in these types of situations.  As a shape can not only only represent convex polygons, but they can also be concave and even complex (edges that intersect).   So I can't reply upon the same redundancy assumptions, making this one of the more brute force routines when deal with maps.  

   Anyway, bellow we see the donut shape being compared to the map on pixel and pixel basis.



PlayBASIC Code: [Select]
   ThisShape=NewConvexShape(50,8)
TempShape=NewConvexShape(100,6)
MergeShape TempShape,ThisSHape

BackdropColour=$ff0000

screen=newfximage(6400,6400)
rendertoimage screen
cls BackdropColour
circlec 800,400,400,true,$8f8f8f
circlec 1700,400,400,true,$0f8faf

for lp=0 to 250
ellipsec rnd(2400),rnd(800),rndrange(50,150),rndrange(10,50),true, BackdropColour
next

BlockWidth =48
BlockHeight=48

Map=Newmap(50)
createmapgfx Map,BlockWidth,BlockHeight,4096,BackdropColour,2; CREATE 4096 FX BLOCKS

Level=NewLevel(Map,GetSurfaceWidth()/BlockWidth,GetSurfaceHeight()/BlockHeight)
leveltransparent Map,Level,0

GetMapBlk Map,0,0,0
Tile=1

For ylp=0 to GetLevelHeight(map,level)-1
Ypos=ylp*BlockHeight
if Ypos+BlockHeight<=GetSurfaceHeight()
For xlp=0 to GetLevelWidth(map,level)-1
Xpos=xlp*BlockWidth
ink $ffffffff
GetMapBlk Map,Tile,Xpos,ypos
if GetMapBlockTransparent(Map,Tile)>-1
PokeLevelTile Map,Level,xlp,ylp,tile
tile++
else
PokeLevelTile Map,Level,xlp,ylp,0
endif

if Tile=>GetMapBlocks(Map) then exitfor ylp
next
endif
next


Screen=NEwfxIMage(800,600)

rendertoimage Screen

cam=newcamera()
cameracls cam,off

c1=rndrgb()
c2=rndrgb()




BackDrop=NEwfxIMage(800,600)
rendertoimage Backdrop
shadebox 0,0,getsurfacewidth(),GetsurfaceHeight(),c1,c1,c2,c2
rendertoscreen

RadiusX=100
RadiusY=200

scale#=1

Do

setcursor 0,0
MouseWorldXpos=MouseX()-1+GetCameraX(Cam)
MouseWorldYpos=MouseY()-1+GetCameraY(Cam)
; rendertoimage Screen

capturetoscene
clsscene

capturedepth 200

drawimage BackDrop,GetCameraX(Cam),GetCameraY(Cam),false

capturedepth 100

; draw the map level

drawmap map,Level,0,0
; DRaw the the Mouse pointer within the world space
capturedepth 10


t=timer()


if midMousebutton()
Angle#=wrapangle(Angle#,1)

endif

if LeftMousebUtton()
scale#+=0.001
if Scale#>3 then Scale#=0.5
endif

RotateShape ThisShape,Angle#,Scale#
Collision=ShapeHitMapPixels(Map,Level,ThisShape,MouseWorldXpos,MouseWorldYpos)

if Collision
col=$f06070
else
Col=$5060f0
endif
inkmode 1+32
oldcol=getink()
Ink Col
drawshape ThisShape,MouseWorldXpos,MouseWorldYpos,2
ink oldcol
inkmode 1
; next
te=timer()-t


if Collision
Colour=$ff0000
Message$="Hit"
else
Colour=$0000ff
Message$="Missed"
endif


; draw whatever the camera can see
drawcamera cam
rendertoscreen

drawimage screen,0,0,false



setcursor 0,0
ink $ffffffff
print "Shape Hit Map Pixels"
Print "testing "+Str$(Count)+" times"
print Message$
Login required to view complete source code



kevin

#48
  PlayBASIC V1.64M  Beta #28 - Download

  Here's latest build (Beta 28) for your beta testing pleasure.  


   Edit: Newer beta bellow !



kevin

#49
  PlayBASIC V1.64M  Beta #29 - Shape Hit Map Pixels Collision(Tweaked)

   This has been really bothering me all night, but after much head scratching finally tracked down the cause the negative Y crashes, which turned out be how the shape was being span converted.   So that issue has been fixed in today's revision, another thing that's bothering me with the pixel to pixel versions is the amount of overhead.

   Some of the overhead was from the debug code drawing the shapes bounding box... erm..  :) -   But a bigger problem was the routine had no obvious way of making an early impact detection.   So i've split the process up.  The separation allows the routines to catch impacts upon solid blocks and exit early.  This change enables us to bypass a lot of the brute force work underneath.  So overlapping big shapes over a map should generally be much faster.

   The logic changes give the ShapeHitMapPixels function a nice little speed boost, bringing it more inline with the Circle/Ellipse & polygon methods.   Bellow in this piccy we're comparing 440 odd shapes to the map scene.   This time the shapes aren't all sitting on top of each other, so the we're getting a more realistic idea of the performance impact.  Previous snippets compare the same shape in the same position to the map.  So they're either all missing completely, partly or they're all near miss at pixel level.  The latter is the worst case, since to resolve them it requires the routine do a brute force compare with the pixels.        


kevin

#50
 PlayBASIC V1.64M  Beta #29/30 - Sprite Hit Map Pixels Collision(Tweaked)

    It's been another long night digging through some of the long lost (and previously opt'd) collision routines,  but it's been a worthwhile exercise as now we can perform pixel to pixel level impacts between sprites and the map.    Pictured bellow is the first version of the SpriteHitMapPixels function in action.    This function will be used when you want to 'compare' the pixels with the map.  The SpriteHitMap function will use the Sprites current collision mode.  So  a sprites that's set to the rotated rectangle, will compare the a rectangle volume rather than the pixel data.  If it's set to circle, it'll use the circle volume and so on.  If it's set to pixel, then it'll do a Pixel level impact.    
 
    Speed wise the routine is only about  50% slower than the straight vector to pixels methods above when doing a 1000 tests.   Although it really depends upon the situation.  A near miss is the slowest situation.  By that I mean, when the routine has to check lots of pixel data that's very close to the sprite, but not actually overlapping it.   Accuracy wise there's bound to be some variations between the collision span routines and rendering span routines (they use different accuracy).  But that's par for the course I'm afraid.  

   

kevin

#51
 
PlayBASIC V1.64M  Beta #30 - Download

  Here's latest build (Beta 30) for your continued beta testing pleasure.    This one tweaks the shape hit maps functions and introduces the SpriteHitMapPixels function.  Have fun !


  old file deleted


kevin

 PlayBASIC V1.64M  Beta #31 - Sprite Hit Map / Supporting all collision modes

    The current task has been getting SpriteHitMap Functions to support various sprite collision modes, which are the Rect, Rotated,Circle,Shape and Pixels.   Here we've looking at the a sprite set to shape mode (with a rough shape outline) in both m,odes.  The first is detecting if the regions overlap, the second is stepping down to pixels.

     The next little challenge will be add support to these routines for video formatted blocks, as currently they only support FX format.


kevin

#53
  PlayBASIC V1.64M  Beta #32 - Circle/Ellipse/tri and QuadHitMapPixels Support Video Blocks

    Yep, you guessed it, now all of the new collision functions include support for video formatted map blocks.   The only one's remaining are Shape and Sprite modes.  


PlayBASIC Code: [Select]
 Constant VideoBlocks=true


Dim Vertx#(4)
Dim VertY#(4)

BackdropColour=$ff0000

screen=newfximage(6400,6400)
rendertoimage screen
cls BackdropColour
circlec 800,400,400,true,$8f8f8f
circlec 1700,400,400,true,$0f8faf

for lp=0 to 150
ellipsec rnd(2400),rnd(800),rndrange(50,150),rndrange(10,50),true, BackdropColour
next

BlockWidth =64
BlockHeight=64

Map=Newmap(50)
BLockType=2
if VideoBlocks=true then BlockType=1


createmapgfx Map,BlockWidth,BlockHeight,4096,BackdropColour,1; CREATE 4096 FX BLOCKS


Level=NewLevel(Map,GetSurfaceWidth()/BlockWidth,GetSurfaceHeight()/BlockHeight)
leveltransparent Map,Level,0

GetMapBlk Map,0,0,0
Tile=1

For ylp=0 to GetLevelHeight(map,level)-1
Ypos=ylp*BlockHeight
if Ypos+BlockHeight<=GetSurfaceHeight()
For xlp=0 to GetLevelWidth(map,level)-1
Xpos=xlp*BlockWidth
ink $ffff00ff
; text Xpos,ypos,Tile
ink $ffffffff
GetMapBlk Map,Tile,Xpos,ypos
; text Xpos,ypos,GetMapBlockTransparent(Map,Tile)
; GetMapBlk Map,Tile,Xpos,ypos
if GetMapBlockTransparent(Map,Tile)>-1
PokeLevelTile Map,Level,xlp,ylp,tile
tile++
else
PokeLevelTile Map,Level,xlp,ylp,0
endif

if Tile=>GetMapBlocks(Map) then exitfor ylp
next
endif
next



if VideoBlocks=true
Screen=NEwIMage(800,600)
else
Screen=NEwFXIMage(800,600)

endif


rendertoimage Screen

cam=newcamera()
cameracls cam,off

c1=rndrgb()
c2=rndrgb()


BackDrop=NEwfxIMage(800,600)
rendertoimage Backdrop
shadebox 0,0,getsurfacewidth(),GetsurfaceHeight(),c1,c1,c2,c2
rendertoscreen

RadiusX=100
RadiusY=200


Do

setcursor 0,0
MouseWorldXpos=MouseX()-1+GetCameraX(Cam)
MouseWorldYpos=MouseY()-1+GetCameraY(Cam)

capturetoscene
clsscene

capturedepth 200
drawimage BackDrop,GetCameraX(Cam),GetCameraY(Cam),false

capturedepth 100

; draw the map level

drawmap map,Level,0,0
; DRaw the the Mouse pointer within the world space
capturedepth 10

; t=timer()

Angle#=wrapangle(Angle#,1)


capturedepth 1

inkmode 1+32
Collision=EllipseHitMapPixels(Map,level,MouseWorldXpos+300,MouseWorldYpos,RadiusX/2,RadiusY/2)

if Collision
Colour=$ff0000
Message1$="Hit"
else
Colour=$0000ff
Message1$="Missed"
endif

EllipseC MouseWorldXpos+300,MouseWorldYpos,RadiusX/2,RadiusY/2,true,colour
inkmode 1


; inkmode 1+32

Count=0
Height=70
For ylp=100 to 1000 step 150
Width=70
For xlp=00 to 2000 step 150
; Collision=DRawQuad(Map,level,Xlp,ylp,Width,Height,Angle#+width)
Width+=5
Count++
next
Height+=5
next

te=timer()-t

Collision=DRawQuad(Map,level,MouseWorldXpos,MouseWorldYpos,RadiusX,RadiusY,Angle#)
inkmode 1

Login required to view complete source code




kevin

#54
  PlayBASIC V1.64M  Beta #33 -  Video Block Support For All MapHitPixel functions + Optimizations

     Added the final couple of video methods in today, they as expected a pretty slow, but they have to be for completeness.  The other thing I've been working on is some optimizations of the built in Level functions.  Namely the removal of the some of the memory management wrapping.  Which is negligible when doing a small number of level reads or writes, but can really compound itself when put under stress reading lots of lots of tiles.  

    To demo this, the code bellow creates a 1000*1000 tile level and then both clones the level using the CloneLevel() and manually compares it with tile by tile.  The results are pretty interesting.  CopyLevel in Beta33 is about 10 times faster than in Beta 30. Moreover the manual compare loop, is about 10% faster.   Which will have a flow on effect.  


PlayBASIC Code: [Select]
   Map=newmap(32)

CreateMapGFX map,64,64,5,$000000
cls 255
getmapblk map,0,0,0
cls $00ff00
getmapblk map,1,0,0


Width=1000
Height=1000
Level1=newlevel(Map,Width,Height)
Level2=newlevel(Map,Width*2,Height)

For Ylp=0 to height-1
For Xlp=0 to Width-1
PokeLEvelTile Map,Level1,xlp,ylp,rnd(2)
next
next

Do

Cls 0

Frames++

if SpaceKey()=false
drawmap Map,Level1,0,0
print "Normal Version"
else
drawmap Map,Level2,0,0
print "Cloned Version"
endif


t=timer()
CloneLevel Map,Level1,Map,level2
tt1#+=timer()-t
print "Average Clone Speed:"+str$(tt1#/frames)



t=timer()
CompareLevel(Map,Level1,Level2)
tt2#+=timer()-t

print "Average Manual Compare Speed:"+str$(tt2#/frames)

Sync
loop



Function CompareLevel(Map,Level1,Level2)

width =GetLevelWidth(Map,Level1)
Height =GetLevelHeight(Map,Level1)

For ylp=0 to height
For Xlp=0 to Width
Tile1=PeekLevelTile(Map,Level1,xlp,ylp)
Tile2=PeekLevelTile(Map,Level2,xlp,ylp)
if Tile1<>Tile2
err=1
#print "different"
endif
next
next

if Err
print "Not the same"
endif
EndFunction








 PlayBASIC V1.64M  Beta #33 -  Download

  old file removed





kevin


   PlayBASIC V1.64M  Beta #34 - RectOccludeMap - Manual Occlusion

     Occlusion support is one of things I've been wanted to implement for some time, but there's always the little stumbling block of just how.   For those not familiar, occlusion is a series of conceptual techniques (often customized to the problem) that are used to remove redundant drawing operations from the screen refresh.   The idea being to preemptively prohibit the graphics engine from drawing images that's won't actually be visible to the player, due to being behind something else, so why draw them. 

     A common situation occurs when drawing a multiple map layers over each other.   If we imagine a scene with 2 or more layers, then normally we'd draw them all over each other regardless of what was in screen.  So with 3 layers, we're potentially draw every pixel 3 times.   With modern hardware this is not really that big of a deal (assuming a medium screen resolution), but if you want your games to run on more than just modern windows boxes, then it's worth seeing if we can cull out any of the redunant rendering.  This will help speed up the layer rendering, which could potentially boost you games performance not only on the older machines but newer ones too.  Which means you'll be able to squeeze more action into the game then without it.

     So to help programmers start tackling such problems with maps, i've been implementing a RectOccludeMap function.  This function works out what blocks it's covering within the level, then clears them.  So when the level is rendered,  at section will be blocked out.  To demostrate this , i've  made a little demo with a backdrop picture and single scrolling in the foreground.  The Mouse is moved over the frame and the region it covers is culled from the backdrop. 

     

   


kevin

#56
   PlayBASIC V1.64M  Beta #34 - 3 Map Layers With Occlusion

    The following pic's and code are an extension of the previous two layer demo.   Except this time, we've added a third layer and some occlusion zones to help masking out the middle background layer.    To build the layers, I've simply drawing a large picture then cut them up into tiles in code.  The middle layer is some random tube things and front layer is of some bricks with a sine wave cut out of it. Neither are optimization into the most minimal block set, but will do for the sake of an example.  

    Without occlusion the demo runs nicely around the 250-270 fps make.   It varies as the on screen pixel count varies frame to frame.   With occlusion the rate sit around the  310-330 fps.   Which in this demo, is about the speed of rendering the two back layers without occlusion.   So we're virtually getting the third layer for free.      


 Requires PlayBasic V1.64  Beta 34!

 
PlayBASIC Code: [Select]
      file$="_INSERT_NAME_OF_BACKDROP_PICTURE_HERE"

print "Loading Backdrop"
Sync
Backdrop2=LoadNewfxImage(File$)
scaleimage Backdrop2,GEtImageWidth(Backdrop2),600,1+2
Backdrop=NewImage(GEtImageWidth(Backdrop2),600)
CopyRect Backdrop2,0,0,GEtImageWidth(Backdrop2),600,Backdrop,0,0
deleteimage backdrop2

Constant Projection=400

SceneWidth =GetSCreenWidth()*2
SceneHeight =GetScreenHeight()*2

Screen=NewFXIMage(SceneWidth,SceneHeight)

print "Building Tube"
Sync

rendertoimage Screen
For Z= 3000 to 200 step -50
width=rndrange(150,250)
width2=width/2
x=rndrange(width2,SceneWidth-width2)
y=100+rnd(SceneHeight/2)
ThisRGB=RndRGB()
DrawTube(x,y,500+z,width,900,ThisRGB)
next

rendertoscreen
print "Building TubeMap"
Sync

TubeMap=MakeMapFromIMage(Screen,24,24)



rendertoscreen
print "Building WaveMap"
Sync


File$="D:\Source_Codes\GFX\Textures\Brick.bmp"
BrickImage=LoadNewImage(File$)
ScaleImage BrickIMage,32,32,1+2


RendertoIMage Screen
Cls 0
TileImage BrickImage,0,0,true

;
Angle#=0
AngleStep#=720.0/GetImageWidth(Screen)
For xlp=0 to GetImageWidth(Screen)
y=420+sin(Angle#)*100
linec xlp,y,xlp,0,0
Angle#+=AngleStep#
next


Type TRects
x1,y1,x2,y2
EndType

Dim GroundZones as tRects list

AddRect(0,520,GetImageWidth(Screen) ,800)

AddRect(500,350,700 ,520)
AddRect(430,400,770 ,580)

offset=800
AddRect(offset+500,350,offset+700 ,520)
AddRect(offset+430,400,offset+770 ,580)



BrickWallMap=MakeMapFromIMage(Screen,32,32)


rendertoscreen
Cam=NewCamera()
cameracls cam,off


StartTime=Timer()

Do


CurrentTime=Timer()
TimePast=CurrentTime-StartTime

CaptureToScene
ClsScene

iw=GetIMageWidth(Backdrop)
ScrollSpeed# = Float(iw)/80000
Xpos=TimePast*ScrollSpeed#

capturedepth 100
DrawImage Backdrop,-xpos,0,false
DrawImage Backdrop,(-xpos)+iw,0,false

; Scroll speed in pixels per tick
ScrollSpeed# = Float(SceneWidth)/20000
Xpos=TimePast*ScrollSpeed#
LevelWidth=GetLevelabsWidth(Tubemap,1)-GetMapBlockWidth(TubeMap)
Layer2_Xpos=MOd(Xpos,LevelWidth/2)

MouseWorldXpos=MouseX()+GetCameraX(Cam)
MouseWorldYpos=MouseY()+GetCameraY(Cam)

CloneLevel TubeMap,1,TubeMap,2

capturedepth 50

DrawMap TubeMap,2,-Layer2_Xpos,0



; Scroll speed in pixels per tick
ScrollSpeed# = Float(SceneWidth)/10000
Xpos=TimePast*ScrollSpeed#
LevelWidth=GetLevelabsWidth(BrickWallMap,2)-GetMapBlockWidth(BrickWallMap)
Layer3_Xpos=MOd(Xpos,LevelWidth/2)

capturedepth 10

if spacekey()=false
DrawMap BrickWallMap,2,-Layer3_Xpos,0
endif

capturedepth 1

for each GroundZones()

x1=GroundZones.x1 -Layer3_Xpos
x2=GroundZones.x2 -Layer3_Xpos
y1=GroundZones.y1
y2=GroundZones.y2
boxc x1,y1,x2,y2,false,$00ff0000

MapSpaceX1=x1+Layer2_Xpos
MapSpaceY1=y1
MapSpaceX2=x2+Layer2_Xpos
Login required to view complete source code


kevin

#57
   PlayBASIC V1.64M  Beta #34 - Download

    Posted beta 34, this one has the occlusion commands in it, but only the RectOccludeMap is hooked up.  


  Get PlayBAsic V1.64 Beta 34 (login required)

kevin

#58
   PlayBASIC V1.64M  Beta #35 - Quad (Polygon) Occlude Map

   Tonight I'm putting the final touches on the occlusion commands, with the addition of the Circle / Ellipse & QuadOccludeMap functions.   They work via the same principal as the Rect version, you give it a shape and it cuts that region out of map level.   Supporting different zones should make it easier for those creative programmers to tweak their games performance just that little bit more.

 

  Download
   
   deleted

kevin


PlayBASIC V1.64M  Beta #36 -Optimization Stage

     Been sifting through the Shape Library this afternoon trying to improve the speed of the some core functions like PointHitShape, but without altering it's functionality.  So far the results have been fairly pleasing seeing around a 40% gain in performance over a 10000 calls.  This caries through to other routines like the LineHitShape and Shape intersections due to their usage of PointHitShape in certain circumstances.  Giving a nice little boost to demos that usage a lots of shape collisions.