Display FPS while testing level

Display FPS while testing level

krisgoku8
Advocate Advocate
9,310 Views
3 Replies
Message 1 of 4

Display FPS while testing level

krisgoku8
Advocate
Advocate

I'm not able to show fps while testing the level. The fps will show will the game is not running and even if i run a test the frames will say two in the other window. I know that's not correct. SO how do i show frame rate while testing the game?

Reply
Reply
0 Likes
9,311 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable

Hello,
it is actually rather simple. 
First you gotta create a new gui(if you have not already) using:

gui = World.create_screen_gui(world,'immediate')

then you can calculate the fps by using the delta time between frames in your update loop ususally denoted as "dt". All you gotta do is divide1 by that number in order to get the frames per second.After that it is just a matter of adding the result to the GUI.
It would look something like this

function update(dt) 

     Gui.text(gui, tostring(1/dt), font, font_size, font_material, Vector3(x, y, z))

...

end



(more information on the specific functions in the doc of course)

I hope this answered your question,
Cheers!

Reply
Reply
0 Likes
Message 3 of 4

_robbs_
Alumni
Alumni

Another way to do it is to send a perfhud console command to the game from the status bar.

 

  1. Start testing the game with the green triangle button.
  2. While it's running, go to the status bar in the Stingray Editor.
  3. Make sure the drop-down on the left is set to Command. In the engine drop-down, select Test Engine. This will make the status bar send commands to the test engine.
  4. In the text field, type
    perfhud fps

You should now see the FPS showing in the game window. Note that in the Test Engine the FPS is capped at 60, but you can do the same thing with Run Project as well.

Reply
Reply
0 Likes
Message 4 of 4

paulkind
Alumni
Alumni

One last way is to use the FPS counter in ShadowPlay (in Nvidea GeForce Experience Panel) allows you to display fps on any running 3d window.  I generally leave this enabled as i basically always want to know what my fps is,

 

Paul

 

Areas of Expertise - MayaLT : Mudbox : 3DS Max : Inventor : Game Dev
Follow me on Twitter : @paulkind3d

Please remember to give kudos freely and mark acceptable answers as solved!

PLEASE do not send me private messages unless asked to do so. If you have a question, start a thread, and ask me on the public forums where answering your question may help others.

Did you know there was a YouTube learning channel for Autodesk Games? New videos are posted regularly with all sorts of content relative to Stingray, Maya/MayaLT, 3DS Max, and other game related tools. Get your game on @ https://www.youtube.com/user/autodeskgameshowtos
Reply
Reply
0 Likes