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

Fast-forwarding the simulation #82

Open
Bauxitedev opened this issue Jun 14, 2021 · 9 comments
Open

Fast-forwarding the simulation #82

Bauxitedev opened this issue Jun 14, 2021 · 9 comments
Labels
A-Integration very bevy specific C-Enhancement New feature or request D-Difficult Needs strong technical background, domain knowledge, or impacts are high, needs testing... P-Medium S-not-started Work has not started

Comments

@Bauxitedev
Copy link

Quick question, is it possible to fast-forward the physics simulation? E.g. if I want to run 10 physics steps per frame instead of 1, which makes the simulation run 10x as fast?

@allsey87
Copy link

Just a thought, but perhaps the best solution would be to disable rendering pipeline for those 10 steps?

@sebcrozet
Copy link
Member

sebcrozet commented Jun 14, 2021

Perhaps we should add a variant TimeStepMode::MultipleFixedTimesteps(u32) (or simply add the number of timesteps to the TimeStepMode::FixedTimesteps)?

@allsey87
Copy link

Perhaps we should add a variant TimeStepMode::MultipleFixedTimesteps(u32)?

One could certainly do this although it seems to me that only updating the physics (and none of the other systems involved in a complete Bevy application) would be a bit of a corner case.

@Bauxitedev
Copy link
Author

Just a thought, but perhaps the best solution would be to disable rendering pipeline for those 10 steps?

Not sure if that would work... many other pipelines would have to be disabled as well, right? E.g. the input handling pipeline, the audio pipeline, etc...

@allsey87
Copy link

Just a thought, but perhaps the best solution would be to disable rendering pipeline for those 10 steps?

Not sure if that would work... many other pipelines would have to be disabled as well, right? E.g. the input handling pipeline, the audio pipeline, etc...

I don't think there is a correct answer here, although I would be surprised if you really ended up turning off all other systems/pipelines except for physics in the final application.

@sebcrozet
Copy link
Member

@Bauxitedev Can you perhaps tell more about your use-case here? That would help understand exactly what you need.

@Bauxitedev
Copy link
Author

@sebcrozet I'm writing a small pseudo-scientific simulation that uses genetic algorithms to try to generate efficient vehicles. To find the effectiveness (aka fitness) of a vehicle, I run a physics simulation. E.g. if the vehicle instantly falls over, it gets low fitness. If it manages to traverse rough terrain without falling, it gets high fitness. If I could speed up the physics simulation, I could determine the fitness of a vehicle much faster than currently possible.

@rlidwka
Copy link

rlidwka commented Feb 12, 2023

If you want Fixed timestep mode with dt=A, substeps=B, and execute 10 of these per frame, can you set this?:

TimestepMode::Fixed {
    dt: A * 10.,
    substeps: B * 10,
}

I think it'd have the same effect, unless I misunderstood the initial question.

@Vrixyz Vrixyz added C-Enhancement New feature or request D-Difficult Needs strong technical background, domain knowledge, or impacts are high, needs testing... P-High arbitrary important item S-not-started Work has not started A-Integration very bevy specific labels May 23, 2024
@Vrixyz
Copy link
Contributor

Vrixyz commented May 23, 2024

Am I completely wrong here or as a user, we could change the time scale ? Not sure exactly how that would play well with fixedTime but it's worth trying.

@Vrixyz Vrixyz added P-Medium and removed P-High arbitrary important item labels May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Integration very bevy specific C-Enhancement New feature or request D-Difficult Needs strong technical background, domain knowledge, or impacts are high, needs testing... P-Medium S-not-started Work has not started
Projects
None yet
Development

No branches or pull requests

5 participants