Skip to content
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

Fix weather particle physics. #19596

Merged
merged 1 commit into from Aug 20, 2021
Merged

Conversation

pchote
Copy link
Member

@pchote pchote commented Aug 8, 2021

Fixes #18025. See commit message for description.

The trait documentation specified that the speed
and offset values are px/tick, but they have actually
always been treated as px/render.

Fix the update logic and rescale the map definitions
to account for the fixed behaviour.
@pchote pchote added this to the Next release milestone Aug 8, 2021
// SwingSpeed is defined in px/tick so we must account for the fraction of a tick that elapsed since the last render.
// The scale is capped at 1 tick to avoid unexpected behaviour at game start, if RunTime overflows, or if the game stalls.
var runtime = Game.RunTime;
var tickFraction = Math.Min((runtime - lastRender) * 1f / world.Timestep, 1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tickFraction looks like something we might want to eventually calculate and expose at a central, publicly accessible place like Game, so we can reuse it for things like interpolation and don't need to do the math locally in every place that needs it.

Just thinking aloud, not a request for this particular PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are thinking of something like https://love2d.org/wiki/dt delta time?

Copy link
Member

@Smittytron Smittytron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix confirmed and LGTM

@reaperrr reaperrr merged commit 864cc4b into OpenRA:bleed Aug 20, 2021
@pchote pchote deleted the fix-weather-speed branch August 21, 2021 10:11
@TheRaffy
Copy link
Contributor

TheRaffy commented Dec 4, 2022

Hey everybody, thanks for the fix!

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.

Weather effect faster with higher framerate
5 participants