-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set limit framerate #107
Comments
Sorry but it would be the best to implement this feature in Kha, especially since Robert is in favor of it at Kode/Kha#320. He might not get into implementing it yet but it usually also means he would accept the pull request. Kha already has a way to set frequency via https://github.com/Kode/Kha/blob/master/Sources/kha/FramebufferOptions.hx#L5, so I guess it is 'only' missing the implementation in the html5 backend. |
|
I'm not a software developer but I think if the end user wants to actually make a game this user shouldn't be modifying lower level libraries like Kha and the engine should adapt to what Kha currently offers. I think this issue should be reopened and I propose to set the fps cap should be set on here: While I'll be investigating and giving it a try on my own I'll appreciate if someone can point me out which source files I can read to speed up and see what I can do. Edit: sorry, I realized I'm in the Iron repo, opened an issue in the Armory repo here. |
I would like to be able to change the number of frames per second, because for web applications and for smartphones 60 frames is a lot (
Vsync
- 60 or no limit, it is known).I studied the source code of the
Armory
engine and its abstraction levels (Armory
,Iron
,Kha
) and came to the following conclusions:Armory
andIron
;Kha
:render
function that is registered to execute askha.System.notifyOnFrames()
and will run with a limit of 60. Because it depends on the call event on the chosen platform;update
function to theScheduler
and you can specify the frequency of more execution. You can specify a value of 30 and it turns out that the scene is render 2 times, and updated 1 time. Because neither are executed in parallel.To specify this setting, either in the
Display
class (it is located inArmorySDK\Kha\Backends\[target_name]\kha
), you need to specify a value for the platform in theget_frequency()
function. Or, in theTime
class of theIron
engine (ArmorySDK\iron\Sources\iron\system
) in theinit()
function, specify the frequency value instead of what is there.Can make changes to
Iron
:To make the
render
function run with the same frequency asupdate
, you can register an “empty function” inkha.System.notifyOnFrames()
(only to store the value from theframes[0]
array passed in theframebuffer
field). And execute the real function inupdate
. In this case, the empty function will still be executed 60 times, but the “workers” will only be 30.And for the “correct” display of the FPS value in the
DebugConsole
and in theGet FPS
node, it is necessary to correct that the time during the calculation was used fromScheduler
, and not the real one (which will produce 60 FPS).I haven’t been able to find any other way to limit the frames per second other than upgrading the
Iron
. In this case, you can display settings in the nodes or the Blender interface. But this is a limitation at the level of one of the abstraction layers. And make it optional, if the user left the FPS limit at 60, then everything will work according to the current algorithm.The developers
Kha
are in no hurry to introduce such a possibility (judging by the topics on the forum (http://forum.kode.tech/topic/329/building-a-desktop-app-render-on-demand) and the request in git (Kode/Kha#320)).I wrote the results of my searches here (https://forums.armory3d.org/t/set-limit-framerate-ln-for-get-fps/4286/8).
What do you think about this? Is there any other way to solve this problem?
The text was updated successfully, but these errors were encountered: