Client side node placement prediciton

User avatar
12Me21
Member
 
Posts: 873
Joined: Tue Mar 05, 2013 00:36
Location: (Ignore all of my posts before 2018)
GitHub: 12Me21

Client side node placement prediciton

by 12Me21 » Fri Sep 14, 2018 03:06

Many nodes have `on_place`/`after_place_node` functions that change the node type/facedir when they are placed (For example, when you place a slab, it turns upside down if you placed it on the top half of a node).

However, because these are handled by the server, it can take a fraction of a second before the client's map is updated. Of course, if there is any lag, this gets even worse.

A solution for this would be to allow client side mods to choose what happens when you place a node.

For example, it might look something like this:

Code: Select all
core.register_on_placenode("stairs:slab_stone",function(pos, placer, pointed_thing, itemstack){
   ...
   return {name = "stairs:slab_stone", param2 = 5} -- idk
})


This would make the game feel a lot more polished, I think.
Currently, placing certain nodes looks very glitchy, since they first appear with their default orientation and then change when the server responds, even though the client most likely has enough information to decide the intended node orientation all on its own.
 

User avatar
ChimneySwift
Member
 
Posts: 317
Joined: Fri Sep 22, 2017 06:46
Location: 127.0.0.1
GitHub: ChimneySwift
IRC: ChimneySwift
In-game: ChimneySwift

Re: Client side node placement prediciton

by ChimneySwift » Sun Sep 16, 2018 05:26

I agree with this.

I don't see much potential for issues if CSM is only allowed to modify the node placement prediction.
A spoon is basically a tiny bowl with a stick on it
 

micheal65536
Member
 
Posts: 61
Joined: Mon May 22, 2017 20:27

Re: Client side node placement prediciton

by micheal65536 » Sun Sep 16, 2018 09:00

IMO this should be provided in the Minetest core, not as part of CSM. When a node is registered in a (server-side) mod, there should be a parameter to describe the appropriate prediction (e.g. from a list of built-in predictions, or a custom Lua function). The predictions will be downloaded by the client along with the other node information when the client connects. (I know this will be achieved by server-provided CSM when that gets implemented but this seems like a more elegant solution than having to write a separate CSM for every server-side mod that does nothing else but provide predictions.)

The possible predictions with such a system could include:
  • Replace the node with a different node (by name)
  • Use the player orientation and controls to rotate the node (in either 2 or 3 dimensions)
  • Place an adjacent node in addition to this node, based on the direction of this node if applicable (e.g. beds which are made in separate top and bottom halves, but the number of nodes like this are decreasing because mod developers seem to prefer one over-sized node with surrounding placeholder nodes)

Heck, even a simple "predict 2-dimensional orientation" or "predict 3-dimensional orientation" flag will probably handle like 90% of cases.
 


Return to Client-side modding



Who is online

Users browsing this forum: No registered users and 1 guest