News:

PlayBASIC2DLL V0.99 Revision I Commercial Edition released! - Convert PlayBASIC programs to super fast Machine Code. 

Main Menu

problem with draw mode ?

Started by reno, January 12, 2008, 09:58:39 AM

Previous topic - Next topic

reno

Yes, I found what causes big slowdown now. Here was my drawing method :


...

CaptureToScene
ClsScene


DrawOrderedSprites


DrawCamera camera

...


If I just enable "DrawOrderedSprites", the game runs very smothy. So, I read the doc...

Quote
DrawOrderedSprites will render all sprite images to current surface, except when the user has enabled CaptureToScene or CaptureToWorld. In either situation the render requests will be added to the scene or world ques respectively.

What I should do to use correctly a camera in that case ?  ???
More games ? Go to my website :)
http://www.thereeteam.com/

kevin

    Hardware acceleration requires batching, but the Camera in 1.71 and bellow is the same (give or take) from 1.63 which has zero batching support.  So rendering lots of sprites through it equates to lots of draw calls in DX api.     

     I highly recommended reading the Blog (all of it!) from about here onwards - (see Multiple Pipelines ,How 3D Acceleration works , Messy Mesh Pipelines of Doom [/url]  etc etc. 


QuoteWhat I should do to use correctly a camera in that case ?

   I've still no idea what you're trying to do.  So care to enlighten us ?


reno

#17
I really apreciate your help. I'll read the blog tomorow.

But, here is the code I have simplified from my actual WIP game... the strange thing is when you activate "CaptureToScene", "ClsScene" and "DrawCamera 1", the gameloop drops a loooot  ???

Here is the image to use (I always prefer to work with "real" images 8) ) :



Here is the code (PB 1.71g) :


;screen
OpenScreen 800,600,32,1
ScreenVsync 1
SetFPS 60

;world
CreateWorld 1;initialisation
PartitionWorld 1,64;partition

;camera
CreateCamera 1;initialisation

;variables
Explicit 1

Global bb=1

;image
Load3DImage "_avatar01.jpg",33


;loop
Repeat

Cls RGB(30,50,70)

;nouvel objet
AddSprite(33)


;==================
;drawing
;CaptureToScene;!!!
;ClsScene;!!!

DrawOrderedSprites

;DrawCamera 1;!!!
;==================

;texte
Text 0,00,"FPS : "+Str$(FPS())+"/60"
Text 0,20,"SPRITES : "+Str$(bb)+"/1500"

Sync

Until KeyState(1)=1

;fin
End


Function AddSprite(img)

If bb>1499 Then Exitfunction

CreateSprite bb
SpriteImage bb,img
PositionSprite bb,Rnd(GetScreenWidth()),RndRange(64,GetScreenHeight())

SpriteDrawMode bb,2+16; use Alpha Addition blend
SpriteAlphaColour bb,RndRGB()

bb=(bb+1)

EndFunction
More games ? Go to my website :)
http://www.thereeteam.com/

reno

Hi Kevin,

I saw your updated " Undocumented Commands In PlayBasic V1.7x". Now I use DrawPerspectiveSprites and... it's killing fast ! It seems really a lot of faster than 1.6X engine now  :D

I know that camera and openscreen is in WIP, so continue on this way (seting camera and manipulating it with pointers is a bit hard for me, thanks for your "PerspectivePlatformerExample") !

I would like to know when you'll add mode 2048 and flash color. Thanks.
More games ? Go to my website :)
http://www.thereeteam.com/