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

provide a minetest.DEFAULT_PHYSICS value #14764

Open
Zughy opened this issue Jun 19, 2024 · 3 comments
Open

provide a minetest.DEFAULT_PHYSICS value #14764

Zughy opened this issue Jun 19, 2024 · 3 comments
Labels
Feature request Issues that request the addition or enhancement of a feature @ Script API

Comments

@Zughy
Copy link
Member

Zughy commented Jun 19, 2024

Problem

Different mods might have to rely on what's the server default physics setting (e.g. to restore it), but there's no way to know what default is

Solutions

Provide a minetest.DEFAULT_PHYSICS parameter, so that:

  • some mods can tweak it
  • some others can be informed on what the default value is

If untouched, fields should be equal to the ones inside the documentation

Alternatives

  • Have player:set_physics_override() reset to an internal default value - but that breaks retrocompatibility and it doesn't provide the option to tweak the default value anyway
  • Let a mod do it (but why should mods have a dependency that is just a single table value?)

Additional context

Right now I have to declare things like this https://gitlab.com/zughy-friends-minetest/arena_lib/-/blob/master/IGNOREME/SETTINGS.lua?ref_type=heads#L9 but, since I'm working on another mod that requires exactly the same thing but it's in no way related to the first mod (and yet they must both run), you can smell the air of conflicts approaching. Also, that requires me to update the table every time a new physics override parameter is added

I'm also aware mods like https://content.minetest.net/packages/Wuzzy/playerphysics/ exist, but they can't tackle booleans such as sneak and we're also back again to the mod dependency just to reset physics

@Zughy Zughy added @ Script API Feature request Issues that request the addition or enhancement of a feature labels Jun 19, 2024
@Zughy Zughy changed the title provide a minetest.DEFAULT_PHYSICS setting provide a minetest.DEFAULT_PHYSICS value Jun 19, 2024
@appgurueu
Copy link
Contributor

appgurueu commented Jun 21, 2024

I'm not quite sure how I feel about making this engine responsibility. Games need not have a concept of "default physics" at all. I think usually physics overrides are best managed as "monoids": All operations performed upon them must be invertible and associative. This is implemented by mods such as this one.

When you have something like minigames where you change physics, I would recommend saving the previous physics (from before entering the minigame) and simply restoring these at exit.

I don't think a mod dependency is a big problem. Mods will have to depend on fundamental game mods for fundamental game features (such as this one) anyways. Though now with the addition of the first_mod feature, you could even have a mod load first in a game without other mods needing to depend on it.

I also don't think moving this inside the Minetest namespace helps much with conflicts: You can still have multiple mods trying to set these defaults and hence conflicting.

@Zughy
Copy link
Member Author

Zughy commented Jun 21, 2024

There are default physics values, hence there is a default physics. I've seen the monoid mods but frankly I find it confusing. Also, there are a lot of them

You can still have multiple mods trying to set these defaults and hence conflicting

Sure but at least I have a starting point. Mods cannot know what's a server default physics, and this parameter would help because the server could state so. Of course speed potions etc shouldn't touch such a parameter

@rubenwardy
Copy link
Member

rubenwardy commented Jun 27, 2024

some mods can tweak it

One way to change the defaults currently is with the movement_ settings although not sure if setting at runtime works. The physics overrides are relative to these settings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature request Issues that request the addition or enhancement of a feature @ Script API
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants