-
-
Notifications
You must be signed in to change notification settings - Fork 24.2k
Add support for setting fixed fps at runtime #92490
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
Conversation
|
Does anyone know the original reason it wasn't exposed @reduz ? |
|
It looks like I need to update with doctool. I've never done this before. Are there any instructions on how to do this? |
ace4c01 to
40f68c0
Compare
See these instructions. You have to run Godot with |
|
Looks similar to #60284, just not fixing that |
AThousandShips
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good at a general glance, will take a closer look when I'm able
28587c1 to
d0580b6
Compare
d0580b6 to
b66b40b
Compare
| </methods> | ||
| <members> | ||
| <member name="fixed_fps" type="int" setter="set_fixed_fps" getter="get_fixed_fps" default="-1"> | ||
| When fixed_fps is greater than [code]-1[/code], the engine will process at this fps regardless of what the actual fps is. This is useful for doing things such as recording movies where realtime updates do not matter, but the images captured should appear smooth once being encoded together. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if it's set to 0? Is this documented elsewhere where it can be set?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not know. I'll go set it and see what happens. Hopefully the world doesn't end 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be useful to mention!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately I appear to have ended the world... 😅 lol jk jk but it does behave strange. It starts updating in unexpected ways. And no longer allows me to set the fixed fps back to its previous value. Setting it to a value of 1 works fine. But 0 does not. There's a few things I can do:
- Prevent users from setting to 0. Change to 1 if so
- Prevent users from setting to 0. Error and return.
- Allow users to set to 0, but document the strange behavior / warn against it.
For all of those, I'll update the Engine.xml with whatever we decide. What are your thoughts? I'm thinking the simplest and most intuitive approach would probably be just error and return + document that in the xml.
ooooooooooorrrrrrrrrr there is a 4th option:
I can make it so any value <= 0 behaves like -1 currently behaves... I kinda like this solution now that I think about it. This removes all potential errors and edge cases. I believe its what @Calinou did in his original PR that @programneer mentioned here: #92490 (comment)
Funny how multiple people come to the same solution on a problem 😅. This must be how convergent evolution works! All the way until we all become crabs! 🦀 https://www.popsci.com/story/animals/why-everything-becomes-crab-meme-carcinization/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed didn't realize that this was a duplicate PR, think that one is more complete and should be merged instead, but we'll see what's decided
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. I just looked through it and it has better documentation. I think we should do that PR instead. Hey @Calinou ! I brought ur PR back to life! :) On accident 😅. I prefer your better docs compared to mine so I think I'll merge your branch into my fork :)
|
We should supercede this PR with @Calinou's PR here: #60284. Just looks like @Calinou has a few merge conflicts and styling fixes to make the CI happy. #92490 (comment) |
|
This exposes the static fixed_fps field so that it can set at runtime. Currently the only way to modify it is from the command line or by starting a movie recorder from the editor. By exposing it publicly, we can now add movie recording functionality to our games such as what I did with Blocky Ball! :) Here's a preview of how we are using it in our game:
This is the replay / record interface that users can use to watch replays and or make recordings of their previous games:
And then putting it all together, we can end of with a beautiful video like so!
2024-05-28_16.18.09.webm
It even works impressively well on mobile! I've tested on both my samsung and iphone so far. The framerate goes down significantly while recording but the video still comes out completely smooth!
Let me know if you need any changes to this before it can be pushed through.