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

Max physics delta time is locked to 0.02 on lossless warp #20

Open
Tuupertunut opened this issue Jan 2, 2019 · 5 comments
Open

Max physics delta time is locked to 0.02 on lossless warp #20

Tuupertunut opened this issue Jan 2, 2019 · 5 comments

Comments

@Tuupertunut
Copy link

Tuupertunut commented Jan 2, 2019

This setting which lets us do more physics frames per gameplay frame is now locked into 0.02. This forces the game to draw a gameplay frame on every physics frame, improving framerate but slowing physics down on slower computers. I don't see how adding more gameplay frames is relevant to lossless warp, which should ideally just calculate an adjustable amount of physics frames for one gameplay frame.

@linuxgurugamer
Copy link
Owner

Physics delta time is not the same as lossless warp

@Tuupertunut
Copy link
Author

That's correct, it isn't. But why is the setting "Max physics delta time per frame" locked into 0.02?

In case you don't know what this setting does, here's a nice explanation:
https://forum.kerbalspaceprogram.com/index.php?/topic/132637-fps-and-physics-timesteps/

TLDR:

The physics timestep is always constant at 0.02 seconds (20 ms). Max physics delta time per frame tells how much game time the game can use to calculate physics frames before it is forced to draw a gameplay frame. 0.02 means max one physics frame before a forced gameplay frame, 0.04 means max two physics frames before a forced gameplay frame and so on.

So why is a time warp mod forcing the game to draw a gameplay frame between every physics frame?

@linuxgurugamer
Copy link
Owner

It only does that when Timescale is one (ie: no warping). I didn't write this, and would have to research it a bit. It may be a holdover from an earlier version of the game.

And yes, I do know what the setting does.

@linuxgurugamer
Copy link
Owner

Just an FYI, it's entirely possible that changing that can really mess things up. The mod is written around the idea of the timestep being 0.02, if it's not, then odd things may happen. This will need extensive testing to be sure

@Tuupertunut
Copy link
Author

Ideas:

Where lossy (normal) time warp increases the timestep size, an ideal lossless warp should just calculate more physics frames in the same time period. Gameplay frames per real time second would stay the same and it would just fit more physics frames between two gameplay frames.

So if the user has selected 0.02 as the max physics delta time (max 1 physics frame between gameplay frames), then it would compute 2 phys frames at 2x time warp, 4 phys frames at 4x time warp and so on.

If the user has selected 0.06 as the max physics delta time (3 physics frames between gameplay frames), then it would compute 6 phys frames at 2x time warp, 12 phys frames at 4x time warp and so on.

This is assuming lossless warp accuracy of 1. On lower accuracies the timestep would be longer and amount of computed physics frames lower.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants