I'll give it a try later. Currently I made player_api, skinsdb and 3d_armor hard dependencies to make things simple to start with, but consequently this mod can only work with the Minetest Game. I plan to gradually loosen the requirements to make them optional so that this mod can support other games, too.
@eralatio, Version 1.5.0 added experimental support for the Mineclonia game. You may give it a try, but there are many missing features. See README.
I considered xcompat. However, the main difficulty is not setting the player model itself, but intercepting the global step function and overriding many game-specific functions. So xcompat could in theory help, but not much. None of Minetest Game, Backrooms Test or Mineclonia are designed with replaceable player animations in mind, so the key to customizing the animation is preventing the games from setting player models, skins, and animations, or overriding what they have set. Mineclonia also has mechanisms that MTG doesn't have, such as invisibility and the bone-overriding for bow and crossbow shooting. This mod also has animations for flying and swimming which not all games natively support. So the situation is more complicated. In the last few versions, I isolate the model and the skin into multiple "backends", kind of reinventing xcompat to some extent. I managed to add support for Backrooms Test and Mineclonia this way.
I will continue to improve the support for Mineclonia in the future. For now, I plan to do a major upgrade to make use of the new multi-track animation features of Luanti 5.17 and move away from the old player:set_animation. It may take some time, and I predict it will deviate from the player APIs of games far enough that xcompat won't be able to help.
@eralatio Currently the server has no way to know if a client has turned on fly mode or not, so the server side simply decides whether the player is flying by checking the "fly" privilege. You can try revoking the fly privilege to see the standing, walking and sneaking animations.
Can you check below the player whether there is something to stand on? I mean as long as the player height is not changing much and there's something to stand on, you could assume that the player is not flying. Perhaps same with horizontal speed. How does the other mod do it?
@eralatio The original 3D Armor Fly & Swim mod does what you described. More precisely, if there is something to stand on 2 blocks below the player, the player is considered not flying. But this approach has its limitations, too.
If the player is flying very low, which is usually the case when the player is in a narrow corridor, the player will be shown as walking in the sky.
While a player is walking, if the player suddenly jumps off a platform (or even stairs), the player will temporarily be 3 or more blocks off the ground, and the algorithm may think the player is flying.
Some mods can alter the physics and allow the players to jump significant higher. Notably, the Crystal Boots in Ethereal allows the player to jump 2x higher, and the Cloud armors in Cloudcraft allows 3x higher jump.
If the height is not changing much, it is also possible that the player is flying horizontally. I considered finding the acceleration of the player, but it is a bit too hard.
So there is no heuristics that work perfectly. Since I prefer playing MTG and Mineclonia with the fly mode always on, I simply assumed the player is always flying if it has the "fly" privilege.
But if you prefer that it behaves like the original 3D Armor Fly & Swim mod, I can add a configurable option.
@eralatio v2.0.2 added an option to detect if there are sufficient amount of air blocks under the player's feet. If not, the player is not considered flying. This is the behavior of the 3D Armor: Fly & Swim mod.
This is producing strange behavior, yes. Even grass is considered walkable and it switches modes. Wouldn't it be better to check for solid blocks? Or say if the vertical accel is not changing much, we could assume we stand on something - except we're in a liquid which would trigger the swim anim. I can try fiddling with it a bit.
Have you asked the engine devs on how to guess if fly mode is active or not? Perhaps they can expose that flag, This should help a lot, no?
@eralatio Yes. It would be helpful to improve the code for detecting what consists of a "solid" block. And the server may be able to detect if the acceleration is approximately equal to g by sampling the velocities across multiple global_step invocations. If you manage to improve the code, please open a pull request.
I haven't asked the engine devs, yet. If they could add a communication protocal so that clients can tell the server whether the fly mode is enabled, it will help a lot.
Hi there, are you planning to support Mineclonia? Perhaps via xcompat?
I'll give it a try later. Currently I made
player_api,skinsdband3d_armorhard dependencies to make things simple to start with, but consequently this mod can only work with the Minetest Game. I plan to gradually loosen the requirements to make them optional so that this mod can support other games, too.Thank you :)
@eralatio, Version 1.5.0 added experimental support for the Mineclonia game. You may give it a try, but there are many missing features. See README.
I considered xcompat. However, the main difficulty is not setting the player model itself, but intercepting the global step function and overriding many game-specific functions. So xcompat could in theory help, but not much. None of Minetest Game, Backrooms Test or Mineclonia are designed with replaceable player animations in mind, so the key to customizing the animation is preventing the games from setting player models, skins, and animations, or overriding what they have set. Mineclonia also has mechanisms that MTG doesn't have, such as invisibility and the bone-overriding for bow and crossbow shooting. This mod also has animations for flying and swimming which not all games natively support. So the situation is more complicated. In the last few versions, I isolate the model and the skin into multiple "backends", kind of reinventing xcompat to some extent. I managed to add support for Backrooms Test and Mineclonia this way.
I will continue to improve the support for Mineclonia in the future. For now, I plan to do a major upgrade to make use of the new multi-track animation features of Luanti 5.17 and move away from the old
player:set_animation. It may take some time, and I predict it will deviate from the player APIs of games far enough that xcompat won't be able to help.Contributions are always welcome.
Fly and hover do look okay. I just had to set the anim to hover when stopping a flight.
What doesn't work at all is standing, walking, sneaking etc. Is it a bug or not yet implemented?
@eralatio Currently the server has no way to know if a client has turned on fly mode or not, so the server side simply decides whether the player is flying by checking the "fly" privilege. You can try revoking the fly privilege to see the standing, walking and sneaking animations.
Can you check below the player whether there is something to stand on? I mean as long as the player height is not changing much and there's something to stand on, you could assume that the player is not flying. Perhaps same with horizontal speed. How does the other mod do it?
@eralatio The original 3D Armor Fly & Swim mod does what you described. More precisely, if there is something to stand on 2 blocks below the player, the player is considered not flying. But this approach has its limitations, too.
If the height is not changing much, it is also possible that the player is flying horizontally. I considered finding the acceleration of the player, but it is a bit too hard.
So there is no heuristics that work perfectly. Since I prefer playing MTG and Mineclonia with the fly mode always on, I simply assumed the player is always flying if it has the "fly" privilege.
But if you prefer that it behaves like the original 3D Armor Fly & Swim mod, I can add a configurable option.
@eralatio v2.0.2 added an option to detect if there are sufficient amount of air blocks under the player's feet. If not, the player is not considered flying. This is the behavior of the 3D Armor: Fly & Swim mod.
This is producing strange behavior, yes. Even grass is considered walkable and it switches modes. Wouldn't it be better to check for solid blocks? Or say if the vertical accel is not changing much, we could assume we stand on something - except we're in a liquid which would trigger the swim anim. I can try fiddling with it a bit.
Have you asked the engine devs on how to guess if fly mode is active or not? Perhaps they can expose that flag, This should help a lot, no?
@eralatio Yes. It would be helpful to improve the code for detecting what consists of a "solid" block. And the server may be able to detect if the acceleration is approximately equal to g by sampling the velocities across multiple
global_stepinvocations. If you manage to improve the code, please open a pull request.I haven't asked the engine devs, yet. If they could add a communication protocal so that clients can tell the server whether the fly mode is enabled, it will help a lot.