Syncing 3D animation with hitboxes

Started by
5 comments, last by LorenzoGatti 3 weeks, 3 days ago

I've been working on a game where I'm using godot as a dumb client (for 3d rendering) and a server that's my own engine, the reason for the separation is for LAN multiplayer.

I'm not sure how to sync up the hitboxes for limbs with the characters animations. Should I create a simpler model and parse the vertices for my collision algorithm? Have saved hitbox configurations for each frame? Or some other solution?

Most articles on the topic are for specific game engines, but all the logic is handled by my own engine and I don't know how to implement this part. Any advice would be appreciated, thanks!

Advertisement

You should be able to use the world transform for a limb to reposition and reorient its oriented bounding box for collision detection.

@scott8 Thanks for your reply Scott.
My server that I'm doing the calculations on doesn't know about godots objects. Are limbs treated as a separate object that are synced up with the animation?
My understanding of Godot is limited, I just ran into too many issues making my own rendering engine so I decided to use an existing engine and godot seems like its the easiest to isolate to only use it as a rendering engine.

konev13 said:
Are limbs treated as a separate object that are synced up with the animation?

I don't know Godot, but usually there is a ‘skeleton hierarchy’, and each limb is called a ‘bone’.
Technically it's the same as a tree of object transforms.

So you would need this skeleton data, the animation data to animate it, and the player position, to reproduce on the server what the players can see. Using Godot also on server would be an option, so you don't have to implement all this.

Or you use just a cylinder and player position, ignoring accurate individual limbs.

Edit:
Idk if it's practical these days to send the limb transforms from client to server?
To avoid a need for transform matrices you could only transfer joint positions, and calculate capsules for the limbs from that. 8 bit coordinates should do, besides one position for the root bone at full precision.

@JoeJ Looking it up there is a “Skeleton3D” class, I'll have to do more research into it before I decide my next step. I didn't know enough about 3D game engines to even look for this before, because most tutorials online for engines use as much drag and drop as possible haha.
The nice thing with godot is you can access the dependencies from outside of the engine, so I can do the calculations on the same object and just sync up the animation start times on both the client and server.
Thanks for the help!

If your animation system can transform visible objects attached to bones, it can transform hitboxes attached to the same bones: both are generic 3D geometry and probably authored together in the same 3D model editor.
The difference, and the game engine dependence, comes in the next logical step: the transformed hitboxes need to be used for collision detection, not for rendering (except for debugging purposes).

How do you use hitboxes in your game server? What data structure conversions and modifications are needed to obtain what the collision system needs from animation results? Making the two parts of your game engine meet in the middle is, in theory, straightforward; difficulties should be caused by specific complications and shortcomings of your current design.

Omae Wa Mou Shindeiru

Advertisement