| ||||
|
Shockwave 3D : Director Online Forums
Questions about using 3D in Director
FPS
Posted by: Kurbaga (---.azeronline.com)
Date: November 04, 2006 04:35AM can someone explain to me how to trace Frame_Per_second during my 3Dscene running.
i've tried to do it by myself, but its always gets wrong ![]() Re: FPS
Posted by: robotduck (---.dsl.pipex.com)
Date: November 06, 2006 03:38AM Here's a behaviour script which displays the current frames per second. To use: create a new field or text member. Place it on stage. Create a new behaviour, paste in the code below, and place that behaviour onto the text sprite. -------------------------------------------------------------- -- FPS Display Behaviour -- Robotduck 2004 -- Place this behaviour on a sprite with a text or field cast member property my, startMS, periodSecs, numFrames on beginsprite me my = sprite(me.spritenum) startMS = the milliseconds periodSecs = 3 -- (seconds between each update) numFrames = 0 end on enterFrame me numFrames = numFrames + 1 currentMS = the milliseconds if currentMS > startMS + periodSecs*1000 then -- calculate fps since last update fps = integer(numFrames / (periodSecs)) my.member.text = "FPS: "&fps -- and reset the counters numframes = 0 startMS = the milliseconds end if end --------------------------------------------------------- enjoy! - Ben _____________________ duck_at_robotduck.com www.robotduck.com : Shockwave games, tutorials & source code ![]() Re: FPS
Posted by: Kurbaga (---.azeronline.com)
Date: November 06, 2006 03:54AM Great )
thanks P.S. trying to get better perfomance, and i hope this thing 'll help me to trace Re: FPS
Posted by: Loran (---.net81-65-82.noos.fr)
Date: November 07, 2006 01:05AM hi,
an other way __________ global FPS property btime on beginsprite me btime = the milliseconds fps = 0. end -- on exitframe me vtime = the milliseconds delta = vtime - btime FPS = 1000./float(delta) btime = vtime end Re: FPS
Posted by: robotduck (---.dsl.pipex.com)
Date: November 07, 2006 03:14AM Actually, that's pretty much the same way, but with the averaging feature of my script removed.
The reason I use an average (a 3 second average in my example above), is that if you calculate the FPS each frame independantly it can fluctuate each frame, making it difficult to read and less useful. An averaged FPS reading is much more useful. - Ben _____________________ duck_at_robotduck.com www.robotduck.com : Shockwave games, tutorials & source code ![]() Sorry, only registered users may post in this forum.
|