Skip to content

Conversation

@TCROC
Copy link
Contributor

@TCROC TCROC commented May 28, 2024

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:

image

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.

@TCROC TCROC requested a review from a team as a code owner May 28, 2024 20:27
@fire
Copy link
Member

fire commented May 28, 2024

Does anyone know the original reason it wasn't exposed @reduz ?

@TCROC
Copy link
Contributor Author

TCROC commented May 28, 2024

It looks like I need to update with doctool. I've never done this before. Are there any instructions on how to do this?

@RedMser
Copy link
Contributor

RedMser commented May 28, 2024

It looks like I need to update with doctool. I've never done this before. Are there any instructions on how to do this?

See these instructions. You have to run Godot with --doctool while your working directory is in the repository root. Then you can edit the changed XML to include a description.

@mortifiedtux
Copy link
Contributor

Looks similar to #60284, just not fixing that fixed_fps == -1 issue.

Copy link
Member

@AThousandShips AThousandShips left a 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

@TCROC TCROC force-pushed the set-fixed-fps-at-runtime branch from 28587c1 to d0580b6 Compare May 29, 2024 13:24
@TCROC TCROC requested a review from a team as a code owner May 29, 2024 13:24
@AThousandShips AThousandShips changed the title Set fixed fps at runtime Add support for setting fixed fps at runtime May 29, 2024
@TCROC TCROC force-pushed the set-fixed-fps-at-runtime branch from d0580b6 to b66b40b Compare May 29, 2024 13:29
</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.
Copy link
Member

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?

Copy link
Contributor Author

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 😅

Copy link
Member

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!

Copy link
Contributor Author

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:

  1. Prevent users from setting to 0. Change to 1 if so
  2. Prevent users from setting to 0. Error and return.
  3. 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/

Copy link
Member

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

Copy link
Contributor Author

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 :)

@TCROC
Copy link
Contributor Author

TCROC commented May 29, 2024

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)
Thanks for pointing this out @programneer!

@Calinou
Copy link
Member

Calinou commented Jun 3, 2024

@Calinou Calinou closed this Jun 3, 2024
@Calinou Calinou removed this from the 4.x milestone Jun 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants