|
Player12
An open source football management simulator
|
Classes | |
| struct | ActionInput |
| struct | FootState |
| struct | GaitBands |
| struct | KickTiming |
| struct | StrideInput |
| struct | Swing |
| struct | TwoBone |
Enumerations | |
| enum class | Action : std::uint8_t { IDLE , WALK , JOG , RUN , SPRINT , TURN , PASS , SHOT , CROSS , HEADER , TACKLE , SLIDE , KEEPER_SET , KEEPER_DIVE , KEEPER_HOLD , THROW_IN , CELEBRATE , DEJECTED } |
| enum class | Event : std::uint8_t { NONE , PASS , SHOT , CROSS , HEADER , TACKLE , SLIDE , THROW } |
| enum class | Mood : std::uint8_t { NONE , CELEBRATE , DEJECTED } |
Functions | |
| float | smoothStep (float t) |
| float | flatDistance (Vec3 a, Vec3 b) |
| TwoBone | solveTwoBone (Vec3 root, Vec3 target, float upper, float lower, Vec3 pole) |
| float | rollOntoToes (Vec3 &ankle, Vec3 hip, Vec3 footForward, float toeLength, float reach, float maxAngle) |
| Vec3 | stanceSpot (const StrideInput &input, float share) |
| Vec3 | stepFoot (FootState &foot, const StrideInput &input) |
| Action | locomotionFor (float speed, const GaitBands &bands={}) |
| Action | selectAction (const ActionInput &input, const GaitBands &bands={}) |
| float | dutyFactor (float speed) |
| Swing | followThroughFor (Event event) |
| Vec3 | kickAnkle (Event event, float seconds, Vec3 contact, Vec3 direction, Vec3 across, const KickTiming &timing, float &weight) |
Variables | |
| constexpr Vec3 | UP {0.0f, 0.0f, 1.0f} |
| constexpr float | PI = std::numbers::pi_v<float> |
| constexpr float | TWO_PI = 2.0f * PI |
Procedural skeleton helpers of the 3D match view: a two-bone IK solver for legs and arms, foot planting that pins a stance foot to the grass while the body moves over it, the action chosen from the engine state, and the timed kick and tackle curves. Pure math (no drawing), so it is unit tested on its own. Distances are metres, angles radians, times simulated seconds.
|
strong |
|
strong |
|
strong |
|
inline |
Share of the gait cycle a foot is on the ground at this speed (m/s).
|
inline |
Where the kicking ankle goes seconds after the ball was struck: on the ball at contact, then through along direction and back to the gait. weight (0..1) is how much the curve owns the leg (it hands back to foot planting during the recovery).
|
inline |
A planted foot the hip can no longer reach rolls onto its toes: the heel lifts around the toe (toe = ankle + forward * toeLength) until the ankle is back within reach of the hip, so the toe never leaves its spot. Returns the heel angle; ankle is updated in place.
|
inline |
Picks the action that owns the body this frame. Dives beat everything, then the timed ball actions, then holding the ball (throw-in, keeper), goal reactions, the keeper's set stance and finally the gait.
|
inline |
|
inline |
Places the middle joint of a two-segment limb so the end lands on the target, bending towards pole (knees forward, elbows back). Targets out of reach leave the limb straight towards them.
|
inline |
Ideal stance position for a stance progress share in [0, 1].
|
inline |
Advances one foot and returns its world position on (or above) the grass. In stance the foot keeps the exact spot it was put down on, so it never slides; in swing it travels from where it lifted off to the next landing spot on a low arc. Standing players keep both feet down and only step when the body has drifted away from them.
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |