player:set_player_velocity() when?

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

player:set_player_velocity() when?

by Piezo_ » Thu Nov 15, 2018 18:57

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

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

Re: player:set_player_velocity() when?

by rubenwardy » Thu Nov 15, 2018 18:58

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
 

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

Re: player:set_player_velocity() when?

by Pyrollo » Thu Nov 15, 2018 20:10

Too bad...

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

User avatar
TenPlus1
Member
 
Posts: 2625
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: player:set_player_velocity() when?

by TenPlus1 » Thu Nov 15, 2018 20:52

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: 5859
Joined: Tue Jun 12, 2012 18:11
Location: United Kingdom
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: player:set_player_velocity() when?

by rubenwardy » Thu Nov 15, 2018 21:01

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.
 

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

Re: player:set_player_velocity() when?

by Piezo_ » Thu Nov 15, 2018 21:03

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
Member
 
Posts: 324
Joined: Mon Jan 08, 2018 15:14
Location: Paris
GitHub: pyrollo
In-game: Naj

Re: player:set_player_velocity() when?

by Pyrollo » Thu Nov 15, 2018 21:15

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
Location: (x,y,z)
GitHub: is proprietary I use NotABug
In-game: Piezo_ or TheRealPiezo_

Re: player:set_player_velocity() when?

by Piezo_ » Fri Nov 16, 2018 05:17

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: 5859
Joined: Tue Jun 12, 2012 18:11
Location: United Kingdom
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

Re: player:set_player_velocity() when?

by rubenwardy » Fri Nov 16, 2018 13:57

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.
 

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

Re: player:set_player_velocity() when?

by Piezo_ » Fri Nov 16, 2018 22:00

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: 2719
Joined: Thu Nov 01, 2012 12:46

Re: player:set_player_velocity() when?

by Hybrid Dog » Sat Dec 01, 2018 20:04

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

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

User avatar
runs
Member
 
Posts: 886
Joined: Sat Oct 27, 2018 08:32
GitHub: runsy

Re: player:set_player_velocity() when?

by runs » Mon Dec 10, 2018 15:51

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

User avatar
runs
Member
 
Posts: 886
Joined: Sat Oct 27, 2018 08:32
GitHub: runsy
 

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

Re: player:set_player_velocity() when?

by Piezo_ » Wed Dec 12, 2018 03:29

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: 2719
Joined: Thu Nov 01, 2012 12:46

Re: player:set_player_velocity() when?

by Hybrid Dog » Wed Dec 12, 2018 17:27

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

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

User avatar
gpcf
Member
 
Posts: 322
Joined: Fri May 27, 2016 10:48
In-game: gabriel

Re: player:set_player_velocity() when?

by gpcf » Tue Dec 18, 2018 02:05

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: 1061
Joined: Fri Aug 26, 2016 15:36
Location: Illinois, USA
GitHub: sorcerykid
In-game: Nemo

Re: player:set_player_velocity() when?

by sorcerykid » Thu Jan 10, 2019 17:52

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: 2625
Joined: Mon Jul 29, 2013 13:38
GitHub: tenplus1

Re: player:set_player_velocity() when?

by TenPlus1 » Fri Jan 11, 2019 08:05

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: 1061
Joined: Fri Aug 26, 2016 15:36
Location: Illinois, USA
GitHub: sorcerykid
In-game: Nemo

Re: player:set_player_velocity() when?

by sorcerykid » Wed Jan 16, 2019 18:18

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.
 


Return to Feature Discussion



Who is online

Users browsing this forum: No registered users and 9 guests