-
Notifications
You must be signed in to change notification settings - Fork 332
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
Do not multiply delta_time by 60 in Sprite.update #2397
Comments
That is the goal in the long run, but not in 3.0. We still have to obey velocity being in "pixels per frame at a framerate of 60" due many factors. If you want to change this default just override the |
Ok, that's fine by me. (Though I worry that it sounds like a mild breaking change between 3.0 and 3.1 which might affect new users, so unless 3.1 comes quickly, there may be a need for some documentation or warnings. But I leave that to you.) |
It's definitely not a perfect situation. We just need to figure it out later or we will never get this release out 😆 There is always 3.x and 4.x. |
There's a problem with the current approach as if the frame rate decreases to 30 (for example) the sprite will move way further that it is intended to. |
So tempted to do something about this asap. |
Enhancement request:
What should be added/changed?
Currently (I am on 3.0.0.dev36, but I see it still in master,
delta_time
is multiplied by 60 and there is a motivation:I would like this factor of 60 to be dropped so that e.g. speeds and similar can be defined in time units of seconds rather than frames.
I have been using arcade since major version 2, and there used to be one method
update
with fixeddelta_time
and one methodon_update
which took it as an argument, and I believe the docs encouraged use ofon_update
, so I did that. It became perfectly natural to define all speed etc with a time unit of second rather than a time unit of 1/60 second (otherwise I would have had to throw in an extra factor of 60 in everyon_update
). Now it seems likeupdate
andon_update
have been merged into justupdate
, withdelta_time
. I agree with just having one update method (and I am sure there was a reason for choosing the nameupdate
overon_update
), but the choice of having this factor 60 means that user who usedon_update
(like me) run into problems. It also means that new users of arcade must use 1/60 s as the unit of time. It all seems very counter-intuitive and strange. There is a reference to "physics engines" breaking if this is changed, but I am not sure which physics engines are referred to (if it was just referring to physics engines in arcade, it should all be fixable?).I am making this request to throw my vote in for dropping the factor of 60.
What would it help with?
I am currently handling this by overriding
update
with a fixed (no factor of 60) version. If I don't do this, I would have to divide all my speeds by 60 and all my accelerations by 60^2. I could do this, but using 1/60 s as the unit of time feels counter-intuitive. I also believe this is an extra complication for new users (unless 1/60 s is somehow a common unit of time in games? What does e.g. pygame do?)The text was updated successfully, but these errors were encountered: