mesecons
mesecons copied to clipboard
Pistons smooth animation
Can you make pistons animation smooth like in MC? I don't know if that's possible in Mt.
- Remove Nodes To Be Pushed/Pulled, marking the data down in a table
- Spawn X amount of entities (where X is, place the total nodes being pushed) with the velocity required to move them one block forward in 1 second
- Delete the entities and replace all the nodes.
It's not impossible, it's just complicated and could be laggy on slow servers (although I'm not sure this is a bit issue anymore).
It would be laggy, as MT lacks the necessary client-side animation support. Moreover, it’s hard to ensure the nodes being moved won’t be lost in the case of server crash, or /deleteobjects command, etc.
You'd have to have some really bad timing for those things to happen in the exact second of it, and this could technically could happen today if the server crashed between calling the remove and place functions.
Y'know, mesecons had smooth animations for movestones originally, I wonder why they were removed. EDIT: This commit https://github.com/minetest-mods/mesecons/commit/1df6e5a03bbc4057571a882017009f5e6c54907b
if the server crashed between calling the remove and place functions.
That’s highly unlikely, due to (mostly) signle-threaded nature of the server. Only power failure or so may crash it at that moment (or MVPS malfunction indeed). On the other hand, in the entity-based approach, there is a time gap between removing and placing nodes at which other mods’ code is running. That may crash easily.
Nevertheless, crash probability is low, and handling that is possible and doesn’t even require relying on entities’ static data (which is destroyed by /clearobjects). So that’s not that great concern.
What is more important is that MT doesn’t seem to support making an entity looking identically to a node. If that’s a solid or mesh node, it’s OK, but e.g. nodeboxes can’t be represented. Generating all the meshes at server load doesn’t seem to be a good idea.
And, well, lagging is always a concern. Just 80ms ping, and your entities jump around, spoiling all the impression.
I wouldn't think an entity scripted to delete itself after 1 second that only travels in one direction for a second would have a chance to jump around. According to lua_api.txt the item visual supports everything-ish except for plantlike, but I think that showing flat plants for a second would be a pretty small visual bug (and could prompt an engine change).
Hmm, I thought there is only wielditem for displaying those small rotating things... If that is usable (scaling?), everything else is doable. If you know anyone ready to code, lemme know ;)
Still, there are many small problems to solve. One of them is that that’s definitely not backward-compatible: current MVPS act instantly, and some machines may rely on their high speed. Also, what to do if the power is disconnected before the movement is finished? Also, should movestone run steppy or continuously? In the latter case, should it ever materialize the nodes it moves before it stops? What if these nodes are active: have ABM defined, or are mesecon-enabled, or whatever?
what to do if the power is disconnected before the movement is finished
Delete the entity and reset the position of the blocks as if the piston retracted, like MC does it.
should movestone run steppy or continuously
They used to run continuously, and it looked better IMO. But steppy would be consistent with current behavior.
What if these nodes are active: have ABM defined, or are mesecon-enabled, or whatever
Mesecons enabled nodes should either stay in their current state, or always be off when moving. This will make it consistent and reliable.
@Jeija Why have you removed smooth animations from the movestones?
Pretty much for the reasons that @numberZero mentioned. Movestone animations were laggy, buggy and the code was not that easy to maintain. Some glitches were visible even in singleplayer, some others only occurred when playing in multiplayer mode, especially on laggy servers. Unless the animations can be implemented on the client side, I really wouldn't recommend adding any.