-
Notifications
You must be signed in to change notification settings - Fork 2k
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 API "dtime" not clarified #14758
Conversation
I added a change to this description like you said and I think it should be fine now |
LGTM. (Not a official review though) |
How is it now |
doc/client_lua_api.md
Outdated
@@ -315,6 +315,7 @@ Call these functions only at load time! | |||
|
|||
* `minetest.register_globalstep(function(dtime))` | |||
* Called every client environment step, usually interval of 0.1s |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is more like 1/FPS or 1/60 IIRC rather than 0.1s, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's 0.09 on standalone servers and 1/fps (but at least 1/60) on the client.
This is not something we should document.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about something like "Called every client environment step (every frame, at least 60 times per second)"?
I feel this is worth documenting because accurate calculations may very well rely on the client / server step interval. It's certainly something modders should think about. Serverside, the dedicated_server_step_setting
should probably be mentioned.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If your calculations rely on the number of calls then they're broken.
Neither can we guarantee that it's called 60 times per second, what I meant was "not more than 60 times a second".
Information is good but I don't want to make any promises to modders about this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a trivial PR, can we just merge it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now we can (0bebdec). Client steps being every 0.1s is just misleadingly wrong: It would lead client modders to wrongly believe that this isn't called often enough.
I don't care much about the "usually 0.1s" for server steps statement, this is roughly right considering our default settings at least. Though it might be better to mention the setting - something like "target interval is determined by dedicated_server_step
setting on dedicated servers" (and usually much higher in singleplayer).
This is valuable information for modders to have because it tells them how smoothly / janky they can expect everything to run on average, if the server is not overloaded. (Though of course their code should still handle varying dtimes including lag spikes properly.)
Fix #14222
This PR documents that "dtime" in minetest.register_globalstep is the time measured in seconds in the Lua API.
This PR is Ready for Review.
How to test
Read the Lua API.