player:set_player_velocity() when?

Post Reply
User avatar
Piezo_
Member
Posts: 219
Joined: Fri Jul 20, 2018 21:36
GitHub: is proprietary I use NotABug
Location: (x,y,z)

player:set_player_velocity() when?

by Piezo_ » Post

Is this going to be added at some point?
while (true) { suffer(); }

User avatar
rubenwardy
Moderator
Posts: 6972
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: Bristol, United Kingdom
Contact:

Re: player:set_player_velocity() when?

by rubenwardy » Post

Probably never.

This is something that will be abused and needs to be done correctly in order to avoid lag. It's unlikely to be done in the form you suggest
Renewed Tab (my browser add-on) | Donate | Mods | Minetest Modding Book

Hello profile reader

User avatar
Pyrollo
Developer
Posts: 385
Joined: Mon Jan 08, 2018 15:14
GitHub: pyrollo
In-game: Naj
Location: Paris

Re: player:set_player_velocity() when?

by Pyrollo » Post

Too bad...

This would allow to make blast or push effects.
[ Display Modpack ] - [ Digiterms ] - [ Crater MG ] - [ LATE ]

User avatar
TenPlus1
Member
Posts: 3715
Joined: Mon Jul 29, 2013 13:38
In-game: TenPlus1
Contact:

Re: player:set_player_velocity() when?

by TenPlus1 » Post

Maybe having a player movement override so the player becomes a normal entity and can be manipulated in the same way, e.g. player:set_physics_override({control = false})

User avatar
rubenwardy
Moderator
Posts: 6972
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: Bristol, United Kingdom
Contact:

Re: player:set_player_velocity() when?

by rubenwardy » Post

TenPlus1 wrote:Maybe having a player movement override so the player becomes a normal entity and can be manipulated in the same way, e.g. player:set_physics_override({control = false})
Yeah, this is one of the APIs that should be available in a solution.

Blasts or pushing should probably be done using impulses or forces.
Renewed Tab (my browser add-on) | Donate | Mods | Minetest Modding Book

Hello profile reader

User avatar
Piezo_
Member
Posts: 219
Joined: Fri Jul 20, 2018 21:36
GitHub: is proprietary I use NotABug
Location: (x,y,z)

Re: player:set_player_velocity() when?

by Piezo_ » Post

Why/how would it be "abused", and how could it cause lag, any more than player:set_pos()? They're both just vectors, and changing them should be stupidly simple...

I would think the internal physics engine shouldn't have any trouble dealing with the velocity change. After all, you can already do this to lua entities...
while (true) { suffer(); }

User avatar
Pyrollo
Developer
Posts: 385
Joined: Mon Jan 08, 2018 15:14
GitHub: pyrollo
In-game: Naj
Location: Paris

Re: player:set_player_velocity() when?

by Pyrollo » Post

Maybe the problem is not set_player_velocity causing lag but lag making set_player_velocity very uncomfortable for the player. Like boats when there is lag and you feel like going back and forth in an uncontrolled and unrealistic way.
[ Display Modpack ] - [ Digiterms ] - [ Crater MG ] - [ LATE ]

User avatar
Piezo_
Member
Posts: 219
Joined: Fri Jul 20, 2018 21:36
GitHub: is proprietary I use NotABug
Location: (x,y,z)

Re: player:set_player_velocity() when?

by Piezo_ » Post

Pyrollo wrote:Maybe the problem is not set_player_velocity causing lag but lag making set_player_velocity very uncomfortable for the player. Like boats when there is lag and you feel like going back and forth in an uncontrolled and unrealistic way.
You could always use player:get_player_velocity() to get the player's velocity, and just modify that velocity, rather than overwriting it completely.

Besides, there are already hundreds of badly made mods, what's the harm in adding a tool that could also be used to make good ones?
Last edited by Piezo_ on Wed Dec 12, 2018 03:39, edited 1 time in total.
while (true) { suffer(); }

User avatar
rubenwardy
Moderator
Posts: 6972
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: Bristol, United Kingdom
Contact:

Re: player:set_player_velocity() when?

by rubenwardy » Post

Piezo_ wrote:Why/how would it be "abused", and how could it cause lag, any more than player:set_pos()? They're both just vectors, and changing them should be stupidly simple...
set_pos is less time sensitive. It doesn't matter what time the client receive the message, it will still end up in the same position. A set velocity command could react up to 500ms late depending on network latencies, which would result in weird behaviour.

An API to give impulses and forces makes a lot more sense. Explosions, for example, are already decided on server-side and then sent to the client, meaning that an impulse could be sent alongside the visual effects to cause well timed reactions. Allowing nodes to exert forces (ie: flowing liquids) can also be done very well.
Piezo_ wrote:After all, you can already do this to lua entities...
Entities are controlled server-side. Players are controlled client-side. This is referred to as server authority and client authority.

TenPlus1's suggestion is to add an API which allows the server to temporarily change a player into server authority, allowing the player object to be controlled much like an entity.
Renewed Tab (my browser add-on) | Donate | Mods | Minetest Modding Book

Hello profile reader

User avatar
Piezo_
Member
Posts: 219
Joined: Fri Jul 20, 2018 21:36
GitHub: is proprietary I use NotABug
Location: (x,y,z)

Re: player:set_player_velocity() when?

by Piezo_ » Post

rubenwardy wrote:TenPlus1's suggestion is to add an API which allows the server to temporarily change a player into server authority, allowing the player object to be controlled much like an entity.
Why not have it be both? That's what I'm planning on doing in the game I'm designing (Geode Engine). Both the client and server handle it, and when they have a disagreement, the server's perspective wins.
while (true) { suffer(); }

User avatar
Hybrid Dog
Member
Posts: 2828
Joined: Thu Nov 01, 2012 12:46
GitHub: HybridDog

Re: player:set_player_velocity() when?

by Hybrid Dog » Post

There're already discussions about adding this to minetest: https://github.com/minetest/minetest/pu ... -219574694

‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪

User avatar
runs
Member
Posts: 3225
Joined: Sat Oct 27, 2018 08:32

Re: player:set_player_velocity() when?

by runs » Post

Talking about Rome... Now, there is a method to freeze a player?

User avatar
runs
Member
Posts: 3225
Joined: Sat Oct 27, 2018 08:32

Re: player:set_player_velocity() when?

by runs » Post

Well, there is a freeze mod

https://forum.minetest.net/viewtopic.php?f=9&t=19575&hilit=freeze+player

But there is another better method?

User avatar
Piezo_
Member
Posts: 219
Joined: Fri Jul 20, 2018 21:36
GitHub: is proprietary I use NotABug
Location: (x,y,z)

Re: player:set_player_velocity() when?

by Piezo_ » Post

runs wrote:Well, there is a freeze mod

https://forum.minetest.net/viewtopic.php?f=9&t=19575&hilit=freeze+player

But there is another better method?

As we've seen from the link posted by Hybrid Dog, it looks like the developers prefer not even bothering with the feature rather than finding a proper way of resolving client/server inconsistency in the event of lag.

I'm not sure what the status of the push/impulse concept is, or if anyone's worked on it, but I still think that a solution of intelligently keeping client and server velocity in sync would be worth some effort.
while (true) { suffer(); }

User avatar
Hybrid Dog
Member
Posts: 2828
Joined: Thu Nov 01, 2012 12:46
GitHub: HybridDog

Re: player:set_player_velocity() when?

by Hybrid Dog » Post

server provided CSM could probably do this and more, but somebody needs to implement it
https://github.com/minetest/minetest/pull/7949

‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪‮
‮‪

gpcf
Member
Posts: 382
Joined: Fri May 27, 2016 10:48
GitHub: gpcf
In-game: gabriel

Re: player:set_player_velocity() when?

by gpcf » Post

A vector field that specifies a force acting at each point on the player would be nice. This would also be quite lag-free, since the client knows how to act for a relatively long period of time.

User avatar
sorcerykid
Member
Posts: 1841
Joined: Fri Aug 26, 2016 15:36
GitHub: sorcerykid
In-game: Nemo
Location: Illinois, USA

Re: player:set_player_velocity() when?

by sorcerykid » Post

Piezo_ wrote:
runs wrote:Well, there is a freeze mod

https://forum.minetest.net/viewtopic.php?f=9&t=19575&hilit=freeze+player

But there is another better method?
Yes, it's entirely possible to change player movement without the need for a new API.

On my server I do this to simulate slippery surfaces (like ice). I simply attach the player to an entity that has a transparent upright sprite. Then I can completely override the player's velocity, yaw, and acceleration. When the motion is complete, I simply detach the player from the entity and remove the entity from the environment to resume normal game mechanics.

Additionally, it's possible to check the player controls and factor in the corresponding movements (I do this for example by adding input velocity vectors with a given friction factor to the existing slippery vectors to simulate the player attempting to maneuver on the ice).

User avatar
TenPlus1
Member
Posts: 3715
Joined: Mon Jul 29, 2013 13:38
In-game: TenPlus1
Contact:

Re: player:set_player_velocity() when?

by TenPlus1 » Post

This is how we do it also but attaching and detatching the player from entities causes visual glitches (the sliding into view glitch) which is why we really need it done in the engine itself.

User avatar
sorcerykid
Member
Posts: 1841
Joined: Fri Aug 26, 2016 15:36
GitHub: sorcerykid
In-game: Nemo
Location: Illinois, USA

Re: player:set_player_velocity() when?

by sorcerykid » Post

TenPlus1: I too have seen this glitch, but I'm using an older client (0.4.15). Wasn't that fixed already? I seem to recall a pull request to address this problem on GitHub, but I'm not sure if it was merged or still in progress.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests