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

Game speed isn't time independent #4

Open
Steve132 opened this issue Aug 30, 2021 · 3 comments
Open

Game speed isn't time independent #4

Steve132 opened this issue Aug 30, 2021 · 3 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@Steve132
Copy link

The game loop doesn't use a deltaTime parameter based on the current frametime, or a fixed FPS, either of which are necessary in order for the game's performance to be consistent.

On a high-end system the game loop is so fast it is completely unplayable.

@KarthikNedunchezhiyan
Copy link
Owner

Thanks for the report. Nice catch. This is indeed a problem to solve. Any implementation suggestions you have in mind?

@KarthikNedunchezhiyan KarthikNedunchezhiyan added bug Something isn't working good first issue Good for newcomers labels Aug 30, 2021
@Steve132
Copy link
Author

There primary solution that is accepted in industry is you have a single float deltaTime which is the amount of time in seconds as a double-precision number since the last frame. Then, everywhere you do physics or movement calculations (such as position+=velocity) you instead do position+=velocity*deltaTime;

@KarthikNedunchezhiyan
Copy link
Owner

That's a good suggestion. I think this should fix the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants