- Home /
Webplayer deliberately caping the framerate?
As a standalone, my game runs at approx. 180fps in fullscreen mode as well as windowed mode. In the webplayer (tested using Firefox 3.6.1 and IE8) it runs with a constant 32fps. When I switch to fullscreen in the Webplayer (resizing to actual fullscreen resolution, no upscaling) it runs with exactly 64fps. Is the Webplayer deliberately caping the framerate? Any thoughts on why this is happening?
P.S.: I measured this using a Core i5 running winXP + NVidia 9600 GT. I also tested this on an Intel dual core running Win7 + onboard gfx and fps were fluctating between 40 and 60 fps, which seemed reasonble because of the onboard gfx and standalone behaviour on that machine.
I am measuring the frames per second using an in-game script as well as using Fraps. Both show identical results.
Answer by Eric5h5 · Mar 11, 2011 at 06:36 PM
Yes, the framerate is capped in the webplayer. Which numbers you get depends on the browser and the OS. (e.g., Safari on OS X is actually not capped in non-fullscreen mode.)
Can this behaviour be disabled? I am measuring frames per second at runtime and choose level of detail and render settings on the fly accordingly. Now with a fixed 32fps, my game always chooses the lowest level of graphics detail altough it could easily render it at the highest level in the webplayer (remember my standalone runs at 180 fps!!).
What are the capping numbers that depend on Browser and OS? What's the idea behind capping the frame rate depending on Browser on OS in the first place?
It can't be disabled. The way plugins work depends on the browser and OS so it's not entirely under Unity's control anyway.
So if frames per seconds do not represent actual workload, how can I adjust graphics settings at runtime dynamically? After all it is an extreme difference if someone's using a dedicated graphics card or just an onboard card a'la Intel G$$anonymous$$A945 (extremely slow, yet the most widespread setup accordings to Unity Webplayer statistics).
Regarding "not under Unity's control": This must be a limitation of Unity. I can get the browser's window handle and render into the window using DirectX as fast as I want/the machine can. I don't understand the idea behind Unity's way of capping the frame-rate.
As I illustrated with Safari on OS X, different browsers on different OSs have different behavior. Firefox is clamped to 50fps, Safari isn't.
Again, is there concrete information what the capping values are for existing OS/Browser combinations? (e.g. Firefox 3.6.1 on my XP machine is capped to 32 fps in windowed mode and 64fps in fullscreen mode, not 50!)
Since I know neither Firefox nor IE pose any limitation on framerates, it's Unity's "fault".
This renders any automatic FPS based behaviour (like adjusting details on the fly) useless. So why does Unity do it? And why don't they cap it to the same value (at least on Windows)?
Answer by Bunny83 · Jun 21, 2013 at 02:05 PM
Well you can kind of "disable" the cap in the webplayer, however browser games live in a different environment. Running as fast as possible can massively lower the browsers performance. Keep in mind that your webpage is probably not the only one loaded. If your game expects to have full power, create a standalone build.
Anyways take a look at Application.targetFrameRate and the example in the code section.
Application.targetFrameRate is not a valid solution since you need vsync for smoothness or some frames are skipped/doubled (hiccups) regardless of how you set the targetFrameRate (except it is way above 2 times the screen refresh rate).
When Vsync is enabled, i get inconsistent results on different machines, results that cap the frame rate at 50 despite the screen refresh rate is 60. Setting the Screen refresh rate to 50 works and even hiccups dissapear (that means that vsync is working). On other machines 60fps vsync works right away.
I wrote this to detect hiccups: http://marrt.elementfx.com/Smooth$$anonymous$$ovementTest.html Just watch the upper row for smoothness
Answer by rodriguez80alvaro · Oct 25, 2017 at 02:05 PM
Well you can kind of "disable" the cap in the webplayer, however browser games live in a different environment. Running as fast as possible can massively lower the browsers performance. Keep in mind that your webpage is probably not the only one loaded. If your game expects to have full power, create a standalone build. Anyways take a look at https://www.zz.com.ve and the example in the code section.