Let players fall over #114
Labels
No labels
animation
audio
blocked
bug report
controversial
documentation
easy
feature request
hard
medium
multiplayer
physics
ui
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Blocks
Depends on
#113 Make the playground toys real mechanisms
elsie/liuverse
#110 Add a physics engine (rapier3d)
elsie/liuverse
Reference
elsie/liuverse#114
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
A player in this game cannot fall over. There is no pose for it, no way to be
knocked down, and nothing on the campus can push you over — a bus drives
through you and you step out of its way, because the vehicles have no mass
and the players have no body.
That is the cheapest thing a physics engine gives and the one that changes the
feel of the campus most: a body that can be knocked over, lie there, and get
back up.
What it buys
reaches you moves you. A player that reaches you at speed moves you.
back up: a ragdoll that stays down is a nuisance, a ragdoll that gets up
after a moment is a laugh.
How a ragdoll works here
A ragdoll is a set of rigid bodies joined by impulse joints: a pelvis, a
torso, a head, two upper arms, two lower arms, two thighs, two shins. Rapier
has everything for this —
RevoluteJointBuilderfor the shoulders and hips,FixedJointBuilderfor the neck and the spine, and aMultibodyJointSetforthe reduced-coordinate version if the joint chain wants to be exact.
The project already has most of the hard half.
liuverse-world::avatarbuildsthe joints — planted feet, analytic knee IK — and
liuverse-render::avatardraws a body as
PART_COUNTparts, each aFramePartof one mesh and atransform. So the ragdoll does not need a new body model: it needs the
existing joints to be driven by the simulation rather than by the pose,
which means the renderer has to accept joint poses from a source other than
the player controller.
Where it fits
The ragdoll is a client-side affair, which is unusual for this project and
deliberately so. Players are client-authoritative and cheating is out of scope
for a co-op game, so the local client's ragdoll can be its own business. But
peers have to see it, which means the ragdoll's state travels on the wire:
the
ClientPosegrows a flag for it, and the ragdoll's own pose goes outbeside it. The wire contract is append-only — new fields go at the end of the
struct — so this is a field, not a reshuffle.
The local ragdoll physics runs in the client, which is where the physics
world for the player lives. That means the client has a physics world even
though the server owns the vehicles, which is one of the two worlds the
physics issue has to decide between.
Where it lives
The joint chain and the ragdoll simulation belong in
liuverse-world::avataror beside it, next to the existing joint maths. The renderer needs no new
model — only a way to be handed joint transforms.
Related
The comic mortality loop from #230 (
65ebde9) already gives the knockdown half: a light vehicle or a slow hit trips the body, a hard fall or a heavy hit kills it, the avatar lies down, and it gets up at the last safe ground. What is still missing is the ragdoll this issue specifies — the body is a pose with a timer, not a joint chain, and #113 depends on that body. Leaving the issue open on #110 (physics engine).