diff --git a/reports/GeckoLib creature animation survey.md b/reports/GeckoLib creature animation survey.md new file mode 100644 index 00000000..de5051aa --- /dev/null +++ b/reports/GeckoLib creature animation survey.md @@ -0,0 +1,106 @@ +# Fix the clip data first, then add tail lag and head look + +Date: 2026-11-03. Status: research report for the project lead. It changes no code, asset or plan module. Four notes back it, in `research_notes/GeckoLib creature animation survey/`. + +Project Nublar's dinosaur clips have data faults that cost more than any missing feature. 179 rotation values in 10 clips are between 10^6 and 10^10 degrees. Most of the T. rex file only holds the rest pose. Every clip is baked at 24 to 25 keys per second, and GeckoLib 4 scans that data from the start on every frame. Two code faults also show in game. The breathing sway skips the last one or two tail bones of every species and the Brachiosaurus head. No species turns its head, because all six models are built with head turning off. The surveyed mods agree on the next layer: a tail that lags the body's turn, a clamped look-at spread over the neck, footstep sounds cued from the clip, and per-clip speed and hit-timing data. Each is small and runs on GeckoLib 4 today. Additive layers, distance-driven walk cycles and exact sound markers should wait for the GeckoLib 5 port, where the library supports them. None of the 13 mods read has foot IK, turn-in-place clips, blinking or animation LOD, so in those areas Nublar would lead. + +**Labels.** `[v]` means verified in source, at the commit the note names. `[m]` means measured on Nublar's files in this session. `[inf]` means inference. `[doc]` means a README, wiki or store page. No result here was tested in game. + +## 1. What is wrong with Nublar's animations now + +| # | Finding | Evidence | Effect in game | +|---|---|---|---| +| N1 | 179 rotation values between 10^6 and 10^10 degrees: Brachiosaurus drink, call, eat1, roar; Dilophosaurus eat1, head_shake; Gallimimus swim; Velociraptor dead, roar, scratch | `[m]`, rechecked in this session | Probably bone flicker or a snap on those frames `[inf]` | +| N2 | 64 % of channels never change and 58 % hold exactly the rest pose. 1,432 of 4,545 bone entries animate nothing; on the T. rex, 850 of 1,411 | `[m]` | No visual effect, but on GeckoLib 5 a listed bone belongs to that controller, so these entries would block other layers `[v]` | +| N3 | Baked density: 110,620 keys, sampled at 24 to 25 per second. The T. rex file is 5.6 MB; hand-keyed T. rex files in other mods are 73 to 181 KB | `[m]`; Fossils & Archeology Revival and Unusual Prehistory files `[m]` | GeckoLib 4 walks each keyframe list from the start for every bone and axis on every frame `[v]`, so CPU cost grows with file size | +| N4 | Bezier keys export as `"easing":"bezier"`, which neither GeckoLib 4 nor 5 supports, so they play linear | Blockbench GeckoLib plugin, GeckoLib EasingType `[v]` | Curves authored in Blockbench go flat in game | +| N5 | Catmull-rom differs from the Blockbench preview: GeckoLib 4 uses the wrong incoming tangent (median 0.75°, 110 channels over 3°). 484 segments have catmull on one end only, and 927 looping channels have no wrap at the seam | `[v]` `[m]` | Small wobble and seam pops. GeckoLib 5 fixes the tangent | +| N6 | `IdleSway` covers `tail1` to `tail3`, but every species has `tail4`, and Brachiosaurus also has `tail5`. It writes `head`, but the Brachiosaurus bone is `head1` | `[v]` `IdleSway.java`, geo files | Tail tips are rigid, and the Brachiosaurus head never sways | +| N7 | Every `DinosaurGeoModel` is built with the one-argument constructor, so head turning is off | `[v]` `ClientRegistrationHolder.java` L45-50 | Dinosaurs never look at players or targets | +| N8 | The Brachiosaurus walk, run and eatingtall2 clips have sound keyframes (`walk2`, `grabdeeznuts`), but no handler is registered | `[v]` | No footsteps, and GeckoLib 4 prints a line to stdout every walk cycle `[v]` | +| N9 | No bone is free of keyframes: clips key `root`, `hips`, `neck1` and the tails | `[m]` | Every procedural layer must add a delta after the controllers. It cannot own a bone | + +## 2. What the surveyed mods do + +| Mod | Licence | What is worth learning | +|---|---|---| +| Fossils & Archeology Revival 1.20.1 | MIT code, assets reserved | Per-clip data: blocks per second for gaits, time-to-hit for attacks. Speed divided by growth scale. Sound and particle keyframes. Re-anchors the tick on a speed change | +| Unusual Prehistory 1.20.1 | MIT code, assets reserved | Three stacked bones per joint (code, gesture, walk), so a bite plays over a walk. Lag-and-decay tail yaw | +| Jurassic Revived | CC-BY-ND | Body yaw change, smoothed, spread down six tail bones with falling weights and a counter-roll | +| Naturalist | MIT code, assets reserved | Damped tail follow (gains 0.35, 0.16, 0.12). Eased visual body yaw with bank. Footstep cues in code. Four-corner terrain sample | +| Mowzie's Mobs | All Rights Reserved (ideas only) | Empty "controller bones" whose key value is a 0 to 1 weight for head look or tail physics. Attack sections: wind-up, active, recovery. Clip time anchored to the server start tick | +| Dragon Survival | Custom, restrictive (ideas only) | Smoothed yaw and vertical speed exposed as Molang queries. Per-transition blend lengths of 2 to 10 ticks | +| Alex's Caves (Citadel) | ARR / no licence file (ideas only) | Tail follower limited to 8° a tick, split 0.8 / 0.2. A sine envelope that weights each procedural layer | +| JurassiCraft 2, DumbLibrary | Read from public mirrors | Look-at spread over chest, neck and head with a divisor. A removed clip's last pose fades over 7.5 ticks | +| Bosses of Mass Destruction, Critters and Companions | LGPL-3.0, MIT | Timed, cancellable attack events. Range and sight re-checked on the hit tick | +| GeckoLib 5, AzureLib | MIT | GeckoLib 5: about 80 Molang queries, exact sound markers, `setAnimationTime`, additive controllers. AzureLib: controller weights and bone masks | + +**Do not port** LLibrary's `ChainBuffer` as Ice and Fire 1.20 ships it. It only adds a turn when the yaw changed by less than 0.1° that tick. Its wave step reads yaw where it should read pitch. It never wraps the yaw change `[v]`. + +## 3. Recommended order + +Effort: S is hours, M is days, L is a week or more. + +### Now, on GeckoLib 4: asset fixes (no Java) + +| Rank | Change | Fixes | Effort | +|---|---|---|---| +| A1 | Set the 179 out-of-range keys to their likely value (0) and check each clip in Blockbench | N1 | S | +| A2 | Strip channels and bone entries that only hold the rest pose. This is exact and changes no pose | N2 | S | +| A3 | Offline keyframe reduction, catmull-aware: 40 % fewer keys at 0.1° error, 60 % at 0.5°. T. rex: 49 % and 70 %. Review by eye afterwards | N3 | S-M | +| A4 | Authoring rules: no bezier keys; catmull on both ends of a curved segment; a duplicate seam key on looping catmull clips | N4, N5 | S | + +A small Python tool in `tools/` would cover A1 to A3 and re-run on every Blockbench export. It needs the lead's approval, because it rewrites asset files. + +### Now, on GeckoLib 4: small code + +| Rank | Change | Source | Fixes or improves | Effort | +|---|---|---|---|---| +| C1 | A sound keyframe handler on the movement controller, plus footstep markers in walk and run clips. On GeckoLib 4, markers fire early by the transition length (about 0.25 s); shift them or accept it | Fossils, Naturalist, GeckoLib `[v]` | N8; footsteps for all species | S | +| C2 | A critically damped spring helper: a pure class tested like `MovementGait`, stepped on the client tick and lerped by partial tick | Holden, "Spring-It-On" `[doc]` | Base for C3 to C5 | S | +| C3 | Tail and neck turn lag: the wrapped body yaw change drives a follower, spread over the chain with weights that fall toward the root | Alex's Caves, Naturalist, Jurassic Revived | Rigid tails on turns, all species | S | +| C4 | Replace `IdleSway` with a chain wave built from each species' real bone lists | Citadel chain helpers | N6 | S | +| C5 | Own look-at: clamped, spread over the neck bones with a weight that grows toward the head, spring-smoothed, faded out during eat, drink, roar and attack | Citadel `faceTarget`, JurassiCraft 2, Mowzie | N7; most visible on long necks | S-M | +| C6 | Layer weights: a 4 to 6 tick smoothstep for each procedural layer, driven by states `DinoAnimator` already tracks | Alex's Caves, DumbLibrary | Keeps C3 to C5 from fighting the clips | S | +| C7 | Per-clip data: gait blocks per second and attack time-to-hit, so the server hits when the jaw closes | Fossils & Archeology Revival | Foot slide; bite timing | S-M | +| C8 | Baby gait speed divided by growth scale; longer blends into sleep and sit | Fossils & Archeology Revival | Babies' feet slide; rest snaps | S | + +The procedural note estimates C2 to C6 at under 300 lines of pure code plus about 40 lines in `DinosaurGeoModel` `[inf]`. Per-animal state lives in a client-only object owned by `DinoAnimator`, created lazily, because the GeoModel is shared by every animal of a species. + +### Next: medium work + +| Rank | Change | Source | Effort | +|---|---|---|---| +| M1 | Body lean into turns, nose-down on slopes, a small rock at start and stop, with the neck counter-rotated. Fed by the speed average in `MovementGait` | Ice and Fire, Subterranodon | M | +| M2 | Ground fitting before full IK: body pitch and drop from per-leg ground height, with a smooth minimum for bipeds | Citadel / JurassiCraft leg articulator, Naturalist | M | +| M3 | Attack sections (wind-up, active, recovery) started by one packet, with damage at the active boundary and a range check on the hit tick | Mowzie, Critters and Companions, BOMD | M | +| M4 | Split clips by body region so controllers do not overlap: legs in movement, neck and head in main, tail in a third | GeckoLib example, Unusual Prehistory | M, required on GeckoLib 5 | +| M5 | Re-author the worst baked clips by hand with sparse keys: T. rex roar, drink and rest; Dilophosaurus sniffground | Authoring note | L, before the port | + +### Wait for the GeckoLib 5 port + +| Change | Why wait | +|---|---| +| Distance-driven walk time (`query.limb_swing` or `setAnimationTime`) | GeckoLib 5 has seek and smooth speed changes. On GeckoLib 4, the current speed limiter in `MovementGait` is the right tool | +| Additive breathing and flinch layers | GeckoLib 4 has no additive mode. Test GeckoLib 5's rest-rotation subtraction first, because 81 of 91 T. rex bones have a rest rotation | +| Random start offset per animal | Built in on GeckoLib 5. On GeckoLib 4 it needs a controller subclass | +| Molang tail and neck follow per clip | GeckoLib 4 lacks the head and limb queries | +| Controller weights and bone masks | Neither GeckoLib version has them. Copy AzureLib's idea into a GeckoLib 5 bone updater | + +**Porting traps found** `[v]`: `forceAnimationReset` is gone (use `reset()` or `setAnimationTime(0)`). Held animations now report finished. A zero transition snaps to rest on stop. A fresh controller seems to drift toward rest and then snap `[inf]`. `DinoAnimator.set()` depends on the first two. + +## 4. Open items for the lead + +1. Approve an asset tool that rewrites the six animation files (A1 to A3), or decide to fix them by hand in Blockbench. +2. Confirm the out-of-range keys should become 0. Each clip needs a visual check, because the right value may be a neighbouring key. +3. Choose between procedural deltas (C3 to C5, no model edits) and dedicated control bones (Unusual Prehistory, Mowzie), which need edits to all six geo files but stop the code fighting dense head keys. +4. Choose whether attack timing (C7, M3) waits for the planned threat display and attack track, rank 10 of the Beta survey. + +## Sources + +| Note | Covers | +|---|---| +| `prehistoric_geckolib_mods.md` | Fossils & Archeology Revival, Unusual Prehistory, Jurassic Revived; six closed-source jars measured; 10 candidates dropped | +| `creature_and_boss_animation_mods.md` | Mowzie's Mobs, Dragon Survival, Naturalist, Bosses of Mass Destruction, Critters and Companions | +| `geckolib_animation_features_and_authoring.md` | GeckoLib 4.8.4 and 5.5.6, Blockbench and its plugins, AzureLib; keyframe measurements | +| `procedural_motion_techniques.md` | Alex's Caves, Citadel, JurassiCraft 2, DumbLibrary, Ice and Fire, spring smoothing | diff --git a/research_notes/GeckoLib creature animation survey/creature_and_boss_animation_mods.md b/research_notes/GeckoLib creature animation survey/creature_and_boss_animation_mods.md new file mode 100644 index 00000000..3ab677ca --- /dev/null +++ b/research_notes/GeckoLib creature animation survey/creature_and_boss_animation_mods.md @@ -0,0 +1,212 @@ +# Creature, dragon and boss mods: how they animate on top of GeckoLib + +Research note for the GeckoLib creature animation survey. Written 2026-11-03. Scope: the animation side of five non-dinosaur mods with readable source: Mowzie's Mobs, Dragon Survival, Naturalist, Bosses of Mass Destruction (BOMD) and Critters and Companions (C&C). The note covers controller layout and state selection, procedural motion on top of clips, attack timing between server and client, turns and gait changes, keyframe events, and performance. Hitboxes and multipart are out of scope (see `research_notes/Multipart entity hitbox systems/mowzies_mobs.md`). The Mowzie dynamic chain and leg solver basics are already in that note and are only referenced here. The CHAOS IK audit (`research_notes/CHAOS branch IK audit/chaos_ik_audit.md`) is the Nublar-side IK reference. + +Labels: **[v]** verified in source at the stated commit, with path and lines. **[inf]** inference from verified facts. **[doc]** from a README, comment or licence text. Clean room: no code is pasted. Mechanisms are described in words and numbered steps. Mowzie's Mobs is All Rights Reserved and Dragon Survival uses a restrictive custom licence, so their techniques may inform a design but nothing may be copied, including animation JSON values. + +Nublar baseline used for comparison (commit `0838bd4a9ed4b5b95929a4c2b747b11c3523dea4`, 2026-10-25): two controllers (movement with speed-matched rate and hysteresis in `MovementGait`; main with a priority list in `DinoAnimator`), blend 4 to 5 ticks and 2 for reactions, breathing sway added in `DinosaurGeoModel.setCustomAnimations` through `IdleSway`, head look from `DefaultedEntityGeoModel`, one-shots from a synced byte (`DinoOneShots`). No tail or neck physics, no IK, no keyframe events. + +Repository facts: + +| Mod | Licence (SPDX) | Branch and commit read | Minecraft | Loaders | Animation library | +|---|---|---|---|---|---| +| Mowzie's Mobs | No SPDX. "All Rights Reserved unless otherwise explicitly stated" [v] License.txt L1 | `1.20`, `64d15248c4421fdf8555165134b306e8cfc0a6c6` (2026-04-22) | 1.20.1 | Forge | GeckoLib 4 (CurseMaven file 7553267) [v] build.gradle L110, plus a vendored LLibrary for older mobs | +| Dragon Survival | No SPDX. Custom "Dragon Survival License" v1.2, Sept 2026; addons and forks allowed, asset reuse needs permission [v] LICENSE.txt L1-30, L63 | `1.21.1`, `7623d8435bd5dad4a05f9fb55a964a1941f79194` (2026-11-01) | 1.21.1 [v] gradle.properties | NeoForge | GeckoLib 4.7.5.1, range [4.6,) [v] gradle.properties | +| Naturalist | MIT for code; All Rights Reserved for `*/src/main/resources/` [v] LICENSE L1-20 | `1.20.1-MultiLoader`, `82ef491e942b68114fc1ce98e2669b5b540f4e75` (2026-10-22), mod 2.0.9 | 1.20.1 [v] gradle.properties L8 | Forge and Fabric | None. This line uses vanilla `HierarchicalModel` and `AnimationState`, not GeckoLib [v] (no GeckoLib reference anywhere in the tree) | +| Bosses of Mass Destruction | LGPL-3.0 (text of LGPL v3; "only" or "or later" not stated) [v] LICENSE L1-3 | default branch, `2fbd0dc79bea498bcad755c4ad9969055dc452c7` (2024-10-13), mod 1.10.2 | 1.21.1 [v] gradle.properties | Fabric | GeckoLib 4.5.6 [v] gradle.properties, build.gradle L55. Kotlin | +| Critters and Companions | MIT for code; All Rights Reserved for `common/src/main/resources/assets/` [v] LICENSE.md L1-20 | `1.20.1/main`, `f99845def4850de2828b2d225f7c4c16131b6364` (2026-08-19) | 1.20.1 [v] gradle.properties | Forge and Fabric | GeckoLib 4.2.3 [v] gradle.properties | + +Candidates dropped: Isle of Berk (`JCback/IsleofBerk`, master `854c1d1`, 2020) holds only a README and language files [v]. Born in Chaos (`FoxyFox909/Born-in-Chaos`, `b7dc5e3`, 2023-09-18) holds two Java files and no GeckoLib code; licence All Rights Reserved [v]. Creatures and Beasts and Untamed were not found with public source in the time available (gap). + +Base URLs: MM = `https://github.com/BobMowzie/MowziesMobs-Public/blob/64d15248c4421fdf8555165134b306e8cfc0a6c6/src/main/java/com/bobmowzie/mowziesmobs/`; DS = `https://github.com/DragonSurvivalTeam/DragonSurvival/blob/7623d8435bd5dad4a05f9fb55a964a1941f79194/src/main/java/by/dragonsurvivalteam/dragonsurvival/`; NAT = `https://github.com/Starfish-Studios/Naturalist/blob/82ef491e942b68114fc1ce98e2669b5b540f4e75/common/src/main/java/com/crispytwig/naturalist/`; BOMD = `https://github.com/miyo6032/bosses-of-mass-destruction/blob/2fbd0dc79bea498bcad755c4ad9969055dc452c7/src/main/kotlin/net/barribob/`; CC = `https://github.com/bonsaistudi0s/CrittersAndCompanions/blob/f99845def4850de2828b2d225f7c4c16131b6364/common/src/main/java/io/github/bonsaistudi0s/crittersandcompanions/`. Paths below are relative to those bases. + +## Key question 1: Controller layout and state selection + +### Takeaway + +Nobody uses many controllers for the base body. Dragon Survival is the richest: one main controller for locomotion and poses, separate controllers for bite and breath, several emote slots and several "continuous" slots that always play. The main lever against jitter is not hysteresis but per-transition blend lengths: each branch of the state selector sets its own `transitionLength` (2 ticks for snappy changes, 6 to 8 for flight changes). Mowzie switches the blend to 0 whenever an ability owns the controller, so attack clips start exactly on their tick. Naturalist (vanilla animation states) gets crossfades by fading a weight per state at a fixed rate per tick, with idle also faded by limb-swing amount, which removes the hard idle/walk flip. + +### Cited Findings + +- Dragon Survival registers one `main` controller (blend 2), N emote slots, a `bite` and a `breath` controller (blend 2 each) and N "continuous" slots used "for things that need to play always (wind blowing, breathing)". [v] — DS `common/entity/DragonEntity.java` L125-141 +- The main predicate is a long if/else ladder: emote override, ability animation, magic-source sit, sleep, riding, flight (spin, dive, dive-alt, climb, soar, land, hover, fly), swim, land-end, climb, jump, fall, sneak, sprint, walk, dig, idle. Each branch sets its own blend length: 8 for spin, 7 for steep dive, 6 for powered flight, 4 for run and fast swim, 3 for walk, idle and sneak, 2 for landing, swim and climb, 5 for fall and sneak-walk. [v] — DS `common/entity/DragonEntity.java` L575-781 +- If the controller had no animation before the predicate ran (fresh entity, dimension change), the blend is forced to 10 ticks to hide the T-pose-to-clip snap. The comment says "instantly transition", but the code sets 10. [v] — DS `common/entity/DragonEntity.java` L784-786 +- A landing is a two-part chain: while the land clip is playing and the dragon touches ground, the predicate switches to a land-end clip and records that clip's length in a tick timer. Later ticks keep the land-end clip while the timer has time left, so the clip is not cut by the next state. [v] — DS `common/entity/DragonEntity.java` L717-728; `client/render/util/AnimationTickTimer.java` L11-50 +- Short one-shots (bite, use item, eat) use the same latch: the first frame stores the clip's baked length in the timer, and the predicate keeps the clip while the timer has time left, even if the input flag has cleared. [v] — DS `common/entity/DragonEntity.java` L324-382 +- Emotes carry a `blend` flag. A non-blending emote stops the main controller, so the emote fully owns the body. Blending emotes play on their own slot over the main clip. Emotes and abilities can also "lock" the neck and tail (see Q2). [v] — DS `common/entity/DragonEntity.java` L598-611, L801-811 +- Mowzie GeckoLib mobs use a single controller with blend 5. When an ability is active, the predicate sets blend 0 and delegates to the ability; otherwise it loops idle. [v] — MM `server/entity/MowzieGeckoEntity.java` L27, L103-127 +- Mowzie's controller subclass adds `playAnimation`, which forces a reset, sets the clip, polls it from the queue and computes the tick offset from the entity's own tick count at once. A code comment says mobs normally do not start a clip until they render, "even if the behavior starts off-screen", and this fixes it. [v] — MM `client/model/tools/geckolib/MowzieAnimationController.java` L20-47 +- C&C's shared bug predicate is a short priority list: custom (death, hit) > fly > dance > sit > walk > idle. Blend is 4 ticks, except 0 into sit and 0 out of sit to idle. [v] — CC `common/entity/animation/BugAnimations.java` L35-81 +- BOMD bosses have one controller with blend 5. The client sets the next clip only when a status byte arrives, and loops idle otherwise. [v] — BOMD `boss/mob/mobs/gauntlet/AnimationHolder.kt` L10-46 +- Naturalist's state weight: each state has a factor that moves toward 1 or 0 by a fixed fraction per tick (0.5 default, 0.25 for poses such as sit and sleep, 1.0 for instant states such as bite). The state stops when the factor falls under 0.001. The model skips a state whose factor is at or under 0.05. [v] — NAT `world/entity/SmoothAnimationState.java` L6-48; `client/model/NaturalistEntityModel.java` L112-123 +- Naturalist idle is also scaled by one minus 2.5 times the limb-swing amount, so idle fades out smoothly as the animal starts moving instead of switching at a speed threshold. [v] — NAT `client/model/NaturalistEntityModel.java` L132-143 + +### Inferences + +- Per-transition blend lengths are cheap and fit Nublar's priority list. A stand-to-walk wants about 3 ticks, run-to-stand longer, flinch 2. Nublar uses one value for all main transitions (4 to 5) and 2 for reactions. [inf] +- Dragon Survival's tick-timer latch is the same job Nublar's server-cleared one-shot byte does, but done on the client. It keeps a one-shot alive for its baked length even if the flag flickers. [inf] + +### Gaps + +- None of the five uses explicit hysteresis like Nublar's `RunGait`. Dragon Survival relies on player input being stable. Mobs in Mowzie are ability driven, so the question does not arise. + +## Key question 2: Procedural motion on top of clips + +### Takeaway + +Three patterns stand out. (1) Mowzie "controller bones": empty bones whose keyed X position (0 to 1) is read in code as a weight. Animators fade procedural layers (head look, idle noise, tail physics, walk/run blend) in and out from inside each clip. (2) Dragon Survival "handler bones": extra wrapper bones in the rig hierarchy that only Molang drives. Every clip carries Molang tracks on them that read smoothed yaw-change and vertical-speed values from code, so each clip decides how much tail swing and neck counter-turn it gets. (3) Naturalist's damped body chain and terrain leg solver: per-segment exponential follow of the body yaw with gains that fall toward the tail tip, plus a four-corner ground sample that pitches and rolls the body and lifts each leg. All write after the clip, inside the model's custom-animation hook, and all avoid accumulation by resetting each frame or by writing to bones no clip touches. + +### Cited Findings + +**Mowzie's Mobs** + +- `MowzieGeoModel` resets every registered bone to its initial snapshot (rotation, position, scale) in `applyMolangQueries`, before GeckoLib applies animation. So code can add to bones each frame and never accumulate, even on bones no clip keys. [v] — MM `client/model/tools/geckolib/MowzieGeoModel.java` L24-44 +- Controller bones: `getControllerValue(name)` returns the named bone's X position (0 if the model is not ready) and an inverted form returns one minus it. Sixteen such bones are read across the mod: armAim, bellyBounce, featherRaise, featherShake, gauntletProgress, handLeft/Right, idleAnim, locomotionAnim, maskPlacementSwitch, tailPhysicsBlend, torsoAim, transformTexture, walkRunSwitch, wallCling, whichForm. [v] — MM `client/model/tools/geckolib/MowzieGeoModel.java` L46-58; text search of `client/` +- Sculptor uses `torsoAimController` to split head look between head and chest: head gets look times (1 minus c), chest gets look times c. An attack clip can move aiming to the torso and back without code changes. [v] — MM `client/model/entity/ModelSculptor.java` L62-67 +- Sculptor's procedural idle (eyebrows, cloth, legs, mouth scale, arms) is multiplied by `idleAnimController`. The arm part is also multiplied by an inverted "disable arms" controller, so a clip can silence just the arms. [v] — MM `client/model/entity/ModelSculptor.java` L250-299 +- Umvuthi spreads the look over three bones (neck, neck2, head), each taking one third of the clamped yaw and pitch. Yaw is clamped to plus or minus 140 degrees. Its idle is a set of sine waves with small per-bone phase offsets (0 to 0.6) so motion ripples down the chain. Leg sway is scaled by one minus a "legs up" timer value. [v] — MM `client/model/entity/ModelUmvuthi.java` L39-110 +- Elokosa's tail physics strength is set per frame from `tailPhysicsBlendController`: the chain's alpha is one minus that value, and the chain output is a lerp between the animated pose and the simulated pose by alpha. A clip can pin the tail to its keys (for an attack) and let it go loose after. [v] — MM `client/model/entity/ModelElokosa.java` L162-170; `client/model/tools/dynamics/GeckoDynamicChain.java` L271-290 +- The dynamic chain is Verlet with gravity, damping, optional pull back to the animated pose (falling off with segment index squared), several sub-steps per frame and fixed segment lengths. If more than one tick passed since the last update (the entity was culled), it snaps to the animated pose instead of simulating, which stops a pop when the mob comes back on screen. It runs at render time from the renderer, after the normal render pass, and draws a duplicate "dynamic" bone set while hiding the originals. [v] — MM `client/model/tools/dynamics/GeckoDynamicChain.java` L122-170, L233-268; `client/render/entity/MowzieGeoEntityRenderer.java` L62-97. Mechanism already summarised in the multipart note. +- Mowzie's foot placement (LLibrary models only): per-leg ground height from a block sample; the body drops by the back average; the body tilts by the arctangent of back-minus-front over body length; front thighs and the neck counter-rotate by the same tilt; a leg on lower ground bends thigh and calf by the height difference. [v] — MM `client/model/tools/LegArticulator.java` L12-63 + +**Dragon Survival** + +- A per-player `DragonAnimationState` is ticked every client tick, "even if the dragon is off screen". Each tick it (1) pushes body-yaw change, head-yaw change and head-pitch change (each times 0.2) and negative vertical speed (times 10, reduced when the dragon pitches up or down) into 4-tick moving averages; (2) eases the stored value toward the average with a factor tuned to match their old 60 fps behaviour; (3) keeps a previous and current pose so the render frame can interpolate by partial tick. A "clear vertical velocity" flag zeroes the tail-lift history on water entry, so the tail does not jerk. [v] — DS `client/render/util/DragonAnimationState.java` L8-136; `client/render/ClientDragonRenderer.java` L344-352 +- `DragonModel.applyMolangQueries` publishes the sampled values as Molang queries: head yaw, head pitch, body-yaw change, tail lift, head-yaw change, head-pitch change, plus gravity and growth. Head values read 0 when the neck is locked; tail values read 0 when the tail is locked. [v] — DS `client/models/DragonModel.java` L43-70 +- The shipped animation file `dragon_center.json` (assets; restricted licence, read but not copied) has 104 clips. Body-yaw change appears in 63 clips, tail lift in 59, head yaw in 57, head pitch in 55. In the walk clip the Molang tracks sit on dedicated wrapper bones: five tail handler bones, four neck handler bones, a head handler, and separate yaw and pitch "head turn handler" bones per neck segment. The tail gain rises from tip to base and each value is clamped (about plus or minus 20 degrees for yaw). Neck handlers counter-turn against body-yaw change, with clamps shifted by the current head yaw. [v] — DS `src/main/resources/assets/dragonsurvival/animations/dragon_center.json` (parsed with a script; values summarised, not copied) +- Ability animations are data driven: a "compound" ability animation is a start clip then a looping clip, with its own blend length, layer, and neck and tail lock flags. [v] — DS `common/codecs/ability/animation/CompoundAbilityAnimation.java` L1-50 + +**Naturalist (vanilla model, not GeckoLib)** + +- Every model resets all parts to the rest pose at the start of each setup call and then applies clips and procedural offsets additively. [v] — NAT `client/model/NaturalistEntityModel.java` L64-79 +- `BodyChain` per tick: (1) eases a "render yaw" toward the body yaw by a fixed fraction (1.0 for alligator, 0.2 for shark, 0.15 for whale); (2) each segment eases its yaw toward the previous segment (segment 0 toward body yaw, segment 1 toward render yaw) with its own gain; alligator gains are 0.35, 0.16, 0.12; (3) the same for pitch; (4) a roll target equal to the render-yaw change times a factor, clamped (shark: 4 per degree, max 25), eased at 0.1. The model reads each segment's offset from its parent, interpolated by partial tick and wrapped, and adds it to the tail bones. [v] — NAT `world/entity/BodyChain.java` L23-87; `world/entity/animal/alligator/Alligator.java` L84-91, L377-394; `client/model/animal/alligator/AlligatorModel.java` L111-131 +- Alligator body pitch: on land the target pitch is 0 and the ease is 0.25 per tick; while swimming the target is the motion pitch, clamped, eased at 0.07. Roll from yaw change applies only in water. The model rotates the body by pitch and roll, rotates the neck back by a fraction of both, and lifts and counter-rotates the limbs. [v] — NAT `world/entity/animal/alligator/Alligator.java` L377-394; `client/model/animal/alligator/AlligatorModel.java` L111-131 +- `TerrainLegSolver` (client tick only for elephant and giraffe): for each of four foot points, offset forward and sideways from the body yaw and scaled by the entity scale, it walks down block collision shapes to find the ground distance, eases the stored height toward it by 0.2 per tick, and clamps it to a range. `IKEntityModel` then (1) takes front, back, left and right averages; (2) computes pitch as the arctangent of front-minus-back over twice the forward offset, and roll the same way over the side offset at half strength; (3) lowers the body by the mean height; (4) applies pitch and roll to the body and the inverse to the head; (5) lowers each leg by its own height. [v] — NAT `world/entity/TerrainLegSolver.java` L24-108; `client/model/IKEntityModel.java` L20-76; `world/entity/animal/elephant/Elephant.java` L84, L547-553 + +**BOMD and C&C** + +- BOMD writes absolute values (not additions) to code-only bones named "code_root" or "headBase". The Lich's body pitch is a neutral 30 degrees plus up to 15 degrees from its velocity direction (interpolated from a velocity history); the head pitch is the look pitch minus that body pitch; head yaw is head minus body yaw. [v] — BOMD `boss/mob/mobs/lich/LichCodeAnimations.kt` L9-29; `boss/mob/GeoModel.kt` L23-25 +- C&C red panda keeps the head level in world space: a `head_axis_align` bone gets the inverse of the summed parent rotations (built from a quaternion chain), the clip's `head` bone is compensated by the same amount, and a separate `head_rotation` bone takes the look yaw and pitch. [v] — CC `client/model/geo/RedPandaModel.java` L26-53; `client/util/AnimationUtils.java` L16-41 +- C&C otter clamps look yaw to plus or minus 35 degrees "to avoid jitter", applies pitch only in water, scales yaw by 0.6 while walking on land, and zeroes the root bone's rotation on land to stop pitch spikes from the clip. [v] — CC `client/model/geo/OtterModel.java` L16-51 + +### Inferences + +- Controller bones are the best fit for Nublar's dense baked clips. An animator can key, inside a roar or a bite, "head look off" or "tail physics off" without touching Java. It costs one empty bone per channel and works in GeckoLib 4 and 5. [inf] +- Dragon Survival's handler-bone approach moves the tail and neck response into the clip file. It needs wrapper bones added to each rig, and Molang tracks in every clip (or in an additive clip on a separate controller). That is a larger asset job for Nublar's 45 to 160-bone rigs, but it lets each clip tune its own sway. [inf] +- Naturalist's `BodyChain` is the cheapest "tail reacts to turning" layer: three gains per species, no physics, one array per segment, deterministic, and it already interpolates by partial tick. It drops straight into Nublar's `setCustomAnimations` as an additive yaw and pitch on tail and neck bones. [inf] +- Splitting head look over neck segments (Umvuthi: equal thirds; Dragon Survival: separate yaw and pitch handlers per segment, larger share near the head) suits long-necked sauropods better than one head bone. [inf] +- Nublar's `IdleSway` relies on GeckoLib re-writing every bone each frame. Mowzie's explicit reset in `applyMolangQueries` is a stronger guarantee if Nublar starts adding to bones that no clip keys (new procedural bones). [inf] + +### Gaps + +- None of the five uses real multi-joint IK for legs. Mowzie and Naturalist lift and bend; they do not solve knee angles. No mod plants a foot to a world point during a step. +- No mod has procedural jaw or blink. Mowzie's Sculptor uses a hand open/closed controller bone that swaps hidden meshes, which could be reused for eyelids. [v] ModelSculptor L73-82 + +## Key question 3: Attack choreography and server/client sync + +### Takeaway + +The best pattern is Mowzie's ability sections: one packet at start, then both sides run the same section timeline (startup, active, recovery) tick by tick, and the server does damage at a section boundary. The clip is started from the same tick, anchored to the entity's tick count rather than the first rendered frame. Combos chain by a "jump to section" packet in recovery. BOMD and C&C are simpler: send one status byte or `triggerAnim` at wind-up start, then the server runs a delayed event and re-checks range before damage. + +### Cited Findings + +- An ability is a list of sections, each typed STARTUP, ACTIVE, RECOVERY or MISC, and each instant, fixed duration or open ended. Every tick the ability counts ticks in the section and moves on when the duration passes. [v] — MM `server/ability/AbilitySection.java` L3-35; `server/ability/Ability.java` L58-98 +- The server sends a use-ability message to tracking players once at start, an interrupt message when it is cancelled, and a jump-to-section message for combos. There is no per-tick traffic. [v] — MM `server/ability/AbilityHandler.java` L82-133 +- Sculptor's attack: startup 5 ticks, active 7, recovery 11. The clip plays at the start of startup and alternates hands (start, right, left). An attack sound plays on startup tick 4 with a one-in-three chance. The boulder is launched on the server when the active section begins. In recovery, if a target is still valid, the server jumps back to section 0 for the next swing; otherwise the matching "end" clip plays. [v] — MM `server/entity/sculptor/EntitySculptor.java` L1163-1275 +- Hurt reactions respect the attack: an ability interrupts only when damage is at least a per-ability threshold, and the mob plays a hurt ability only if no ability is running or the running one can be interrupted. [v] — MM `server/ability/Ability.java` L224-234; `server/entity/MowzieGeckoEntity.java` L70 +- BOMD: the move selector sends a one-byte entity status for the chosen attack, then runs the attack. The client maps the byte to a "start" clip followed by a looping hold clip. The punch schedules timed events: a sound at tick 12, a closed-fist hitbox at tick 7, acceleration from tick 16 for 15 ticks, contact checks from tick 16 to 56, a stop-animation status at 56 and an open-hand hitbox at 64. Events cancel together if the attack is cancelled. [v] — BOMD `boss/mob/mobs/gauntlet/GauntletMoveLogic.kt` L39-43; `boss/mob/mobs/gauntlet/AnimationHolder.kt` L18-43; `boss/mob/mobs/gauntlet/PunchAction.kt` L32-77; `maelstrom/general/event/TimedEvent.kt` L3-18 +- C&C melee goal: on attack, it swings, calls `triggerAnim` once, sets a wind-up counter and stops navigation. When the counter ends, it hits only if the target is still in range and in sight, then starts a 20-tick cooldown. [v] — CC `common/entity/brain/goal/AnimatedDelayedMeleeAttackGoal.java` L109-163 +- Naturalist latches the vanilla `swinging` flag into a fixed-length timer so a short swing still plays the full bite clip. Its shark bite is an "instant" state (weight 1 at once). [v] — NAT `world/entity/AnimationTimer.java` L1-18; `world/entity/animal/greatwhiteshark/GreatWhiteShark.java` L107, L331-339 + +### Inferences + +- Nublar's one-shot byte already avoids per-tick packets. What is missing is (1) named phases with the damage tick at a phase boundary, rather than the server and the clip agreeing by convention, and (2) anchoring the clip time to the entity tick when it started, so a dinosaur that comes into view mid-attack shows the right frame. Mowzie's `playAnimation` does (2) with a tick-offset override. [inf] +- A recovery-phase "chain again" check gives combo bites (raptor double slash) with one extra packet. [inf] +- The C&C range re-check at the hit tick is a cheap fix for bites that land after the target has moved away. [inf] + +### Gaps + +- None of the mods uses GeckoLib custom-instruction keyframes to trigger server damage. Mowzie uses a sound keyframe handler only for client sounds (Q5). + +## Key question 4: Turning, start/stop and speed-matched gaits + +### Takeaway + +No mod has turn-in-place or run-to-stop skid clips. Turning is handled procedurally: Naturalist eases a visual body yaw behind the real yaw and banks the body into the turn; Dragon Survival and Mowzie bend tail and neck from yaw change. Dragon Survival solves the gait-rate problem exactly: when it changes the clip speed, it shifts the tick offset so the current phase stays the same. Mowzie Elokosa blends four directional walk cycles by the dot product of motion with the body axes. + +### Cited Findings + +- Dragon Survival's `setAnimationSpeed` helper: if the new speed differs, it (1) reads how far the clip has run since its tick offset; (2) moves the offset so that distance times old speed equals the new distance times new speed; (3) sets the new speed. The controller's tick offset is reached through a mixin accessor. [v] — DS `util/AnimationUtils.java` L17-28 +- Speed is matched for walk, run, sneak, swim and climb: the rate is a base plus a clamped term from horizontal speed over a per-gait base speed, divided by a size factor (bigger dragons play slower), then clamped between config minimum and maximum. A comment says a minimum is needed because zero speed breaks the state machine. [v] — DS `common/entity/DragonEntity.java` L789-798 +- Naturalist's movement rate is a base times limb-swing amount over a reference limb swing, clamped between a minimum (0.4 by default, 0.1 for swimmers) and 2.0. The reference comes from the movement-speed attribute. [v] — NAT `client/model/NaturalistEntityModel.java` L99-110 +- Naturalist's shark and whale rotate the whole renderer by the eased render yaw from `BodyChain`, so the body sweeps through a turn instead of snapping, and roll banks it. The shark also uses that yaw for its attack cone and part placement. [v] — NAT `client/renderer/entity/GreatWhiteSharkRenderer.java` L25; `world/entity/animal/greatwhiteshark/GreatWhiteShark.java` L98-101, L351-352, L406-412 +- Mowzie directional walk: each tick, motion is rotated into the body frame and four weights are taken as the positive parts of its dot products with forward, back, left and right. The model plays four code-driven walk cycles scaled by those weights, by the locomotion controller bone, and by a walk/run switch controller bone. [v] — MM `server/entity/MowzieGeckoEntity.java` L80-95; `client/model/entity/ModelElokosa.java` L144-160 + +### Inferences + +- Nublar's `MovementGait` caps the rate change so the phase jump stays under an error bound. The Dragon Survival offset shift removes the phase jump completely, so Nublar could follow speed changes at once. It needs access to the controller's tick offset (an accessor mixin in GeckoLib 4; check the GeckoLib 5 controller API before the port). [inf] +- An eased visual yaw plus a bank roll is a quick win for big theropods turning on the spot, before any turn clip is authored. [inf] + +### Gaps + +- No evidence of stop or skid transitions, or of foot-phase-aware gait switching, in any of the five. + +## Key question 5: Keyframe events, one-shots and layering + +### Takeaway + +GeckoLib sound keyframes are used lightly (Mowzie Sculptor). Naturalist's code-side "sound track" is a clean design that does not need GeckoLib events: a list of (time, sound, volume, pitch) cues per clip, fired when the clip time crosses a cue, with correct loop wrap. Layering is mostly separate controllers (Dragon Survival bite, breath, emotes, continuous) or code layers gated by controller bones. + +### Cited Findings + +- Mowzie Sculptor sets a sound keyframe handler on its controller that maps keyframe sound names ("make_gauntlet_effects", "make_gauntlet_piece", "clap1") to mod sounds with random pitch. [v] — MM `server/entity/sculptor/EntitySculptor.java` L768-781 +- Naturalist `AnimationSoundPlayer`: per tick on the client, for each (state, track) pair, it (1) reads the clip time; (2) treats a restart or a backwards jump as "before the first cue"; (3) for a one-shot clip fires cues with previous time less than cue time at or before now; (4) for a looping clip compares how many whole loops have passed since the cue at the previous and current times, so cues fire once per loop even across wrap. It plays a local sound, so there is no packet. Rat walk has four step cues in a 0.5 s loop; run has two in 0.625 s. [v] — NAT `world/entity/AnimationSoundPlayer.java` L1-74; `world/entity/AnimationSoundTrack.java` L1-68; `world/entity/animal/rat/Rat.java` L99-112, L512-519 +- C&C uses triggerable animations on the main controller (stag beetle hit) or on a dedicated controller that otherwise stops (leaf insect eat). [v] — CC `common/entity/StagBeetleEntity.java` L180-200; `common/entity/LeafInsectEntity.java` L188, L294-299 +- Dragon Survival "continuous" controllers play always-on clips (wind, breathing) beside the main clip. [v] — DS `common/entity/DragonEntity.java` L136-141 + +### Inferences + +- For Nublar footsteps, Naturalist's cue list keyed by clip time is better than GeckoLib sound keyframes when animation files are baked densely by an exporter: cues stay in Java, survive re-export, and can scale volume by size. GeckoLib keyframe events need the cue in the JSON. [inf] +- A dedicated always-on controller for breathing would let Nublar move `IdleSway` into a clip, or keep it in code; both are valid. [inf] + +### Gaps + +- No mod triggers screen shake from a keyframe. BOMD does shake and particles from server timed events and client status handlers, not from animation data (not read in detail). + +## Key question 6: Performance for big rigs + +### Takeaway + +Little explicit LOD in any of the five. The useful tactics are: skip evaluating a faded-out state (Naturalist, under 0.05 weight), reset a physics chain instead of simulating after a culled gap (Mowzie), keep cheap procedural state ticking off screen so it is right when the mob appears (Dragon Survival), and cache bone and part lookups (Naturalist). + +### Cited Findings + +- Naturalist caches part lookup by name and the full part array for resets. [v] — NAT `client/model/NaturalistEntityModel.java` L32-71 +- Naturalist skips any clip whose weight is at or under 0.05. [v] — NAT `client/model/NaturalistEntityModel.java` L116-123 +- Mowzie chain: snap after a gap longer than one tick; skip the physics step when paused or when the time has not changed (several render passes in one frame). [v] — MM `client/model/tools/dynamics/GeckoDynamicChain.java` L129-134, L256-258; `client/render/entity/MowzieGeoEntityRenderer.java` L48-55 +- Dragon Survival ticks its motion history for every player each client tick, on or off screen. [v] — DS `client/render/ClientDragonRenderer.java` L344-352 + +### Inferences + +- If Nublar adds a damped chain, tick it per client tick (as Naturalist and Dragon Survival do), not per frame, and snap after an off-screen gap. That keeps cost fixed per animal and avoids pops. [inf] + +### Gaps + +- No distance LOD for animation found. Bone counts of these rigs were not measured. + +## Techniques Nublar could adopt (ranked) + +| Rank | Technique | Source | Improves | Effort | +|---|---|---|---|---| +| 1 | Damped tail and neck follow from body yaw change: per-segment ease toward the parent with falling gains, plus pitch follow; added in `setCustomAnimations`, ticked per client tick, interpolated by partial tick | Naturalist `BodyChain` (MIT) | Every walk, run, turn and idle; tails stop looking rigid | S | +| 2 | Controller bones: empty bones whose keyed X value is read in code as a 0 to 1 weight for head look, sway, tail physics | Mowzie (idea only, ARR) | Roar, bite, drink, eat, rest clips can switch off head look or sway without Java | S (code) plus M (keying) | +| 3 | Phase-preserving speed change: shift the tick offset when changing animation speed | Dragon Survival (idea only) | `MovementGait` walk and run foot sync; removes the rate-change cap | S to M (needs controller accessor; recheck for GeckoLib 5) | +| 4 | Anchor one-shot clip time to the server start tick, so late-rendered animals show the right frame | Mowzie `playAnimation` (idea only) | Attack, roar, call one-shots seen when entering view | M | +| 5 | Named attack phases (wind-up, active, recovery) with damage at the active boundary, range re-check at the hit tick, optional combo jump in recovery | Mowzie sections, C&C goal (MIT), BOMD events (LGPL) | Bite and slash timing; combo attacks | M | +| 6 | Clip-time sound cues in code with loop-safe crossing | Naturalist `AnimationSoundPlayer` (MIT) | Footsteps on walk and run; bite snaps; no JSON edits | S | +| 7 | Eased visual body yaw plus bank roll in turns | Naturalist shark (MIT) | Turning in place and wide turns for large theropods and sauropods | S | +| 8 | Weight-faded idle by limb-swing amount and per-transition blend lengths | Naturalist, Dragon Survival | Stand-walk start and stop; fewer hard flips | S | +| 9 | Head look split over neck segments with clamps, world-level head option | Mowzie Umvuthi, C&C red panda (MIT) | Long necks (sauropods), grazing and drinking | S | +| 10 | Four-corner terrain sample for body pitch, roll and per-leg drop | Naturalist `TerrainLegSolver` (MIT) | Standing and walking on slopes and steps for quadrupeds | M | +| 11 | Molang handler bones driven by smoothed yaw-change and vertical-speed queries, tuned per clip | Dragon Survival (idea only; assets restricted) | Per-clip tail and neck response | L (rig and clip edits) | +| 12 | Verlet chain blended against the animated pose by a controller bone | Mowzie (idea only, ARR) | Loose tails, throat skin, feathers on death and fall | L | diff --git a/research_notes/GeckoLib creature animation survey/geckolib_animation_features_and_authoring.md b/research_notes/GeckoLib creature animation survey/geckolib_animation_features_and_authoring.md new file mode 100644 index 00000000..c416ac28 --- /dev/null +++ b/research_notes/GeckoLib creature animation survey/geckolib_animation_features_and_authoring.md @@ -0,0 +1,298 @@ +# GeckoLib animation features and the Blockbench authoring pipeline + +Research note for the GeckoLib creature animation survey. Written 2026-11-03. Scope: what GeckoLib's animation system offers, version by version (4.7.3 that Nublar ships, 4.8.4 at the head of the 1.20.1 branch, and 5.5.6 on the 26.2 branch for the port), how to add procedural motion on top of keyframes, what the Blockbench export pipeline does to keyframe density, and the known traps. AzureLib (a GeckoLib fork) is read only for features GeckoLib lacks. The render pipeline and per-bone draw cost of GeckoLib 5 are in `research_notes/Reference mod survey for Beta/client_rendering_and_animation.md` (Key question 3) and are not repeated here. Nublar's own six animation files were measured with a read-only Python script. + +Labels: **[v]** verified in source at the stated commit, with path and lines. **[inf]** inference from verified facts. **[doc]** from a wiki, README or vendor page. Code is not pasted; mechanisms are described in words. Line numbers are for the commits below. + +Repository facts: + +| Source | Branch and commit read | Version | Notes | +|---|---|---|---| +| GeckoLib 4 | `1.20.1`, `7d6f32db9168a24e14b327c0ad9f8f87dfc204de` (2026-06-20) | 4.8.4 | Nublar pins 4.7.3 (`d559cf5`, 2025-07-20) [v] gradle.properties L47. The `core/src` diff 4.7.3 to 4.8.4 adds only `RawAnimation#getStageCount`, `getStateHandler`, `LoopType#getId` and `math.pi` [v] `git diff d559cf5 7d6f32d -- core/src`. So every core finding below holds for 4.7.3. | +| GeckoLib 5 | `26.2`, `1e09655d3b54c2db959d234266fb564b90aa9382` (2026-09-16) | 5.5.6 | Same commit as the prior note. | +| GeckoLib wiki | `geckolib.wiki.git`, `1f12b23d7a40273769454e0fb77a4224b5d2af6a` (2026-10-20) | n/a | The "Geckolib4" Molang page describes the 4.5+ (1.20.6+) math system, not the 1.20.1 branch. | +| Blockbench | `JannisX11/blockbench` default branch, `ec0b2827104d0799c153bfb5f867579c0c44652f` (2026-10-18) | n/a | `js/animations`, `js/formats/bedrock`. | +| Blockbench plugins | `JannisX11/blockbench-plugins`, `4d1bfcaa45cc24ff4d7ecd3713be419dadf3c490` (2026-10-29) | GeckoLib plugin 4.2.5, Bakery 1.1.1 | `plugins/geckolib`, `plugins/bakery.js`. | +| AzureLib | `1.20` `2b4121bc7c3090cccb5b68e8a417074614eaf90c` (2026-10-30, MC 1.20.1, v3.2.4); `26.2` `cc6d1a9e30350691642a6c5dbe608dae4ce833e9` (2026-10-16) | MIT | Same `Az*` animation API on both branches. | + +Base URLs: GL4C = `https://github.com/bernie-g/geckolib/blob/7d6f32db9168a24e14b327c0ad9f8f87dfc204de/core/src/main/java/software/bernie/geckolib/core/`; GL4F = `https://github.com/bernie-g/geckolib/blob/7d6f32db9168a24e14b327c0ad9f8f87dfc204de/Fabric/src/main/java/software/bernie/geckolib/`; GL5 = `https://github.com/bernie-g/geckolib/blob/1e09655d3b54c2db959d234266fb564b90aa9382/common/src/main/java/com/geckolib/`; BB = `https://github.com/JannisX11/blockbench/blob/ec0b2827104d0799c153bfb5f867579c0c44652f/js/`; BBP = `https://github.com/JannisX11/blockbench-plugins/blob/4d1bfcaa45cc24ff4d7ecd3713be419dadf3c490/plugins/`; AZ = `https://github.com/AzureDoom/AzureLib/blob/cc6d1a9e30350691642a6c5dbe608dae4ce833e9/common/src/main/java/mod/azure/azurelib/animation/`. Nublar paths are relative to the repository root. Nublar animation files are `common/src/main/resources/assets/projectnublar/animations/entity/*.animation.json` (written NAF below). + +## Key question 1: Every animation feature, 4.x vs 5.x + +### Takeaway + +Both versions have the same authoring vocabulary: three loop types, `RawAnimation` chains (play, loop, wait, hold, play N times), server-triggered animations, sound, particle and custom-instruction keyframe markers, a per-controller transition length, a per-controller speed, an easing override and 30+ easings with catmull-rom. The engines under them differ a lot. GeckoLib 4 scans every keyframe list from the start on every frame, plays time as speed times elapsed time, lets the last controller overwrite each keyed transform, has no additive mode, and knows 15 Molang queries. GeckoLib 5 walks keyframe indices forward incrementally, integrates speed per frame, adds `additiveAnimations()`, inserts transition stages between chain steps and a reset stage at the end, and knows about 80 queries computed only when an animation uses them. Neither version plays `bezier` easing, blend weights, `anim_time_update`, `blend_weight` or bone masks; AzureLib does weights, masks and bezier. + +### Cited Findings + +**Loop types** + +- 4.x registers `play_once` (and `false`), `hold_on_last_frame`, `loop` (and `true`), plus a `DEFAULT` that defers to the file's loop value; unknown names fall back to play once. Hold works by setting the controller state to PAUSED and returning "play again". [v] [GL4C animation/Animation.java L39-46, L64-98](https://github.com/bernie-g/geckolib/blob/7d6f32db9168a24e14b327c0ad9f8f87dfc204de/core/src/main/java/software/bernie/geckolib/core/animation/Animation.java#L39-L98) +- 5.x keeps the same names. Hold now pins the timeline time to the stage end; loop subtracts the stage length so overshoot carries into the next cycle (no lost fraction of a frame at the seam). [v] [GL5 animation/object/LoopType.java L20-33](https://github.com/bernie-g/geckolib/blob/1e09655d3b54c2db959d234266fb564b90aa9382/common/src/main/java/com/geckolib/animation/object/LoopType.java#L20-L33) +- 4.x `hasAnimationFinished` is true only in the STOPPED state, so a held animation (PAUSED) never reports finished. 5.x reports finished once the point reaches the animation length and the timeline is at its last end. [v] [GL4C AnimationController L315-317](https://github.com/bernie-g/geckolib/blob/7d6f32db9168a24e14b327c0ad9f8f87dfc204de/core/src/main/java/software/bernie/geckolib/core/animation/AnimationController.java#L315-L317); [GL5 AnimationController L156-164](https://github.com/bernie-g/geckolib/blob/1e09655d3b54c2db959d234266fb564b90aa9382/common/src/main/java/com/geckolib/animation/AnimationController.java#L156-L164) + +**RawAnimation chaining** + +- Both versions offer `begin`, `thenPlay`, `thenLoop`, `thenWait(ticks)`, `thenPlayAndHold`, `thenPlayXTimes`, `then(name, loopType)` and `copyOf`. Equality compares the stage list, so two separately built but identical chains count as "the same animation". [v] [GL4C RawAnimation L42-118](https://github.com/bernie-g/geckolib/blob/7d6f32db9168a24e14b327c0ad9f8f87dfc204de/core/src/main/java/software/bernie/geckolib/core/animation/RawAnimation.java#L42-L118); [GL5 RawAnimation L42-138](https://github.com/bernie-g/geckolib/blob/1e09655d3b54c2db959d234266fb564b90aa9382/common/src/main/java/com/geckolib/animation/RawAnimation.java#L42-L138) +- 4.x builds a queue of stages; if any stage name is missing it prints "Unable to find animation" to stdout and drops the whole chain. [v] [GL4C AnimationProcessor L34-59](https://github.com/bernie-g/geckolib/blob/7d6f32db9168a24e14b327c0ad9f8f87dfc204de/core/src/main/java/software/bernie/geckolib/core/animation/AnimationProcessor.java#L34-L59) +- 5.x builds an `AnimationTimeline` of stages with absolute start and end times; a missing stage is skipped silently; with a transition length above zero it inserts a transition stage before every animation stage and one reset stage at the end. [v] [GL5 animation/state/AnimationTimeline.java L189-216](https://github.com/bernie-g/geckolib/blob/1e09655d3b54c2db959d234266fb564b90aa9382/common/src/main/java/com/geckolib/animation/state/AnimationTimeline.java#L189-L216) + +**Triggerable animations** + +- Registration: `triggerableAnim(name, raw)` on the controller; by default a triggered animation suppresses the state handler while it plays; `receiveTriggeredAnimations()` keeps the handler running. [v] [GL4C AnimationController L199-216, L414-429](https://github.com/bernie-g/geckolib/blob/7d6f32db9168a24e14b327c0ad9f8f87dfc204de/core/src/main/java/software/bernie/geckolib/core/animation/AnimationController.java#L414-L429); [GL5 AnimationController L253-270, L445-446](https://github.com/bernie-g/geckolib/blob/1e09655d3b54c2db959d234266fb564b90aa9382/common/src/main/java/com/geckolib/animation/AnimationController.java#L445-L446) +- Server call `triggerAnim(controller, anim)` sends one packet to players tracking the entity and to itself; client call triggers locally. The 4.x packet is a VarInt entity id, a boolean, and two UTF strings (controller and animation name), so about 20-40 bytes per trigger. With a null controller name the manager tries each controller and stops at the first that knows the name. [v] [GL4F animatable/GeoEntity.java L58-67](https://github.com/bernie-g/geckolib/blob/7d6f32db9168a24e14b327c0ad9f8f87dfc204de/Fabric/src/main/java/software/bernie/geckolib/animatable/GeoEntity.java#L58-L67); [GL4F network/packet/EntityAnimTriggerPacket.java L44-51](https://github.com/bernie-g/geckolib/blob/7d6f32db9168a24e14b327c0ad9f8f87dfc204de/Fabric/src/main/java/software/bernie/geckolib/network/packet/EntityAnimTriggerPacket.java#L44-L51); [GL4C AnimatableManager L121-138](https://github.com/bernie-g/geckolib/blob/7d6f32db9168a24e14b327c0ad9f8f87dfc204de/core/src/main/java/software/bernie/geckolib/core/animation/AnimatableManager.java#L121-L138) +- 5.x records the client tick of the trigger and, when the timeline starts, starts at the elapsed offset and fires markers it skipped, so a late frame catches up. 4.x has no catch-up. [v] [GL5 AnimationController L298-311, L471-489](https://github.com/bernie-g/geckolib/blob/1e09655d3b54c2db959d234266fb564b90aa9382/common/src/main/java/com/geckolib/animation/AnimationController.java#L471-L489) +- The wiki recommends triggering only non-looping animations. [doc] glwiki `Triggerable-Animations-(Geckolib4).md` + +**Keyframe events (sound, particle, custom instruction)** + +- 4.x: three handler setters; markers fire when `adjustedTick + transitionLength` passes the marker time, each once per play (a set of fired markers, cleared on loop). With no handler, 4.x prints "... Keyframe found ... but no keyframe handler registered" to stdout and stops checking that list for the frame. [v] [GL4C AnimationController L620-656](https://github.com/bernie-g/geckolib/blob/7d6f32db9168a24e14b327c0ad9f8f87dfc204de/core/src/main/java/software/bernie/geckolib/core/animation/AnimationController.java#L620-L656) +- 5.x: one `KeyframeEventHandler` type for all three; markers fire for the exact interval crossed since the last frame (forwards or backwards, across loop seams); missing handlers give one WARN when the animation loads, not per frame. [v] [GL5 AnimationTimeline L110-186](https://github.com/bernie-g/geckolib/blob/1e09655d3b54c2db959d234266fb564b90aa9382/common/src/main/java/com/geckolib/animation/state/AnimationTimeline.java#L110-L186); [GL5 AnimationController L567-587](https://github.com/bernie-g/geckolib/blob/1e09655d3b54c2db959d234266fb564b90aa9382/common/src/main/java/com/geckolib/animation/AnimationController.java#L567-L587) +- 5.x ships `AutoPlayingSoundKeyframeHandler`: the marker text is `sound_id|volume|pitch`, played at the entity position, NEUTRAL or HOSTILE source. 4.8.4 has no such class. [v] [GL5 animation/keyframehandler/AutoPlayingSoundKeyframeHandler.java L30-57](https://github.com/bernie-g/geckolib/blob/1e09655d3b54c2db959d234266fb564b90aa9382/common/src/main/java/com/geckolib/animation/keyframehandler/AutoPlayingSoundKeyframeHandler.java#L30-L57) +- Nublar: Brachiosaurus `move.walk` and `run` carry four `sound_effects` markers each (effect `walk2`), `eatingtall2` one; no Nublar controller sets a handler [v] NAF brachiosaurus; `grep KeyframeHandler common/src/main/java` finds nothing. + +**Transition length** + +- 4.x: on a new animation the controller enters TRANSITIONING; for `transitionLength` ticks of (speed-scaled) time each keyed bone lerps from the saved snapshot of its current pose to the new animation's value at time 0; then the animation starts from 0. The transition also runs between chain stages. [v] [GL4C AnimationController L442-543](https://github.com/bernie-g/geckolib/blob/7d6f32db9168a24e14b327c0ad9f8f87dfc204de/core/src/main/java/software/bernie/geckolib/core/animation/AnimationController.java#L442-L543), [L551-579](https://github.com/bernie-g/geckolib/blob/7d6f32db9168a24e14b327c0ad9f8f87dfc204de/core/src/main/java/software/bernie/geckolib/core/animation/AnimationController.java#L551-L579) +- 4.x: bones that no controller keyed this frame ease back to the model pose over `getBoneResetTime()` ticks, default 5, independent of any controller's transition. [v] [GL4C AnimationProcessor L131-209](https://github.com/bernie-g/geckolib/blob/7d6f32db9168a24e14b327c0ad9f8f87dfc204de/core/src/main/java/software/bernie/geckolib/core/animation/AnimationProcessor.java#L131-L209); [GL4C animatable/GeoAnimatable.java L47-49](https://github.com/bernie-g/geckolib/blob/7d6f32db9168a24e14b327c0ad9f8f87dfc204de/core/src/main/java/software/bernie/geckolib/core/animatable/GeoAnimatable.java#L47-L49) +- 5.x: a transition blends from the previous animation point (evaluated live, rotation wrapped to ±180°) to the new animation's first keyframe value; bones the old animation keyed but the new one does not are blended to the rest pose; the trailing reset stage blends the last animation to rest. The easing of a transition is the target keyframe's easing, or the override. [v] [GL5 AnimationProcessor L76-116, L191-235](https://github.com/bernie-g/geckolib/blob/1e09655d3b54c2db959d234266fb564b90aa9382/common/src/main/java/com/geckolib/animation/AnimationProcessor.java#L76-L235) + +**Animation speed** + +- 4.x: `setAnimationSpeedHandler(Function)`, and `setAnimationSpeed(d)` wraps a constant in a new lambda. Time is computed as speed times (now minus start), so changing the speed mid-cycle jumps the playhead. [v] [GL4C AnimationController L154-168, L700-710](https://github.com/bernie-g/geckolib/blob/7d6f32db9168a24e14b327c0ad9f8f87dfc204de/core/src/main/java/software/bernie/geckolib/core/animation/AnimationController.java#L700-L710) +- 5.x: the handler is gone. `setAnimationSpeed(double)` or `AnimationTest#setControllerSpeed(float)` store a number; each frame adds (age delta / 20) times the previous speed, so speed changes are smooth. [v] [GL5 AnimationController L211-215, L431-443](https://github.com/bernie-g/geckolib/blob/1e09655d3b54c2db959d234266fb564b90aa9382/common/src/main/java/com/geckolib/animation/AnimationController.java#L431-L443); [GL5 AnimationTest L75-77](https://github.com/bernie-g/geckolib/blob/1e09655d3b54c2db959d234266fb564b90aa9382/common/src/main/java/com/geckolib/animation/state/AnimationTest.java#L75-L77) +- 5.x adds `setAnimationTime(seconds)` (seek inside the current animation) and `setTimelineTime`. 4.x has no public seek. [v] [GL5 AnimationController L316-338](https://github.com/bernie-g/geckolib/blob/1e09655d3b54c2db959d234266fb564b90aa9382/common/src/main/java/com/geckolib/animation/AnimationController.java#L316-L338) +- Nublar already limits speed changes to keep the 4.x playhead jump small [v] `common/src/main/java/net/dumbcode/projectnublar/entity/dinosaur/animation/MovementGait.java` L19-30, L112-117. + +**Multiple controllers and additive** + +- Controllers run in registration order (fastutil `Object2ObjectArrayMap`) in both versions. [v] [GL4C AnimatableManager L191-196](https://github.com/bernie-g/geckolib/blob/7d6f32db9168a24e14b327c0ad9f8f87dfc204de/core/src/main/java/software/bernie/geckolib/core/animation/AnimatableManager.java#L191-L196); [GL5 animatable/manager/AnimatableManager.java L156-157](https://github.com/bernie-g/geckolib/blob/1e09655d3b54c2db959d234266fb564b90aa9382/common/src/main/java/com/geckolib/animatable/manager/AnimatableManager.java#L156-L157); the wiki says later controllers override earlier ones [doc] glwiki `The-Animation-Controller-(Geckolib4).md` L41-43. +- 4.x: per bone, per transform (rotation, position, scale): if the controller's animation has keyframes for that transform it writes the value; otherwise it leaves it. So the last controller with keys for that transform wins. There is no additive mode in 4.x core (no match for "additive"). [v] [GL4C AnimationController L584-618](https://github.com/bernie-g/geckolib/blob/7d6f32db9168a24e14b327c0ad9f8f87dfc204de/core/src/main/java/software/bernie/geckolib/core/animation/AnimationController.java#L584-L618); [GL4C AnimationProcessor L101-126](https://github.com/bernie-g/geckolib/blob/7d6f32db9168a24e14b327c0ad9f8f87dfc204de/core/src/main/java/software/bernie/geckolib/core/animation/AnimationProcessor.java#L101-L126) +- 5.x: for each bone the animation lists, it writes all three transforms; a transform with no keyframes gets its default (0 or 1). So the last controller that lists the bone wins for every transform of that bone, not per transform. [v] [GL5 AnimationProcessor L84-96, L165-177](https://github.com/bernie-g/geckolib/blob/1e09655d3b54c2db959d234266fb564b90aa9382/common/src/main/java/com/geckolib/animation/AnimationProcessor.java#L165-L177); [GL5 AnimationPoint L85-91](https://github.com/bernie-g/geckolib/blob/1e09655d3b54c2db959d234266fb564b90aa9382/common/src/main/java/com/geckolib/animation/state/AnimationPoint.java#L85-L91) +- 5.x `additiveAnimations()`: scale multiplies the current snapshot; translation adds; rotation adds the current snapshot rotation minus the bone's base rotation. [v] [GL5 AnimationProcessor L118-162](https://github.com/bernie-g/geckolib/blob/1e09655d3b54c2db959d234266fb564b90aa9382/common/src/main/java/com/geckolib/animation/AnimationProcessor.java#L133-L147) +- 5.x snapshot rotation is a delta added to the base rotation when the matrix is built (snapshots start at 0). [v] [GL5 util/RenderUtil.java L66-80](https://github.com/bernie-g/geckolib/blob/1e09655d3b54c2db959d234266fb564b90aa9382/common/src/main/java/com/geckolib/util/RenderUtil.java#L66-L80) +- Nublar registers three controllers in order `movement`, `dino_controller`, `dino_secondary_Controller` (the last always STOP). [v] `common/src/main/java/net/dumbcode/projectnublar/entity/dinosaur/Dinosaur.java` L218-229 + +**Bone snapshots** + +- 4.x: one `BoneSnapshot` per bone per entity (in the manager), holding last value and reset timers; snapshots are copied at the start of each transition to blend from. Bones themselves are shared per model and mutated in place. [v] [GL4C AnimationProcessor L240-247](https://github.com/bernie-g/geckolib/blob/7d6f32db9168a24e14b327c0ad9f8f87dfc204de/core/src/main/java/software/bernie/geckolib/core/animation/AnimationProcessor.java#L240-L247); [GL4C AnimationController L680-692](https://github.com/bernie-g/geckolib/blob/7d6f32db9168a24e14b327c0ad9f8f87dfc204de/core/src/main/java/software/bernie/geckolib/core/animation/AnimationController.java#L680-L692) +- 5.x: a fresh snapshot per touched bone per render pass, built by the updater list, cleared after drawing (details in the prior note). [v] [GL5 renderer/base/RenderPassInfo.java L279-310](https://github.com/bernie-g/geckolib/blob/1e09655d3b54c2db959d234266fb564b90aa9382/common/src/main/java/com/geckolib/renderer/base/RenderPassInfo.java#L279-L310) + +**Molang** + +- 4.x (1.20.1 branch) has one global `MolangParser` with 15 built-in queries: `query.anim_time`, `life_time`, `controller_speed`, `actor_count`, `time_of_day`, `moon_phase`, `distance_from_camera`, `is_on_ground`, `is_in_water`, `is_in_water_or_rain`, `health`, `max_health`, `is_on_fire`, `ground_speed`, `yaw_speed`. They are set as memoized suppliers per frame. [v] [GL4C molang/MolangQueries.java L1-23](https://github.com/bernie-g/geckolib/blob/7d6f32db9168a24e14b327c0ad9f8f87dfc204de/core/src/main/java/software/bernie/geckolib/core/molang/MolangQueries.java); [GL4F model/GeoModel.java L224-252](https://github.com/bernie-g/geckolib/blob/7d6f32db9168a24e14b327c0ad9f8f87dfc204de/Fabric/src/main/java/software/bernie/geckolib/model/GeoModel.java#L224-L252) +- 4.x values: `anim_time` = controller time in seconds, set per controller; `life_time` = the model's running clock in seconds; `ground_speed` = horizontal length of `getDeltaMovement()` (blocks per tick); `yaw_speed` = yRot minus yRotO. [v] [GL4C AnimationController L499, L582](https://github.com/bernie-g/geckolib/blob/7d6f32db9168a24e14b327c0ad9f8f87dfc204de/core/src/main/java/software/bernie/geckolib/core/animation/AnimationController.java#L582); [GL4F GeoModel L229-249](https://github.com/bernie-g/geckolib/blob/7d6f32db9168a24e14b327c0ad9f8f87dfc204de/Fabric/src/main/java/software/bernie/geckolib/model/GeoModel.java#L229-L249) +- 4.x custom variables: `MolangParser.INSTANCE.register(...)`, then `setValue` or `setMemoizedValue` each frame (for example from an overridden `applyMolangQueries`). An unknown name silently becomes a new variable worth 0. Sine and cosine take degrees. Assignment with `=` and `;` compound statements work; variables are global across all animatables. [v] [GL4C molang/MolangParser.java L26, L41-91, L97-150, L191-249](https://github.com/bernie-g/geckolib/blob/7d6f32db9168a24e14b327c0ad9f8f87dfc204de/core/src/main/java/software/bernie/geckolib/core/molang/MolangParser.java#L97-L150) +- 4.7.3 does not know `math.pi` (added in 4.8.3). [v] gl4 `git show d789c27:changelog.txt`; Nublar files use only `math.sin` and `math.cos` [v] NAF grep. +- 5.x: about 80 `query.*` actor variables (adds `limb_swing`, `limb_swing_amount`, `head_x_rotation`, `head_y_rotation`, `vertical_speed`, `is_moving`, `death_ticks`, `hurt_time`, `scale`, `frame_alpha`, `movement_direction`, and more); custom ones via `MolangQueries.setActorVariable(name, actor -> value)`, global ones via `setVariableValue` / `setVariableFunction`, functions via `MathParser.registerFunction`; values are computed only when the playing animation uses them. `life_time` is now time since the manager's first render, `anim_time` comes from the animation point. [v] [GL5 loading/math/MolangQueries.java L35-116, L171-219, L234-346](https://github.com/bernie-g/geckolib/blob/1e09655d3b54c2db959d234266fb564b90aa9382/common/src/main/java/com/geckolib/loading/math/MolangQueries.java#L234-L346); [GL5 loading/math/MathParser.java L51-122](https://github.com/bernie-g/geckolib/blob/1e09655d3b54c2db959d234266fb564b90aa9382/common/src/main/java/com/geckolib/loading/math/MathParser.java#L51-L122) +- Neither branch maps the Bedrock short prefixes `q.` / `v.` to `query.` / `variable.` (no match in either parser). [v] grep of both parsers. +- Nublar uses Molang in 261 keyframes: `query.anim_time` (727 references) and `query.life_time` (48). [v] NAF grep. + +**Easings and how they evaluate** + +- Both versions: `linear`, `step` (argument = step count, at least 2), and in/out/in-out of sine, quad, cubic, quart, quint, expo, circ, back, elastic, bounce, plus `catmullrom`. Unknown names, including `bezier`, fall back to linear. [v] [GL4C animation/EasingType.java L28-60, L125-127](https://github.com/bernie-g/geckolib/blob/7d6f32db9168a24e14b327c0ad9f8f87dfc204de/core/src/main/java/software/bernie/geckolib/core/animation/EasingType.java#L28-L60); [GL5 animation/object/EasingType.java L28-60, L108-110](https://github.com/bernie-g/geckolib/blob/1e09655d3b54c2db959d234266fb564b90aa9382/common/src/main/java/com/geckolib/animation/object/EasingType.java#L28-L110) +- A keyframe's easing shapes the segment that ends at that keyframe (from the previous key to this key), in both versions. Only the first easing argument is read. [v] [GL4F loading/json/typeadapter/BakedAnimationsAdapter.java L189-218](https://github.com/bernie-g/geckolib/blob/7d6f32db9168a24e14b327c0ad9f8f87dfc204de/Fabric/src/main/java/software/bernie/geckolib/loading/json/typeadapter/BakedAnimationsAdapter.java#L189-L218); [GL5 AnimationProcessor L179-187](https://github.com/bernie-g/geckolib/blob/1e09655d3b54c2db959d234266fb564b90aa9382/common/src/main/java/com/geckolib/animation/AnimationProcessor.java#L179-L187) +- 4.x bug: `easeinquint` uses power 4, not 5. Fixed in 5.x. [v] GL4C EasingType L42 vs GL5 EasingType L42. +- 4.x builds a new easing function object on every evaluation of a non-linear segment; 5.x allocates an `EasingState` per evaluation. [v] GL4C EasingType L82-87; GL5 AnimationProcessor L187. +- A channel with a single keyframe is forced to linear (4.x drops its easing, 5.x passes `forceLinearInterpolation`). [v] GL4F BakedAnimationsAdapter L223-232; [GL5 loading/definition/animation/ActorBoneAnimationEntry.java L150](https://github.com/bernie-g/geckolib/blob/1e09655d3b54c2db959d234266fb564b90aa9382/common/src/main/java/com/geckolib/loading/definition/animation/ActorBoneAnimationEntry.java#L150) + +**Catmull-rom** + +- Formula: uniform catmull-rom over (p0, p1, p2, p3), equal to vanilla `Mth.catmullrom`. [v] [GL4C EasingType L388-424](https://github.com/bernie-g/geckolib/blob/7d6f32db9168a24e14b327c0ad9f8f87dfc204de/core/src/main/java/software/bernie/geckolib/core/animation/EasingType.java#L388-L424) +- 4.x picks p0 as the end value of the previous keyframe, which is the segment's own start value (p1). So the incoming tangent is wrong at every catmull key. [v] [GL4F BakedAnimationsAdapter L223-246](https://github.com/bernie-g/geckolib/blob/7d6f32db9168a24e14b327c0ad9f8f87dfc204de/Fabric/src/main/java/software/bernie/geckolib/loading/json/typeadapter/BakedAnimationsAdapter.java#L223-L246) +- 5.x picks p0 from two keys back, which is correct; 5.5.6 also fixed ignored start/end of catmull and easings on pre/post keys. [v] [GL5 EasingType L351-358](https://github.com/bernie-g/geckolib/blob/1e09655d3b54c2db959d234266fb564b90aa9382/common/src/main/java/com/geckolib/animation/object/EasingType.java#L351-L358); [GL5 changelog.md L1-7](https://github.com/bernie-g/geckolib/blob/1e09655d3b54c2db959d234266fb564b90aa9382/changelog.md) +- Blockbench previews catmull on a segment if either end key is catmull, and wraps p0 and p3 around the loop for looping animations with 3+ keys. GeckoLib uses only the end key's easing and clamps at the ends. [v] [BB animations/timeline_animators.js L544-556](https://github.com/JannisX11/blockbench/blob/ec0b2827104d0799c153bfb5f867579c0c44652f/js/animations/timeline_animators.js#L544-L556) +- A catmull key exported by Blockbench writes a `pre` value too when the previous key is not catmull; GeckoLib turns `pre` into an extra key 0.001 s (4.x) or one float epsilon (5.x) before. [v] [BB animations/keyframe.js L356-363](https://github.com/JannisX11/blockbench/blob/ec0b2827104d0799c153bfb5f867579c0c44652f/js/animations/keyframe.js#L356-L363); GL4F BakedAnimationsAdapter L145-174; [GL5 ActorBoneAnimationKeyframe.java L79-98](https://github.com/bernie-g/geckolib/blob/1e09655d3b54c2db959d234266fb564b90aa9382/common/src/main/java/com/geckolib/loading/definition/animation/ActorBoneAnimationKeyframe.java#L79-L98) + +**Bedrock fields GeckoLib ignores** + +- 5.x parses `start_delay`, `loop_delay`, `anim_time_update`, `blend_weight` and `override_previous_animation` but `bake` uses only length, loop, bones and markers. 4.x does not read them. [v] [GL5 loading/definition/animation/ActorAnimation.java L42-75](https://github.com/bernie-g/geckolib/blob/1e09655d3b54c2db959d234266fb564b90aa9382/common/src/main/java/com/geckolib/loading/definition/animation/ActorAnimation.java#L42-L75) +- Bedrock uses `anim_time_update` to drive a walk cycle from distance moved (vanilla quadruped walk uses `query.modified_distance_moved`). [doc] [Microsoft Learn, Animations Overview](https://learn.microsoft.com/en-us/minecraft/creator/reference/content/animationsreference/examples/animationgettingstarted?view=minecraft-bedrock-stable) + +**AzureLib (features GeckoLib lacks)** + +- Per-controller blend weight with a timed fade, blend modes OVERRIDE and ADDITIVE scaled by weight, and bone masks (`only` / `except` a bone subtree, skipped bones are not evaluated). Same classes on the 1.20 (1.20.1) and 26.2 branches. [v] [AZ controller/AzBoneMask.java L1-40](https://github.com/AzureDoom/AzureLib/blob/cc6d1a9e30350691642a6c5dbe608dae4ce833e9/common/src/main/java/mod/azure/azurelib/animation/controller/AzBoneMask.java); [AZ AzBoneAnimationUpdateUtil.java L16-21, L49-67](https://github.com/AzureDoom/AzureLib/blob/cc6d1a9e30350691642a6c5dbe608dae4ce833e9/common/src/main/java/mod/azure/azurelib/animation/AzBoneAnimationUpdateUtil.java); [AZ controller/AzWeightFade.java](https://github.com/AzureDoom/AzureLib/blob/cc6d1a9e30350691642a6c5dbe608dae4ce833e9/common/src/main/java/mod/azure/azurelib/animation/controller/AzWeightFade.java) +- A `bezier` easing (Blockbench handles), reverse playback, freeze tick, repeat count, start-tick offset, and a weighted-random pool play behaviour. [v] AZ `easing/AzEasingTypes.java` L189-208; `dispatch/command/action/impl/controller/*` (SetReverse, SetFreezeTick, SetRepeatTimes, SetStartTickOffset, SetWeight); `play_behavior/AzWeightedPoolBehavior.java` +- Keyframe lookup: walks at most 4 keys from a cached index, else binary search, no allocation. [v] [AZ controller/keyframe/AzKeyframeChannel.java L16, L33-36, L184](https://github.com/AzureDoom/AzureLib/blob/cc6d1a9e30350691642a6c5dbe608dae4ce833e9/common/src/main/java/mod/azure/azurelib/animation/controller/keyframe/AzKeyframeChannel.java) + +### Inferences + +- [inf] 4.x per-transform "last writer wins" lets a movement controller own the legs while the main controller owns the neck, as long as the main animation has no keys at all on leg transforms. In 5.x a bone listed with only rotation keys also resets that bone's position and scale, so splitting by bone matters more. +- [inf] In 5.x the additive rotation subtracts the base rotation once. Nublar bones mostly have a base rotation (Tyrannosaurus 81 of 91, Velociraptor 103 of 112 [v] geo files). If this reading is right, an additive controller would offset those bones by minus their rest angle. Test with one rotated bone before relying on additive. +- [inf] Brachiosaurus walk and run will print a stdout line per sound marker per cycle per walking animal on 4.x, until a sound handler is set. +- [inf] A `bezier` key exported by the GeckoLib plugin (default setting) plays as linear in game on both versions (see Key question 3). + +### Gaps + +- The GeckoLib 5 wiki pages (wiki.geckolib.com) were not re-read; claims are from source. +- Trigger packet size for 5.x was not measured. +- The 5.x additive base-rotation behaviour was read, not run. + +## Key question 2: Procedural bone deltas and head look + +### Takeaway + +In 4.x, write procedural motion in `GeoModel#setCustomAnimations`, which runs once per entity per frame right after the controllers. Bones are shared by every entity of that model, so always write absolute values from this frame's inputs and never read last frame's value as state. In 5.x, write it in the renderer's `adjustModelBonesForRender(renderPassInfo, snapshots)`: it runs after the controllers on a fresh per-pass snapshot, so adding to the snapshot is safe. GeckoLib's own head look is a two-line overwrite of the head bone's pitch and yaw with no clamp, no smoothing, no neck chain and no blend with the animation. Build Nublar's own look-at on top instead. + +### Cited Findings + +- 4.x order per frame: `handleAnimations` updates the model clock, sets Molang, runs `tickAnimation` (all controllers, then the reset of untouched bones), then calls `setCustomAnimations`. It skips the whole call for a re-render of the same instance at the same time. [v] [GL4F model/GeoModel.java L186-222](https://github.com/bernie-g/geckolib/blob/7d6f32db9168a24e14b327c0ad9f8f87dfc204de/Fabric/src/main/java/software/bernie/geckolib/model/GeoModel.java#L186-L222) +- 4.x calls it from `GeoEntityRenderer#actuallyRender` only when not a re-render, after building `AnimationState` with limb swing, head pitch and net head yaw. [v] [GL4F renderer/GeoEntityRenderer.java L212-226](https://github.com/bernie-g/geckolib/blob/7d6f32db9168a24e14b327c0ad9f8f87dfc204de/Fabric/src/main/java/software/bernie/geckolib/renderer/GeoEntityRenderer.java#L212-L226) +- 4.x bones carry "changed" flags; a bone with no changed flag is eased back to rest by the processor; the flags are cleared after `tickAnimation`, before `setCustomAnimations`. [v] [GL4C AnimationProcessor L133-211](https://github.com/bernie-g/geckolib/blob/7d6f32db9168a24e14b327c0ad9f8f87dfc204de/core/src/main/java/software/bernie/geckolib/core/animation/AnimationProcessor.java#L133-L211) +- Nublar's `DinosaurGeoModel#setCustomAnimations` adds its breathing sway to the current bone value and clears the flags; the comment explains why this does not accumulate. [v] `common/src/main/java/net/dumbcode/projectnublar/client/model/DinosaurGeoModel.java` L34-66 +- 4.x head look (`DefaultedEntityGeoModel`): sets head rotX to pitch and rotY to net head yaw, in radians, replacing whatever the animation wrote. In 4.7.3 the bone must be named `head` (a boolean flag); 4.7.4 made the bone name configurable. Nublar does not enable it. [v] [GL4F model/DefaultedEntityGeoModel.java L42-67](https://github.com/bernie-g/geckolib/blob/7d6f32db9168a24e14b327c0ad9f8f87dfc204de/Fabric/src/main/java/software/bernie/geckolib/model/DefaultedEntityGeoModel.java#L42-L67); gl4 `git show 4a8e7c5:changelog.txt`; `common/src/main/java/net/dumbcode/projectnublar/client/ClientRegistrationHolder.java` L45-49 +- 5.x head look: `DefaultAnimations.hardcodedHeadRotation(renderPassInfo, snapshots, boneName)` sets the snapshot's rotX and rotY from `ENTITY_PITCH` and `ENTITY_YAW`, to be called from `adjustModelBonesForRender`. Its comment suggests an animation with `math.to_rad(-query.head_x_rotation)` and `math.to_rad(-query.head_y_rotation)` instead. [v] [GL5 constant/DefaultAnimations.java L206-224](https://github.com/bernie-g/geckolib/blob/1e09655d3b54c2db959d234266fb564b90aa9382/common/src/main/java/com/geckolib/constant/DefaultAnimations.java#L206-L224) +- 5.x updater order: controllers, then `adjustModelBonesForRender`, then any added updater (from layers or callers). [v] [GL5 RenderPassInfo L279-310](https://github.com/bernie-g/geckolib/blob/1e09655d3b54c2db959d234266fb564b90aa9382/common/src/main/java/com/geckolib/renderer/base/RenderPassInfo.java#L279-L310); [GL5 renderer/base/GeoRenderer.java L165](https://github.com/bernie-g/geckolib/blob/1e09655d3b54c2db959d234266fb564b90aa9382/common/src/main/java/com/geckolib/renderer/base/GeoRenderer.java#L165) +- 5.x snapshot values are deltas from the bone's base rotation, translation 0 and scale 1. [v] [GL5 animation/state/BoneSnapshot.java L16-26](https://github.com/bernie-g/geckolib/blob/1e09655d3b54c2db959d234266fb564b90aa9382/common/src/main/java/com/geckolib/animation/state/BoneSnapshot.java#L16-L26); GL5 RenderUtil L66-80 +- 5.x moves per-frame data into the render state at extraction; the updater sees only the render state, not the live entity. [v] prior note, Key question 3, steps 1-2. +- The GeckoLib 4 example entity splits a body across controllers named Body, Left Hand, Right Hand and Dual Wield, each animating its own bones. [v] [GL4F ../../example/entity/DynamicExampleEntity.java L59-68](https://github.com/bernie-g/geckolib/blob/7d6f32db9168a24e14b327c0ad9f8f87dfc204de/Fabric/src/main/java/software/bernie/example/entity/DynamicExampleEntity.java#L59-L68) + +### Inferences + +- [inf] Rule for 4.x deltas: read the value the controllers just wrote this frame, add your delta, write it, then clear the changed flags only if the bone was already flagged by a controller. If no controller animates the bone, write an absolute value; the reset path would otherwise ease it back next frame. +- [inf] Rule for 5.x deltas: add to the snapshot inside `adjustModelBonesForRender`. Copy what you need (look target, tail velocity, ground normal) into the render state in `addRenderData` or `fillRenderState`, because the updater must not read the entity. +- [inf] Better head look than the built-in: clamp yaw and pitch per species, spread the angle over neck bones (for example 20/30/50% from the base of the neck to the head), smooth it with a critically damped spring on the client tick, and fade it out when an action animation (roar, eat, attack) owns the neck. A per-animation flag or a Molang variable read in the updater can say "neck is owned". +- [inf] Doing head look in Molang (5.x query) puts it inside the animation and lets transitions blend it. But a `query.head_y_rotation` keyframe only applies while that animation plays, and two controllers listing the neck still fight. A delta in the updater is easier to layer. +- [inf] Procedural tail lag, footstep IK and ground-slope tilt all fit the same updater slot. The CHAOS IK audit note is the place for IK detail. + +### Gaps + +- No measurement of the cost of `setCustomAnimations` work per bone. +- The 5.x `addRenderData` path for custom per-entity fields was not traced in detail here. + +## Key question 3: Authoring and performance of densely baked keyframes + +### Takeaway + +Nublar's files are not dense everywhere. They mix sparse hand keys (catmull-rom, about 2 keys per second per channel) with baked channels at 24-25 samples per second, typical of Blockbench IK baking, bezier baking or the Bakery plugin. 110,620 keyframes sit in 8,925 channels. 64% of channels are constant and 58% are exactly the rest pose: 1,432 of 4,545 bone entries animate nothing. A tolerance-based reduction that keeps the curve within 0.1° and 0.01 units removes about 40% of keys; within 0.5° and 0.05 units, about 60%. Removing rest-pose channels is exact and also stops them from masking other controllers. 178 keys hold rotation values of 10^7 to 10^10 degrees, almost certainly corrupt. On 4.x the per-frame cost grows with keyframe count, because every axis is scanned from its first key every frame, and held poses scan the whole list. On 5.x the per-frame cost is nearly independent of density; density then costs only memory and load time. + +### Cited Findings + +**How GeckoLib finds the current keyframe** + +- 4.x: for every animated bone, every transform and every axis, every frame, it walks the keyframe list from index 0, summing lengths until it passes the current time. Past the end it returns the last key after walking the full list. Each lookup allocates an `AnimationPoint`. [v] [GL4C AnimationController L715-759](https://github.com/bernie-g/geckolib/blob/7d6f32db9168a24e14b327c0ad9f8f87dfc204de/core/src/main/java/software/bernie/geckolib/core/animation/AnimationController.java#L715-L759) +- 4.x: every frame, each controller also rebuilds a `BoneAnimationQueue` (one record plus nine `LinkedList`s) for every bone in the model, animated or not. [v] [GL4C AnimationController L666-672](https://github.com/bernie-g/geckolib/blob/7d6f32db9168a24e14b327c0ad9f8f87dfc204de/core/src/main/java/software/bernie/geckolib/core/animation/AnimationController.java#L666-L672); [GL4C keyframe/AnimationPointQueue.java L15](https://github.com/bernie-g/geckolib/blob/7d6f32db9168a24e14b327c0ad9f8f87dfc204de/core/src/main/java/software/bernie/geckolib/core/keyframe/AnimationPointQueue.java#L15) +- 5.x: an `int[bone][transform][axis]` index array is kept between frames; each frame walks forward (or backward) from the last index. A jump of more than half the timeline rebuilds the array from zero. No binary search. [v] [GL5 animation/state/AnimationPoint.java L94-107, L163-189](https://github.com/bernie-g/geckolib/blob/1e09655d3b54c2db959d234266fb564b90aa9382/common/src/main/java/com/geckolib/animation/state/AnimationPoint.java#L94-L189); [GL5 AnimationTimeline L89-107](https://github.com/bernie-g/geckolib/blob/1e09655d3b54c2db959d234266fb564b90aa9382/common/src/main/java/com/geckolib/animation/state/AnimationTimeline.java#L89-L107) +- 5.x: hold and paused states reuse the same point when time did not change. [v] GL5 AnimationPoint L94-96; GL5 LoopType L24-28 + +**Loading** + +- 4.x: Gson tree, one `Keyframe` record per axis per key, with a `Constant` per value, a `MolangValue` wrapper for non-rotation constants and a new empty easing-argument list per key. Keys are read in JSON order, not sorted. [v] [GL4F BakedAnimationsAdapter L82-124, L176-221](https://github.com/bernie-g/geckolib/blob/7d6f32db9168a24e14b327c0ad9f8f87dfc204de/Fabric/src/main/java/software/bernie/geckolib/loading/json/typeadapter/BakedAnimationsAdapter.java#L176-L221); [GL4C molang/MolangParser.java L165-186](https://github.com/bernie-g/geckolib/blob/7d6f32db9168a24e14b327c0ad9f8f87dfc204de/core/src/main/java/software/bernie/geckolib/core/molang/MolangParser.java#L165-L186) +- 5.x: keys go into a `Double2ObjectArrayMap` (linear-time insert), sorted if out of order, duplicates warned; values compiled through one deduplicating `MathParser` per reload on the prep executor. [v] [GL5 ActorBoneAnimationEntry L81-119](https://github.com/bernie-g/geckolib/blob/1e09655d3b54c2db959d234266fb564b90aa9382/common/src/main/java/com/geckolib/loading/definition/animation/ActorBoneAnimationEntry.java#L81-L119); prior note, resource loading. + +**What makes Blockbench bake** + +- Bedrock export bakes any segment touching a `bezier` key into samples at the animation's snapping rate (default 24 per second); it skips up to 12 samples in a row when the curve is nearly straight (thresholds 0.1° rotation, 0.01 position, 0.005 scale). [v] [BB formats/bedrock/bedrock_animation.js L473-510](https://github.com/JannisX11/blockbench/blob/ec0b2827104d0799c153bfb5f867579c0c44652f/js/formats/bedrock/bedrock_animation.js#L473-L510); [BB interface/setup_settings.js L285](https://github.com/JannisX11/blockbench/blob/ec0b2827104d0799c153bfb5f867579c0c44652f/js/interface/setup_settings.js#L285) +- Bedrock export writes every live IK chain as rotation samples at the `animation_sample_rate` setting (default 24, export category), with no reduction. [v] [BB bedrock_animation.js L528-541](https://github.com/JannisX11/blockbench/blob/ec0b2827104d0799c153bfb5f867579c0c44652f/js/formats/bedrock/bedrock_animation.js#L528-L541); BB setup_settings.js L338 +- The action "Bake IK rotations" samples at the animation's snapping rate and drops only samples equal to both neighbours, values rounded to 4 decimals. [v] [BB animations/animation.js L1060-1118](https://github.com/JannisX11/blockbench/blob/ec0b2827104d0799c153bfb5f867579c0c44652f/js/animations/animation.js#L1060-L1118) +- The Bakery plugin ("Bakes complex animations into simple linear keyframes") samples selected keys at snapping times rate and sets every key to linear. [v] [BBP bakery.js L8-12, L53-104](https://github.com/JannisX11/blockbench-plugins/blob/4d1bfcaa45cc24ff4d7ecd3713be419dadf3c490/plugins/bakery.js) +- The GeckoLib plugin has an export setting "Bake in bezier keyframes", default off. When off, bezier keys are exported as `"easing": "bezier"` with handle values, and the file gets `geckolib_format_version: 2`. [v] [BBP geckolib/src/ts/index.ts L93-98](https://github.com/JannisX11/blockbench-plugins/blob/4d1bfcaa45cc24ff4d7ecd3713be419dadf3c490/plugins/geckolib/src/ts/index.ts#L93-L98); [BBP geckolib/src/ts/events.ts L447-495](https://github.com/JannisX11/blockbench-plugins/blob/4d1bfcaa45cc24ff4d7ecd3713be419dadf3c490/plugins/geckolib/src/ts/events.ts#L447-L495); [BBP geckolib/src/ts/keyframe.ts L96-97](https://github.com/JannisX11/blockbench-plugins/blob/4d1bfcaa45cc24ff4d7ecd3713be419dadf3c490/plugins/geckolib/src/ts/keyframe.ts#L96-L97) +- Neither GeckoLib 4.8.4 nor 5.5.6 registers a `bezier` easing (only comment mentions), so such keys play linear. AzureLib does register one. [v] grep of both EasingType files; AZ `easing/AzEasingTypes.java` L189-208 +- There is no keyframe-reduction action in Blockbench core or in the plugin list; the closest are the Bedrock export's bezier skip and "Bake IK"'s equal-neighbour drop. The plugin repository has `optimize.js` (not read). [v] grep of `js/animations`; `ls plugins` (gap: `optimize.js` purpose unread). + +**Nublar's files, measured** (script in the scratchpad, read-only, `python3 -I`) + +| File | Size | Minified | Anims | Keys | Channels | Constant channels | Rest-pose bone entries | Corrupt keys | +|---|---|---|---|---|---|---|---|---| +| brachiosaurus | 1.41 MB | 0.84 MB | 29 | 18,503 | 1,157 | 157 | 8 of 770 | 74 | +| dilophosaurus | 1.41 MB | 0.82 MB | 23 | 16,358 | 1,345 | 903 | 234 of 612 | 22 | +| gallimimus | 0.90 MB | 0.52 MB | 15 | 8,943 | 918 | 560 | 109 of 458 | 1 | +| triceratops | 0.68 MB | 0.41 MB | 23 | 5,880 | 510 | 99 | 6 of 341 | 0 | +| tyrannosaurus_rex | 5.58 MB | 3.37 MB | 26 | 43,812 | 3,819 | 3,293 | 850 of 1,411 | 0 | +| velociraptor | 1.89 MB | 1.09 MB | 29 | 17,124 | 1,985 | 1,237 | 225 of 953 | 81 | +| Total | 11.9 MB | 6.9 MB | 145 | 110,620 | 9,734 | 6,249 | 1,432 of 4,545 | 178 | + +[v] NAF, measured 2026-11-03. "Channels" counts rotation, position and scale entries including single-value ones; the reduction below uses the 8,925 keyed channels. + +- Spacing: the commonest gaps between keys are 0.04 s (46,475 gaps, 25 per second), 0.05 s (9,651), 0.0417 s (7,542, 24 per second) and 0.0833 s. Median keyed channel: 0.3 keys per second; 90th percentile 10.9; maximum 27.3. Largest channel: 260 keys. [v] NAF +- Mostly-baked animations (over half their gaps under 0.06 s): Tyrannosaurus 12 of 26 (walk, run, drink, speak, sniffair, sniffground, shakehead, scratch, eat1, rest, getup, roar); Dilophosaurus 6; Gallimimus run and sniffair; Velociraptor sniffair and shakebody; Brachiosaurus roar and tailwhip; Triceratops dead. [v] NAF +- Easing entries: 56,777 `catmullrom`, 21,588 explicit `"easing": "linear"` (Tyrannosaurus 18,001, Triceratops 3,587), the rest implicit linear. No `bezier`. 682 keys carry `pre`. [v] NAF +- Corrupt values: Brachiosaurus drink (47 keys, 15 bones), call (20), eat1 (5), roar (2); Dilophosaurus eat1 (12), head_shake (10); Gallimimus swim (1); Velociraptor dead (34), roar (32), scratch (15). Values such as 300000000 or -29100000 degrees sit among keys of a few degrees. [v] NAF +- Blockbench-vs-GeckoLib catmull mismatch: 484 segments start on a catmull key and end on a linear key (Blockbench curves them, GeckoLib does not); 927 catmull channels are in looping animations (Blockbench wraps the tangent at the seam, GeckoLib does not). [v] NAF, rule from BB timeline_animators.js L544-556 +- The 4.x catmull start-tangent error versus correct catmull, on 1,481 catmull rotation channels (corrupt channels excluded from the statistics): median 0.75°, 90th percentile 2.6°; 586 channels exceed 1°, 110 exceed 3°. [v] NAF computed with GeckoLib's formula + +**Keyframe-reduction estimate** + +Method: per channel, greedily drop interior keys while the curve rebuilt from the kept keys (linear or catmull, as the channel uses, with GeckoLib 5's end-key rule) stays within tolerance of the original at every original key time and midpoint. Molang channels and corrupt values are kept as they are. + +| Tolerance | Keys kept | Removed | Catmull channels removed | Linear channels removed | +|---|---|---|---|---| +| 0.1° rotation, 0.01 units position and scale | 66,193 of 110,620 | 40.2% | 45.7% | 34.4% | +| 0.5° rotation, 0.05 units position and scale | 43,714 of 110,620 | 60.5% | n/a | n/a | + +Tyrannosaurus alone drops from 43,812 to 22,555 keys (49%) at the tight tolerance and to 13,094 (70%) at the loose one. Rest-pose channels (11,643 keys, 1,432 bone entries) are inside these totals and can be removed exactly. Minifying the JSON alone takes 11.9 MB to 6.9 MB, but jar compression hides most of that. [v] NAF; [inf] for any visual claim. + +### Inferences + +- [inf] 4.x per-frame cost for one Tyrannosaurus playing `roar` (6,708 keys over 7.54 s): about three axes times half of 6,708, roughly 10,000 loop steps per controller per frame, plus about 900 queue objects for its 91 bones per controller. Halving the keys halves the scan. A held pose (sit, rest) costs the full list every frame. On 5.x the same animation costs about 90 bones times 9 axes, around 800 short checks, at any density. +- [inf] So on 4.x, reduction gives a real CPU win for herds of large animals; on 5.x, its main win is memory, load time and file size. Removing rest-pose bone entries helps both versions, because each listed bone costs nine evaluations and, on 5.x, a snapshot. +- [inf] Memory on 4.x is roughly 3 axes times (Keyframe record plus value objects), about 250-300 bytes per JSON key, so about 30 MB for 110,620 keys across six species, before the transient Gson tree. A 40-60% cut saves 12-18 MB. 5.x deduplicates constants and should use less. Not measured. +- [inf] Sparse keys with easing give the same visual result as dense baked keys when the tolerance is under about 0.5°: an error that small is hard to see at normal view distance, and 25 fps samples were themselves a linear approximation of the source curve. Re-authoring a baked clip by hand with 4-8 keys per channel and catmull or ease-in-out usually looks better, because it removes 25 Hz stair-stepping in fast motion. It costs artist time. +- [inf] The rest-pose channels look like an export of "all bones" from a rig or a template. On 4.x they are mostly harmless for transforms the other controller does not key, but on 5.x they make the main controller own every listed bone fully, so a rest-pose leg entry in an idle would freeze the walk legs if the idle ever plays with the walk. +- [inf] The corrupt values make a bone spin by millions of degrees across one segment, so it shows as a flicker or random pose for that frame range. They look like tiny numbers whose negative exponent was lost; replacing them with 0 is the likely fix, checked in Blockbench. +- [inf] How to undo baking in Blockbench: there is no built-in reducer, so the practical path is an offline script (the same greedy method as above) that rewrites the `.animation.json`, then a re-import into the `.bbmodel` with the GeckoLib plugin, or a one-time manual clean of the worst clips. Keep "Bake in bezier keyframes" off only if the runtime plays bezier (AzureLib, or a custom easing registered in GeckoLib); otherwise turn it on, or avoid bezier keys, because unbaked bezier plays linear. + +### Gaps + +- Load time and heap were not measured in game; the memory figure is an estimate. +- Which Blockbench tool baked each Nublar clip is not recorded in the files; the 24 and 25 per second spacing fits IK export, "Bake IK", bezier bake or Bakery. +- The reduction was checked numerically, not by eye in game. +- The plugin `optimize.js` and the Animated Java plugin were not read. + +## Key question 4: Known pitfalls + +### Takeaway + +The 4.x traps Nublar meets are: stdout spam for missing animations and missing keyframe handlers, a playhead jump when speed changes, keyframe markers that fire early by the transition length, held animations that never "finish", and fresh controllers after every chunk reload. 5.x fixes most of them but changes behaviour Nublar depends on: no `forceAnimationReset`, hold now reports finished, a controller with zero transition snaps on stop, and a bone listed in an animation is owned fully. + +### Cited Findings + +- Missing animation (4.x): stdout line every frame, because the controller stops and retries on the next frame. [v] [GL4C AnimationProcessor L48-52](https://github.com/bernie-g/geckolib/blob/7d6f32db9168a24e14b327c0ad9f8f87dfc204de/core/src/main/java/software/bernie/geckolib/core/animation/AnimationProcessor.java#L48-L52); [GL4C AnimationController L342-367](https://github.com/bernie-g/geckolib/blob/7d6f32db9168a24e14b327c0ad9f8f87dfc204de/core/src/main/java/software/bernie/geckolib/core/animation/AnimationController.java#L342-L367). Nublar already guards this. [v] `common/src/main/java/net/dumbcode/projectnublar/util/DinoAnimationAvailability.java` L19-25 +- Missing animation (5.x): silent for a missing name; an ERROR per lookup for a missing file. [v] [GL5 cache/BakedAnimationCache.java L27-57](https://github.com/bernie-g/geckolib/blob/1e09655d3b54c2db959d234266fb564b90aa9382/common/src/main/java/com/geckolib/cache/BakedAnimationCache.java#L27-L57) +- `forceAnimationReset` (4.x): marks the animation for reload, so the next `setAnimation` rebuilds the queue and enters TRANSITIONING; the restart blends over the transition length from the current pose, not a hard cut. [v] [GL4C AnimationController L276-278, L342-367](https://github.com/bernie-g/geckolib/blob/7d6f32db9168a24e14b327c0ad9f8f87dfc204de/core/src/main/java/software/bernie/geckolib/core/animation/AnimationController.java#L276-L278). Nublar calls it on every new start [v] `common/src/main/java/net/dumbcode/projectnublar/entity/dinosaur/animation/DinoAnimator.java` L253-264 +- 5.x has no `forceAnimationReset`; `setAnimation` returns early when the raw animation is equal; `reset()` clears the controller to STOP. [v] [GL5 AnimationController L276-290, L361-369](https://github.com/bernie-g/geckolib/blob/1e09655d3b54c2db959d234266fb564b90aa9382/common/src/main/java/com/geckolib/animation/AnimationController.java#L276-L369) +- Markers early (4.x): marker times are compared with animation time plus the transition length. [v] GL4C AnimationController L620 +- Stop (4.x): untouched bones ease to rest over 5 ticks. Stop (5.x): the timeline jumps to its last end; if the transition length is 0 there is no reset stage, so the bones drop to rest at once. [v] GL4C AnimationProcessor L131-209; [GL5 AnimationController L456-459](https://github.com/bernie-g/geckolib/blob/1e09655d3b54c2db959d234266fb564b90aa9382/common/src/main/java/com/geckolib/animation/AnimationController.java#L456-L459); GL5 AnimationTimeline L199-213 +- 5.x first animation with no previous point (fresh controller, or after `reset()`): the leading transition stage takes the "reset" path, which blends from the animation's first frame towards rest, then the animation starts at its first frame. [v] [GL5 AnimationProcessor L165-171, L222-235](https://github.com/bernie-g/geckolib/blob/1e09655d3b54c2db959d234266fb564b90aa9382/common/src/main/java/com/geckolib/animation/AnimationProcessor.java#L222-L235); [GL5 AnimationController L287](https://github.com/bernie-g/geckolib/blob/1e09655d3b54c2db959d234266fb564b90aa9382/common/src/main/java/com/geckolib/animation/AnimationController.java#L287) +- Controller state on chunk reload: managers are per entity instance id and the cache lives on the entity object, so a reloaded entity starts every controller from scratch; a triggered animation is a one-off packet to players tracking at that moment, so late trackers never see it. [v] [GL4F GeoEntity L58-67](https://github.com/bernie-g/geckolib/blob/7d6f32db9168a24e14b327c0ad9f8f87dfc204de/Fabric/src/main/java/software/bernie/geckolib/animatable/GeoEntity.java#L58-L67); [GL5 AnimatableManager L30-36](https://github.com/bernie-g/geckolib/blob/1e09655d3b54c2db959d234266fb564b90aa9382/common/src/main/java/com/geckolib/animatable/manager/AnimatableManager.java#L30-L36) +- Animation tick vs partial tick (4.x): entity time is `tickCount + partialTick`; the model keeps one running clock shared by all entities of that model, advanced by the difference from the last rendered entity's time; nothing advances while the game is paused unless `shouldPlayAnimsWhileGamePaused`. [v] [GL4F GeoModel L189-212](https://github.com/bernie-g/geckolib/blob/7d6f32db9168a24e14b327c0ad9f8f87dfc204de/Fabric/src/main/java/software/bernie/geckolib/model/GeoModel.java#L189-L212) +- 5.x: the frame delta is forced monotonic (`safetyCheckTickLinearity`), and is 0 when partial tick is exactly 1 (extra passes, pause). [v] [GL5 AnimationController L437-443, L591-599](https://github.com/bernie-g/geckolib/blob/1e09655d3b54c2db959d234266fb564b90aa9382/common/src/main/java/com/geckolib/animation/AnimationController.java#L591-L599) +- Transitions and speed: in both versions the transition runs in speed-scaled time, so a transition at speed 0.5 takes twice as long. [v] GL4C AnimationController L446-450, L700-704; GL5 AnimationController L439 +- Rotation wrap (4.x): a hack treats suspected full turns as complete to avoid back-lerping, with the author's comment that it is far from perfect. 5.x wraps the from-value of a transition to ±180°. [v] GL4C AnimationProcessor L149-166, L220-225; GL5 AnimationProcessor L262-267 +- Key order (4.x): keys are used in JSON order; out-of-order timestamps break silently. 5.x sorts and warns. [v] GL4F BakedAnimationsAdapter L105-118; GL5 ActorBoneAnimationEntry L85-117 +- `ground_speed` comes from `getDeltaMovement()`. Nublar reads position change instead for its gait. [v] GL4F GeoModel L244-248; `common/src/main/java/net/dumbcode/projectnublar/entity/dinosaur/animation/DinoAnimator.java` L84-88 + +### Inferences + +- [inf] Early markers: Nublar's main controller uses 5-tick transitions, so on 4.x a footstep or roar sound keyed in the file fires 0.25 s before the matching pose. +- [inf] For Nublar on 5.x, map `forceAnimationReset` to `reset()` followed by `setAnimation`, or to `setAnimationTime(0)` when the same animation must restart in place. Check the "fresh point" path above, because a restart after `reset()` may drift to rest and snap. +- [inf] Idle repick on 5.x: Nublar asks `hasAnimationFinished` only for looping idles today; held sit and rest would start reporting finished on 5.x, so any future logic that reads it for held states changes meaning. +- [inf] Chunk reload makes every animal in a loaded herd start its idle and walk at frame 0 together. A random start offset per entity (5.x `setAnimationTime`, 4.x a controller subclass that shifts its protected tick offset, AzureLib `SetStartTickOffset`) removes the marching-in-step look. +- [inf] Long or state-like actions (sleep, sit, death) should stay driven by synced entity data, as Nublar does now; triggers suit short one-shots only. +- [inf] The secondary controller with 0 ticks and constant STOP costs a controller pass per frame for nothing; remove it or give it a job. + +### Gaps + +- The 5.x "fresh point drifts to rest" path was read, not run. +- No test of what 4.x does with a `pre`-only key at time 0. + +## Techniques Nublar could adopt + +Ranked by value for effort. Effort S = hours, M = days, L = a week or more. "4.x now vs wait for 5.x" says where to do it. + +| Rank | Technique | Source | Improves | Effort | 4.x now vs wait for 5.x | +|---|---|---|---|---|---| +| 1 | Fix the 178 corrupt rotation keys (likely set to 0), checked in Blockbench | NAF measurement | Brachiosaurus drink, call, eat1, roar; Dilophosaurus eat1, head_shake; Gallimimus swim; Velociraptor dead, roar, scratch | S | Now. A pure asset fix. | +| 2 | Strip rest-pose channels and bone entries (exact) | NAF measurement; GL5 AnimationProcessor L84-96 | All species, most of all Tyrannosaurus (850 of 1,411 entries); frees bones for other controllers | S | Now. It also prevents a 5.x layering problem. | +| 3 | Offline keyframe reduction at 0.1°/0.01 (about 40% fewer keys), then review the baked clips by eye | NAF script; GL4C AnimationController L715-759 | Tyrannosaurus 12 baked clips, Dilophosaurus sniff and scratch, Velociraptor sniffair and shakebody; CPU on 4.x, memory on both | S-M | Now. The 4.x CPU win is largest; on 5.x it is memory and load. | +| 4 | Add a sound keyframe handler and author footstep markers | GL4C AnimationController L620-656; GL5 AutoPlayingSoundKeyframeHandler | Walk and run of every species; removes Brachiosaurus stdout spam | S | Now, but on 4.x shift marker times by the transition length or accept 0.25 s early sounds. 5.x is exact. | +| 5 | Random start offset per entity for idles and walks | GL5 AnimationController L316-331; AZ SetStartTickOffset | Herds after chunk load; idle variety | S (5.x), M (4.x subclass) | Wait for 5.x unless the in-step look is reported. | +| 6 | Own head and neck look-at: clamped, spread over neck bones, spring-smoothed, faded out while an action owns the neck | GL4F GeoModel L186-222; GL5 GeoRenderer L165; GL5 DefaultAnimations L206-224 | Idle, sentry, startled, sniff; all species | M | Now in `setCustomAnimations`, written so the math ports to a 5.x updater unchanged. | +| 7 | Split clips by body region so controllers do not overlap (legs in movement, neck and head in main, tail in a third) | GL4F example DynamicExampleEntity L59-68; GL4C per-transform writes | Walk with eat, walk with roar, look while walking | M | Now for 4.x semantics; on 5.x it is required, because a listed bone is owned fully. | +| 8 | Re-author worst baked clips by hand with sparse catmull or ease keys | NAF; BB bake paths | Tyrannosaurus roar, drink, rest; Dilophosaurus sniffground | L | Either. Best done before the 5.x port so files are final. | +| 9 | Distance-driven walk time (playhead from distance moved, not speed scaling) | Bedrock `anim_time_update` [doc]; GL5 setAnimationTime | Foot sliding on walk and run | M | Wait for 5.x (seek exists, speed is smooth). On 4.x the current speed limiter is the practical choice. | +| 10 | Additive breathing and flinch layers | GL5 `additiveAnimations()` | Idle sway as a file-authored layer; hit reactions over any pose | M | Wait for 5.x, and test the base-rotation subtraction first. The 4.x code sway stays until then. | +| 11 | Molang-driven secondary motion (tail sway from `query.yaw_speed`, head from `query.head_y_rotation`) | GL4C MolangQueries; GL5 MolangQueries L234-346 | Tail and neck follow-through | M | Mostly 5.x: 4.x lacks head and limb queries and has only global variables. | +| 12 | Avoid bezier keys, or bake them, unless the runtime plays bezier | BBP geckolib index.ts L93-98; GL4C and GL5 EasingType | Any new clip | S | Now, as an authoring rule. | +| 13 | Keep catmull on both ends of a curved segment, and add a duplicate seam key for looping catmull clips | BB timeline_animators.js L544-556; GL4F BakedAnimationsAdapter L223-246 | 484 mismatched segments, 927 looping catmull channels | S | Now as an authoring rule. The 4.x tangent error (median 0.75°) goes away on 5.x. | +| 14 | Controller weights and bone masks | AZ AzBoneMask, AzWeightFade, AzBoneAnimationUpdateUtil | Smooth blend of walk into run, partial-body overlays | L | Neither GeckoLib version has them. Copy the idea into a 5.x bone updater, or weigh a move to AzureLib (large API change). | diff --git a/research_notes/GeckoLib creature animation survey/prehistoric_geckolib_mods.md b/research_notes/GeckoLib creature animation survey/prehistoric_geckolib_mods.md new file mode 100644 index 00000000..c55ffa55 --- /dev/null +++ b/research_notes/GeckoLib creature animation survey/prehistoric_geckolib_mods.md @@ -0,0 +1,273 @@ +# Prehistoric GeckoLib mods: how other dinosaur mods drive, layer and author their animations + +Research note for the GeckoLib creature animation survey. Written 2026-11-03. Scope: dinosaur and prehistoric creature mods that animate with GeckoLib (no AzureLib dinosaur mod was found). It covers controller layout, speed matching, procedural bones, events and layering, babies and special states, file authoring and player reception, compared with Project Nublar (GeckoLib 4.7.3 on 1.20.1, planned GeckoLib 5 on 26.2). Three open-source mods were read in depth. Six closed-source jars were checked for their animation assets only. The GeckoLib 4 and 5 sources were read where a finding depends on library behaviour. + +Labels: **[v]** verified in source or in a shipped jar asset at the stated commit or version, with path and lines. **[inf]** inference from the verified facts. **[doc]** from a README, store page or listing. Code is never pasted (clean-room rule); mechanisms are described in words and numbered steps. Most art assets in these mods are All Rights Reserved even when the code is MIT, so nothing here should be copied, only re-implemented from the description. + +Keyframe density metric used below: for each clip, the number of keyframes summed over all bones and channels (rotation, position, scale), divided by the clip length in seconds. The same script was run on Nublar's files, so the numbers are comparable to each other, not to other surveys. + +## Repository facts + +| Mod | Licence (SPDX) | Branch / commit or version read | Minecraft | Loaders | GeckoLib | +|---|---|---|---|---|---| +| Fossils and Archeology: Revival (FA) | Code MIT; all other assets All Rights Reserved [v] LICENSE L1-29 | `1.20.1`, `b400cf2423dc245f3d18c8c60122835d4be5c6e2` (2026-06-07), mod 9.3.4.0 | 1.20.1 | Fabric, Forge (Architectury) | 4.7.2 [v] gradle.properties `gecko_lib_version` | +| Unusual Prehistory (UP, Peeko32213) | Code MIT; textures, geo, animations, music LicenseRef-All-Rights-Reserved [v] LICENSE L1-20 | `main-final`, `c49f49a5075fa66bb58668344c2c46e25ec68238` (2026-03-22) | 1.20.1 | Forge 47.1.3 | 4.7.1.2 [v] gradle.properties | +| Jurassic Revived (JRev) | CC-BY-ND-4.0, whole repo [v] LICENSE | `main`, `e043449a6491f3840b9afe0d1cdd216f21cde114` (2026-07-04) | 1.20.1 and 1.21.1 (Stonecutter) | Fabric, Forge (1.20.1), NeoForge (1.21.1) | 4.8.2 [v] versions/*/gradle.properties | +| Primal Frontier Legacy (PFL) | LicenseRef-All-Rights-Reserved on Modrinth; mods.toml says "Not specified" [doc][v] | jar 0.4.1-alpha (Modrinth `xkWLBh5U`), MCreator-generated | 1.20.1 | Forge | required, any version [v] mods.toml | +| Jurassic World Craft (JWC) | LicenseRef-All-Rights-Reserved on Modrinth; mods.toml AFL-3.0 (MCreator default) | jar 1.1.0 (`L599avEq`), MCreator | 1.20.1 | Forge | required [v] | +| Not Enough Dinosaurs (NED) | LicenseRef-All-Rights-Reserved | jar 1.3.0 (`SGWEXFA7`), MCreator | 1.20.1 | Forge | required [v] | +| Prehistoric Legacy, Jurassic Additions, Cenozoicraft | AFL-3.0 / MIT / MIT in mods.toml | jars 1.0.5, 0.2.0, 1.3.0, all MCreator | 1.20.1 | Forge | required [v] | +| GeckoLib 4 (reference) | MIT | `1.20.1`, `7d6f32db9168a24e14b327c0ad9f8f87dfc204de`, 4.8.4 | 1.20.1 | Fabric, Forge | n/a | +| GeckoLib 5 (reference) | MIT | `26.2`, `1e09655d3b54c2db959d234266fb564b90aa9382`, 5.5.6 | 26.2 | Fabric, NeoForge, Forge | n/a | + +Checked and dropped (one line each): + +- Unusual Prehistory 2 (platypushasnohat, `676f89bc`, NeoForge 1.21.1): uses the authors' own "Sinew" library, no GeckoLib [v] gradle.properties. +- Prehistoric Fauna (superlord9362, `1.20.1`, `29573292`): no GeckoLib dependency; vanilla-style Java models [v] build.gradle. +- Jurassic Reborn (Interactive-Modding, `1.20.1`, `5826778c`): GeckoLib 4.8.2 only for blocks (incubator, fences, rails); dinosaurs use its own `EntityAnimator` system [v]. Licence ARR. +- Jurassic World Reborn (gamma-02, 1.19.2): same split, GeckoLib only for blocks [v]. +- JurassiCraft (JurassiCraftTeam, 1.12.2): LLibrary, no GeckoLib [v]. +- Jurassic World Reborn II (DexxKnight1): a modpack, no code [v]. +- Jurassic Saga: issue tracker only, source ARR and not public [v] README. +- Primal Frontier (Neo), Jurassic Returned, ShineaL's Prehistoric Expansion, NecroCrab "Prehistoric Dinosaurs": no GeckoLib in jar or repo [v]. +- Paleocraft, Primal Paleo, Dinosaurs Expansion, Prehistoric Expansion: no GeckoLib build found; the Paleocraft repos are 2014-2017 [v] gh search. + +Base URLs: FA = `https://github.com/TeamFossilsArcheology/FossilsArcheologyRevival/blob/b400cf2423dc245f3d18c8c60122835d4be5c6e2/common/src/main/java/com/github/teamfossilsarcheology/fossil/`; UP = `https://github.com/Peeko32213/Unusual-Prehistory/blob/c49f49a5075fa66bb58668344c2c46e25ec68238/src/main/java/com/peeko32213/unusualprehistory/`; JRev = `https://github.com/classic-mods-revived/Jurassic-Revived/blob/e043449a6491f3840b9afe0d1cdd216f21cde114/common/src/main/java/net/cmr/jurassicrevived/`; GL4 = `https://github.com/bernie-g/geckolib/blob/7d6f32db9168a24e14b327c0ad9f8f87dfc204de/`; GL5 = `https://github.com/bernie-g/geckolib/blob/1e09655d3b54c2db959d234266fb564b90aa9382/common/src/main/java/com/geckolib/`. + +## Key question 1: How many controllers, and what does each drive? + +### Takeaway + +Everyone uses two or three controllers. Base locomotion and idle sit on one. Attacks sit on a second. UP adds a third for "blend" gestures (roar, sniff, shake). The useful difference is how the layers avoid fighting. UP gives each joint a stack of separate bones, so each controller owns its own bones. FA patches GeckoLib so controllers add together instead of the last one winning. Nublar's two controllers share the same bones, so an action on `main` must replace the whole pose. + +### Cited Findings + +- FA registers two controllers per animal, "Movement/Idle" and "Attack", both with a 5-tick blend. It also registers every clip in the file as a triggerable animation on both. [v] FA `entity/prehistoric/base/Prehistoric.java` L1608-1622; `entity/animation/AnimationLogic.java` L31-33. +- FA's movement predicate checks states in this order: knocked out, sleeping, sitting, in water (swim, kept until back on ground), moving (walk or sprint), idle. Fliers, leapers, swimmers and fish have their own predicates. [v] FA `AnimationLogic.java` L210-248 (water), L325-387 (leaping), L389-424 (land), L457-516 (fish, flying). +- FA's attack controller plays only while a server-chosen attack animation is unfinished, then stops. During a heavy attack the movement controller returns STOP so it does not fight the attack. [v] FA `AnimationLogic.java` L187-193, L426-435. +- UP's T-Rex registers three controllers: "controller" (5-tick blend; swim, walk at fixed speeds, idle, knockout), "idleController" (0-tick blend; shake, sniff and roar gestures from synced booleans), and "attackController" (5-tick blend; bites, stomps, tail whip, charge, tackle, aggro, chosen by a synced integer state). [v] UP `common/entity/custom/prehistoric/TyrannosaurusEntity.java` L636-756. +- UP's T-Rex geometry stacks three bones on each major joint: a `_rotation` bone (code- or molang-driven), then an `_overlay` bone (gesture clips), then the visible bone (locomotion clips). Examples are body, tail1, tail2, neck and head. The neck also has a `neck_control` bone for head look. [v] UP asset `assets/unusualprehistory/geo/tyrannosaurus/tyrannosaurus_rex.geo.json` (hierarchy inspected, not copied). +- UP's "_blend" clips animate only `_overlay` bones. For example, `bite_blend1` touches 8 overlay bones, while `walk` touches 15 base bones. So a bite plays on top of a walk with no conflict. [v] UP asset `animations/tyrannosaurus/tyrannosaurus_rex.animation.json`. +- FA replaces GeckoLib 4's controller loop with its own. Steps: (1) each controller is processed as usual and fills its bone queues; (2) for each bone, the first controller's value is applied on top of the bone's rest pose; (3) each later controller's value is **added** to it (rotation and position) or **multiplied** into it (scale). The default GeckoLib pass is then cancelled for models that carry FA's `AdditiveAnimationModel` marker. [v] FA `compat/geckolib/AnimationProcessorOverride.java` L21-101; `mixin/AnimationProcessorMixin.java` L40-53; `client/model/PrehistoricGeoModel.java` L19. +- JRev uses a "MovementController" (swim, run, walk, idle) plus two trigger-only controllers, "attackController" and "mouthController". [v] JRev `entity/custom/TyrannosaurusRexEntity.java` L169-188. + +### Inferences + +- [inf] UP's bone stack is the cheapest way to get true layering on GeckoLib 4 or 5 with no mixins. It costs extra empty bones in the model (UP's rex has 36 bones, 19 of them cube-less pivots). Each pivot bone must sit at the same pivot point as its child. +- [inf] FA's additive mixin gives the same result without changing models. But it reaches into GeckoLib internals (`BoneAnimationQueue`, snapshots), so it would have to be rewritten for GeckoLib 5's new pipeline. +- [inf] With Nublar's current setup, a roar or bite while walking must either be a full-body clip or stop the legs. A third "gesture" controller on overlay bones would allow bite-while-walking and roar-while-walking. + +### Gaps + +- FA's leaping and flying predicates were skimmed, not traced end to end. +- No mod was found using GeckoLib 5's built-in additive or blend-weight features, because none of these mods has ported yet. + +## Key question 2: How is walk or run speed matched to movement? What about turning in place and slope? + +### Takeaway + +FA has the best speed matching. Each walk or run clip has a "blocks per second" value in a data file. Playback speed is the animal's real speed divided by that value, then divided by the animal's scale. FA also fixes GeckoLib 4's phase jump when speed changes mid-clip. UP and JRev use fixed speeds per state. Nobody has a dedicated turn-in-place clip. Body pitch is handled only for swimmers and fliers, through a `pitch_root` bone. + +### Cited Findings + +- FA keeps a client data file per species holding `blocks_per_second` for walk and run clips. For example, the T-Rex has walk 0.5 and run 1.5. [v] FA `entity/animation/ClientAnimationInfoLoader.java` L44; asset `assets/fossil/animations/entity/data/tyrannosaurus.json`. +- FA's movement speed steps [v] FA `AnimationLogic.java` L284-323: + 1. Start from 1 divided by the entity scale, because the clips were authored at scale 1. + 2. Measure horizontal speed from the delta movement, divided by block friction times 0.91, times 20, to get blocks per second. For a ridden animal not controlled locally, use the position delta instead. + 3. Cap that at the animal's attribute speed (walk or sprint). + 4. Multiply by measured speed divided by the clip's `blocks_per_second`. + 5. If the result is at or below 0.1, switch to idle instead of crawling the cycle. + 6. If the speed drops, ease toward it by at most 0.05 per tick ("inertia"). + 7. Above 2.75, or when sprinting, switch to the sprint clip and recompute against its own `blocks_per_second`. +- FA's `PausableAnimationController.setAnimationSpeed(speed, tick)` shifts the controller's tick offset whenever the speed changes. The current point in the clip therefore stays where it was. The comment explains that GeckoLib 4 otherwise rescales all elapsed time retroactively. [v] FA `entity/animation/PausableAnimationController.java` L53-71. +- GeckoLib 4 computes clip time as speed times (tick minus start offset). So any speed change moves the current frame. [v] GL4 `core/src/main/java/software/bernie/geckolib/core/animation/AnimationController.java` L700-708. +- GeckoLib 5 adds a per-frame delta times the previous speed to a running timeline time. So a speed change no longer jumps the phase. [v] GL5 `animation/AnimationController.java` L211-215, L435-441. +- UP's T-Rex uses walk at speed 1.0, walk at 2.0 when running, and 1.15 or 1.65 when ridden. It has a run clip, but the movement predicate never picks it. [v] UP `TyrannosaurusEntity.java` L649-690. +- UP's clip files use `query.ground_speed` (288 uses) and `query.is_on_ground` (1,760 uses) inside molang, to fade amplitudes. For example, roar_blend scales an offset by a clamped ground speed. [v] UP asset `tyrannosaurus_rex.animation.json`, `roar_blend`. +- PFL's walk, run and back-walk clips declare `anim_time_update` as `query.modified_distance_moved` divided by a constant (31 clips). This is the Bedrock way to tie a cycle to distance travelled. [v] PFL jar 0.4.1, `assets/*/animations/maip.animation.json`, `antlion.animation.json`, `para.animation.json`. +- GeckoLib 4 does not read `anim_time_update` at all. GeckoLib 5 parses `anim_time_update` and `blend_weight` into its animation definition, but no runtime code reads either field. [v] GL4 grep, no match; GL5 `loading/definition/animation/ActorAnimation.java` L55-56, no other reference. +- GeckoLib 5 exposes `query.limb_swing` and `query.limb_swing_amount` from the vanilla walk animation state, plus `query.ground_speed` and `query.yaw_speed`. [v] GL5 `loading/math/MolangQueries.java` L306, L312, L323-324. +- GeckoLib 4 Forge computes `query.yaw_speed` by passing an angle in as a partial tick, which looks wrong. The Fabric copy uses a plain yaw minus previous yaw. [v] GL4 `Forge/src/main/java/software/bernie/geckolib/model/GeoModel.java` L249; `Fabric/.../GeoModel.java` L249. +- FA sets the `pitch_root` bone's X rotation from the entity pitch for swimmers in water and fliers in flight. When a player rides a flier, it also sets Z from a banking yaw. [v] FA `client/model/PrehistoricGeoModel.java` L30-56. +- Nublar compares: its gait limits the per-tick speed change by a step that shrinks as the clip runs longer, which bounds the phase error. [v] local `common/src/main/java/net/dumbcode/projectnublar/entity/dinosaur/MovementGait.java` L105-117. + +### Inferences + +- [inf] FA's offset re-anchor would let Nublar drop the bounded-step workaround on GeckoLib 4 and follow speed exactly. On GeckoLib 5 neither is needed. +- [inf] Storing "blocks per cycle" per clip as data, not code, would let artists re-tune foot sliding without a rebuild. Nublar's cycle-ticks inputs are already close to this. +- [inf] For 26.2, `query.limb_swing` gives distance-driven cycles in molang. But `anim_time_update` would need a small custom controller, because GeckoLib 5 ignores it. +- [inf] Nobody does turn-in-place or slope pitch for land animals. This is open ground for Nublar. + +### Gaps + +- No mod measures stride length from the clip itself; everyone hand-enters the speed. + +## Key question 3: Procedural bone work (head look, tail drag, neck, breathing, jaw, IK) + +### Takeaway + +Tail drag on turning is the common procedural extra. UP feeds a turn-driven tail yaw into a molang query, which drives `_rotation` bones from a tiny 0-length clip. JRev writes a smoothed, weighted tail sway straight into six tail bones in `setCustomAnimations`. UP also has a small follow-the-leader chain solver for long tails and necks. Head look is aimed at a control bone the clips never key. Nobody does blinking, foot IK or procedural breathing beyond sine molang in idle clips. + +### Cited Findings + +- UP tail and head lag steps [v] UP `common/entity/custom/base/PrehistoricEntity.java` L366-420, called at L131: + 1. Each tick, if the yaw changed by more than 1 degree, add or remove 10 degrees of tail yaw. + 2. Otherwise decay it toward 0 by 5 degrees per tick. + 3. Do the same for a head-look value, with a 0.5 degree threshold. + 4. Clamp both to plus or minus 60 degrees. + 5. Keep previous values so the render side can interpolate by partial tick. +- UP pushes that value into the molang query `query.tail_yaw`, plus a second one relative to body yaw, every frame. It also registers about 45 custom queries at startup: head yaw and pitch, rider look, flight roll and pitch, target distance, temperature and more. [v] UP `client/model/ExtendedMolangQueriesModel.java` L26-114; `UnusualPrehistory.java` L139-187. +- UP's T-Rex file has a clip named `rotation`, length 0, on five `_rotation` bones. It reads `query.tail_yaw` through a clamp, which spreads the bend down the tail. [v] UP asset `tyrannosaurus_rex.animation.json`, clip `animation.tyrannosaurus.rotation`. +- UP's `IKSolver` is a distance-constraint chain. Steps: (1) place body-front and body-back points from the entity position and yaw; (2) pull each node toward its parent at a fixed spacing; (3) return the first node toward centre; (4) read yaw and pitch per link. It is used for the Brachiosaurus, Ulughbegsaurus and Dunkleosteus. The model lerps the bones toward the solved angles at 0.01 per frame. [v] UP `common/entity/util/kinematics/IKSolver.java` L145-200; `BrachiosaurusEntity.java` L171, L532; `client/model/entity/prehistoric/aquatic/DunkleosteusModel.java` L74-95. +- UP's T-Rex model sets the `neck_control` bone's yaw and pitch from the head yaw and pitch. That bone is never keyed by a clip. [v] UP `client/model/entity/prehistoric/TyrannosaurusModel.java` L63-82. +- JRev tail sway steps [v] JRev `entity/custom/BrachiosaurusEntity.java` L182-185, L221-267: + 1. Read the turn as the body yaw delta only, so head look does not swing the tail. + 2. Apply a 0.6 degree dead zone. + 3. Divide by 15 degrees and clamp to plus or minus 1. + 4. Low-pass the result with factor 0.24 per tick. + 5. Snap tiny values to 0. + 6. Clamp to plus or minus 1.5. +- JRev's model applies that sway to six tail bones with falling weights (1.00, 0.78, 0.58, 0.42, 0.30, 0.22). It uses a max of 22 degrees times a gain of 1.35 on yaw, plus 40 percent of that as opposite roll. It overrides Y and Z but keeps the clip's X bend. It also undoes the previous frame's offset, because the model instance is shared between entities. [v] JRev `entity/client/BrachiosaurusModel.java` L48-110. 166 files in JRev reference the sway, so it is used across species [v]. +- JRev clamps sauropod head look to plus or minus 10 degrees on `Neck1`. [v] JRev `BrachiosaurusModel.java` L104-109. +- FA turns off GeckoLib's built-in head turning: its model passes "false" to the defaulted model. Its clips have no procedural head look. [v] FA `client/model/PrehistoricGeoModel.java` L24-25. +- Breathing and idle motion in FA and UP are authored as sine molang in the clip files. Over 15,000 FA keyframes have the form "offset plus sine of anim time times a rate, times an amplitude". [v] FA asset files under `assets/fossil/animations/entity/`; UP has 14,485 `query.anim_time` uses. + +### Inferences + +- [inf] JRev's sway (body yaw delta, dead zone, low-pass, weighted chain, counter-roll) is the closest match to what Nublar needs for tail drag. It fits into the existing `setCustomAnimations` next to the breathing sway. +- [inf] JRev's "undo last frame's offset" step is a workaround for writing absolute values. Nublar should add the offset to the clip value each frame, or keep per-entity state, to avoid cross-entity bleed. +- [inf] UP's "control bone the clips never touch" pattern removes the fight between head look and baked head keys. That matters for Nublar's dense files, which key the head every frame. + +### Gaps + +- No mod found does foot IK on slopes, blinking or procedural jaw. FA ships a third-party hitbox library, "more_hitboxes", but it was not read. + +## Key question 4: Triggers, keyframe events, transitions, loop modes and layering + +### Takeaway + +FA and UP both use sound and particle keyframes for eat crunches, roars and sniffs. FA keeps the attack hit timing in a server-side data file, so the server knows when the bite lands without the client geometry. FA also fixes a GeckoLib 4 transition gap: bones missing from the new clip now blend instead of snapping. Start, loop and end triplets with `hold_on_last_frame` are common for sit, sleep and knockout. + +### Cited Findings + +- FA routes particle keyframes named "eat" to spawn diet-specific item particles (seeds, berries, cod, beef). Sound keyframes named "eat" and "call" play eating and ambient sounds. [v] FA `Prehistoric.java` L1627-1650; e.g. the T-Rex `eat` clip fires at 0.75, 1.125 and 1.75 s [v] asset `tyrannosaurus.animation.json`. +- FA's server data file lists, per attack clip, the length and an `action_delay` (seconds to the hit) plus a `uses_attack_box` flag. It is loaded into ticks and read by the attack logic. [v] FA `entity/animation/ServerAnimationInfoLoader.java` L64-70; `AnimationLogic.java` L199-208; asset `data/fossil/animations/entity/tyrannosaurus.animation.json`. +- FA plays server-picked animations by sending the clip name to players within 30 blocks. The client queues it as the "next" animation, then forces a reset and a set transition length on the next frame. [v] FA `AnimationLogic.java` L72-102, L260-271. +- FA's replacement rules [v] FA `AnimationLogic.java` L136-158: + 1. A clip in the same category replaces a finished clip. A looping one replaces it only by chance (the category's chance). + 2. A different category replaces a loop that is not "keep active", or any finished clip. + 3. The transition used is the longer of the old and new category's lengths. +- FA's category defaults are a 5-tick blend and chance 1. Sleep is 20 ticks and 0.05, sit 20 and 0.2, knockout 15, beached 5. [v] FA `entity/animation/AnimationCategory.java` L12-29, L35-37. +- FA transition fix steps [v] FA `compat/geckolib/AnimationControllerOverride.java` L26-53; `mixin/AnimationControllerMixin.java` L44-50: + 1. On the first tick of a new clip, find the bones the old clip animated but the new one does not. + 2. Snapshot them. + 3. Queue a blend from that snapshot to rest over the controller's transition length. +- GeckoLib 4 otherwise returns un-keyed bones to rest over `getBoneResetTime()`, default 5 ticks, whatever the controller's transition length. [v] GL4 `core/.../animatable/GeoAnimatable.java` L47-49; `core/.../animation/AnimationProcessor.java` L131-200. +- UP uses start, loop and end clips: sit_start, sit, sit_end; knockout_start, knockout, knockout_end. 4 of its 23 T-Rex clips are `hold_on_last_frame`. Sound keyframes cue `tyrannosaurus_roar` at 1.25 s and `tyrannosaurus_sniff` at 0.25 s. [v] UP asset `tyrannosaurus_rex.animation.json`. +- UP drives attacks from a synced integer state (21 to 27) on the entity, read by the attack predicate. It does not use GeckoLib triggers. [v] UP `TyrannosaurusEntity.java` L712-756. +- JRev uses GeckoLib triggerable animations for attack and mouth. [v] JRev `TyrannosaurusRexEntity.java` L161, L184-188, L226. +- FA has a debug screen that pauses a controller and scrubs its tick with a slider, through `PausableAnimationController`. [v] FA `client/gui/debug/AnimationTab.java` L90-137; `PausableAnimationController.java` L15-43. +- Nublar compares: the Brachiosaurus file already holds sound keyframes. `move.walk` and `run` have four "walk2" footstep events each, and `eatingtall2` has one more. But no keyframe handler is registered anywhere in Nublar, so they never fire. [v] local `common/src/main/resources/assets/projectnublar/animations/entity/brachiosaurus.animation.json`; grep for `KeyframeHandler` in `common/` finds nothing. + +### Inferences + +- [inf] Wiring a sound keyframe handler is a small change that turns on footsteps for the Brachiosaurus at once. It lets the other five species get footsteps by adding events to their walk and run clips. +- [inf] A server-side `action_delay` per attack clip would let Nublar line up bite damage with the jaw closing. That is better than a fixed tick count. +- [inf] FA's transition fix matters most for Nublar when moving between clips that key different bone sets: for example, `eatingtall2` back to idle, or dead to anything. It is less urgent if every baked clip keys every bone. + +### Gaps + +- Custom instruction keyframes (the `timeline` field) were not used by any mod read. + +## Key question 5: Babies and growth, sleep and death, swimming + +### Takeaway + +Babies are handled by renderer scale plus one of: a speed correction (FA), alternative baby clips chosen by name (FA, UP), or a bigger head bone (UP). Sleep, sit and knockout are looping clips with long blends (FA uses 15 to 20 ticks). Swim has its own clip; FA stays in it until the animal touches ground. Death clips are rare; most of these mods rely on vanilla's death tilt. + +### Cited Findings + +- FA scales the renderer by entity scale and divides walk playback speed by that scale. A small baby therefore cycles its legs faster. [v] FA `client/renderer/entity/PrehistoricGeoRenderer.java` L36; `AnimationLogic.java` L288-289. +- FA sorts clips into pools by name: names containing "_baby", "_water" or "_air" go to separate pools. A trailing "_N_W" gives a pick weight W. A "!" prefix keeps a clip out of automatic category mapping (e.g. `!run_baby`, `!attack_heavy`). At pick time the baby, water or air pool wins if it is not empty. [v] FA `entity/animation/AnimationHolder.java` L20-62; `AnimationCategory.java` L31-33. +- UP's T-Rex model scales the baby's head bone by 1.5 for juvenile proportions. [v] UP `TyrannosaurusModel.java` L68-79. +- UP ships separate baby animation files for some species (beelze_baby, megalania_baby, baby_mammoth, gigantopithicus_baby) and registers `query.is_baby`. [v] UP assets under `animations/`; `UnusualPrehistory.java` L143. +- JRev scales the T-Rex renderer by a synced animal scale. [v] JRev `entity/client/TyrannosaurusRexRenderer.java` L20; `BrachiosaurusEntity.java` L275. +- FA's swim clip is "keep active" until the animal touches ground, so it does not flicker at the shoreline. [v] FA `AnimationLogic.java` L405-410 (land predicate). +- FA's sleep is 20 ticks with chance 0.05, so a sleeping animal rarely swaps between sleep_1 and sleep_2. [v] FA `AnimationCategory.java` L19. + +### Inferences + +- [inf] The 1 divided by scale speed correction is worth copying for Nublar's growth stages, so baby steps do not slide. +- [inf] FA's long sleep and sit blends (20 ticks against Nublar's 4 to 5) are a cheap way to make lying down read as heavy. + +### Gaps + +- None of the three open mods has a full death clip system comparable to Nublar's `dead` priority; this was not searched further. + +## Key question 6: How are the files authored? + +### Takeaway + +The hand-animated mods are light. FA and UP T-Rex files are 157 to 181 KB, with a median of 46 to 62 keyframes per second and 17 to 23 bones. They lean on sine molang for idle and breathing, plus catmull-rom interpolation. Nublar's baked files are 10 to 35 times bigger and 10 times denser. Only one closed MCreator mod, JWC, is baked at a similar density. Easing in Nublar's T-Rex and Triceratops files is per keyframe, like JWC's. + +### Cited Findings + +Per-file numbers [v], from the stats script on the files named: + +| File | Size | Clips | Max bones per clip | Keyframes per s (median / max) | Notes | +|---|---|---|---|---|---| +| FA tyrannosaurus | 157 KB | 21 | 23 | 46 / 127 | about 730 sine-molang keys; 4 sound and 4 particle events | +| FA stegosaurus | 210 KB | 21 | 39 | 40 / 280 | 1,250 molang keys | +| UP tyrannosaurus_rex | 181 KB | 23 | 17 | 62 / 171 | 1,220 `catmullrom` lerp keys; idle is 5 keys over 8 s plus molang | +| JRev tyrannosaurus_rex | 73 KB | 7 | 30 | 47 / 177 | 1 sound event | +| PFL maip | 426 KB | 39 | 32 | 79 / 330 | mostly easeInOutSine; `anim_time_update` on 9 clips | +| JWC trex | 453 KB | 6 | 35 | 436 / 459 | baked, 114k linear-eased keys across mod | +| NED / Jurassic Additions / Prehistoric Legacy | 16 to 72 KB | 4 to 11 | 11 to 22 | 21 to 82 | MCreator, linear, almost no molang | +| **Nublar tyrannosaurus_rex** | **5,579 KB** | 26 | 91 | **639 / 1,329** | 18,001 eased keys, 548 molang | +| Nublar velociraptor | 1,888 KB | 29 | 112 | 148 / 804 | no easing | +| Nublar brachiosaurus | 1,407 KB | 29 | 37 | 45 / 896 | 9 unused sound events | + +- Naming. FA uses `animation..[_variant][_weight]` with "!" and "_baby" markers. UP uses `animation..` with "_blend", "_start" and "_end" suffixes. JRev uses `anim..`. [v] files above. +- FA's molang is almost all "offset plus sine of anim time" waves. UP adds `math.clamp` on `ground_speed`, `is_on_ground`, `distance_from_camera` and its custom `tail_yaw`. [v] molang scan of both mods' animation folders. +- UP registers extra molang functions: inverse, compare, select, or. [v] UP `UnusualPrehistory.java` L184-187. +- FA notes in a code comment that driving a rider's pitch through a molang variable was "very laggy", so it sets the bone in code. [v] FA `PrehistoricGeoModel.java` L45-47. + +### Inferences + +- [inf] Hand-keyed clips at 30 to 80 keys per second with sine molang for idle look smooth in play and are 30 times smaller. Nublar's baked density costs load time and memory: the T-Rex file alone is 5.5 MB, parsed per resource reload. It does not obviously buy visual quality over FA or UP. +- [inf] A bake-time decimation pass would likely cut Nublar's files by 70 to 90 percent with no visible change. The pass would drop keys that linear interpolation of their neighbours predicts within a small angle error. This needs a test. +- [inf] UP's per-clip "0 keys plus molang" idle and sleep show a cheaper path for new clips: a pose plus breathing molang. + +### Gaps + +- The visual quality of each mod's clips was not judged in-game; only file structure was measured. + +## Key question 7: What do players say about animation quality? + +### Takeaway + +Little direct feedback was found. Store pages for Jurassic Reborn advertise "unique AI, animations, textures, and models" [doc], and Primal Frontier credits a dedicated animator [doc]. Searches of Reddit, Modrinth, Moddex and CurseForge found no threads about animation for FA, UP or JRev. The "Fossils Revived" resource pack restyles FA's creatures and lists Fresh Animations as related [doc], which hints at demand for better FA motion. + +### Cited Findings + +- Jurassic Reborn Modrinth description, animation claim. [doc] modrinth.com/mod/jurassic-reborn +- Primal Frontier Legacy credits "Animators: Deemo". [doc] Modrinth `xkWLBh5U` +- Unusual Prehistory is discontinued in favour of Unusual Prehistory 2, a full remake on its own library. [doc] moddex.gg/mod/unusual-prehistory; [v] UP2 gradle.properties + +### Gaps + +- Player sentiment on animations is effectively unmeasured. Discord channels, which most of these teams use, were not accessible. + +## Techniques Nublar could adopt (ranked) + +1. **Wire a sound and particle keyframe handler.** Source: FA (`Prehistoric.java` L1627-1650). Improves walk and run footsteps (the Brachiosaurus events already exist), eat crunches and roar timing. Effort S. +2. **Turn-driven tail drag.** Steps: body yaw delta, dead zone, low-pass, weighted chain plus counter-roll, added in `setCustomAnimations`. Source: JRev (`BrachiosaurusEntity.java` L228-257, `BrachiosaurusModel.java` L48-102); UP for the lag and decay variant. Improves walk, run, idle and turning for all six species. Effort S. +3. **Per-clip data file: blocks per second and attack `action_delay`.** Source: FA (`ClientAnimationInfoLoader`, `ServerAnimationInfoLoader`). Improves walk and run foot slide tuning, and lines bite damage up with the jaw. Effort S-M. +4. **Phase-preserving speed change on GeckoLib 4.** Re-anchor the tick offset when speed changes. Source: FA (`PausableAnimationController.java` L53-71). Improves walk and run, and lets the gait follow speed exactly. Not needed after the GeckoLib 5 port. Effort S. +5. **Blend un-keyed bones over the controller's transition length.** Source: FA (`AnimationControllerOverride`), or simply raise `getBoneResetTime` to match. Improves transitions between clips with different bone sets (eat, drink, dead). Effort S. +6. **Divide speed by growth scale for babies, and use longer blends for sleep and sit.** Source: FA (`AnimationLogic.java` L288-289; `AnimationCategory.java` L19-21). Improves baby walk, rest and sit. Effort S. +7. **Head look on a dedicated control bone** that no clip keys. Source: UP (`TyrannosaurusModel.java` L63-82). Improves head turning over dense baked head keys. Needs a model edit per species. Effort M. +8. **Overlay bone layer plus a third "gesture" controller,** for roar, bite and sniff while walking. Source: UP (`_overlay` and `_rotation` bone stacks, "_blend" clips). Improves roar and attack during movement. Effort M-L (model and clip rework). FA's additive mixin is the code-only alternative, but it would not survive GeckoLib 5. +9. **Bake-time keyframe decimation.** Source: inferred from FA and UP density versus Nublar. Improves file size and load time for all clips, the T-Rex most. Effort M. +10. **Pause and scrub debug screen for controllers.** Source: FA (`AnimationTab`, `PausableAnimationController`). Improves the clip review workflow. Effort M. +11. **Distance-driven cycles on 26.2,** through `query.limb_swing` in molang or a custom `anim_time_update` reader. Source: PFL files plus GL5 `MolangQueries.java` L323-324. Improves foot sync at any speed. Effort M, best done during the GeckoLib 5 port. diff --git a/research_notes/GeckoLib creature animation survey/procedural_motion_techniques.md b/research_notes/GeckoLib creature animation survey/procedural_motion_techniques.md new file mode 100644 index 00000000..1114be00 --- /dev/null +++ b/research_notes/GeckoLib creature animation survey/procedural_motion_techniques.md @@ -0,0 +1,343 @@ +# Procedural motion techniques from creature mods + +Scope: procedural animation tricks in creature mods that do not use GeckoLib, and in general game-dev sources, that could sit on top of Project Nublar's GeckoLib clips. The goal is dinosaur motion that reacts to turning, speed, slope and targets, instead of the fixed sway Nublar has now. Sources read: Citadel (Alex's Mobs and Alex's Caves helper library), LLibrary, Ice and Fire, a JurassiCraft 2 (1.12) mirror, Dumb-Code's DumbLibrary and its 1.12 Project Nublar, Fossils and Archeology Revival, and Alex's Caves dinosaur models. Written 2026-11-03. Read only. Nothing was built or run. + +Labels: **[v]** = verified in source (repo, commit, path, lines). **[inf]** = my inference. **[doc]** = from an article or documentation page. No code is pasted. All math below is my own wording. + +This note builds on two earlier notes and does not repeat them: +- `research_notes/CHAOS branch IK audit/chaos_ik_audit.md`: FABRIK legs and tail, the step planner, the jitter causes, and the GeckoLib 5 `BoneUpdater` facts. +- `research_notes/Reference mod survey for Beta/alexs_caves_dinosaurs.md`, plus `Multipart entity hitbox systems/citadel_alexs_caves.md` (yaw ring buffer for hitbox chains) and `Reference mod survey for Beta/large_mob_infrastructure_and_vehicles.md` (Citadel `LegSolver` per-leg ground height). + +Path short forms: `CIT:` = `src/main/java/com/github/alexthe666/citadel/`, `IAF:` = `src/main/java/com/github/alexthe666/iceandfire/`, `LL:` = `src/main/java/net/ilexiconn/llibrary/`, `JC2:` = `src/main/java/org/jurassicraft/`, `DL:` = `src/main/java/net/dumbcode/dumblibrary/`, `PN12:` = `src/main/java/net/dumbcode/projectnublar/` (Dumb-Code 1.12 repo), `FA:` = `common/src/main/java/com/github/teamfossilsarcheology/fossil/`, `AC:` = `src/main/java/com/github/alexmodguy/alexscaves/`, `N:` = this repo, `common/src/main/java/net/dumbcode/projectnublar/`. + +## Repository facts + +| Repo | Licence | Branch and commit read | Minecraft | What it has for this topic | +|---|---|---|---|---| +| AlexModGuy/Citadel | No LICENSE file in the repo root [v: root listing]. Treat as all rights reserved. | `1.20`, `8c09dce8a1574d210de72eb0bf5874fe1dc6532e` (2026-01-16), mod 2.6.3 | 1.20.1 | `AdvancedEntityModel` wave helpers, `faceTarget`, `LegArticulator` | +| iLexiconn/LLibrary | LGPL-2.1 [v: LICENSE.md L1-4] | `1.12.2`, `6437a59e2af1edd7e07c9bb4591ea086bd8ad757` (2020-11-19) | 1.12.2 | The original `ChainBuffer` | +| AlexModGuy/Ice_and_Fire | LGPL-3.0 [v: LICENSE L1-2] | `1.20`, `0526aad94119b705a86207623481b087c4d052ca` (2025-09-05) | 1.20.1 | `ChainBuffer`, `IFChainBuffer`, `ReversedBuffer`, dragon pitch | +| Jorch72/JurassiCraft2 (mirror of the JurassiCraft team repo) | LGPL-2.1 [v: LICENSE.md L1-3] | `dev-1.12.2`, `c2631ddbb76e74ba26260ed0ae524b7efc351752` (2018-08-25) | 1.12.2 | Animation passes, tail buffer, biped leg articulation | +| Dumb-Code/DumbLibrary | LGPL-3.0 [v: LICENSE.md L1-2] | `master`, `791ada6afea65e284e4f9e534dd64b15a1815afe` (2022-01-01) | 1.12.2 | Animation layers with fade-out "ghosts", JSON procedural modules | +| Dumb-Code/ProjectNublar | LGPL-3.0 [v: LICENSE.md L1-2] | `master`, `e525ed7b69aaaa9de5234de9875f50d3822a25af` (2021-04-30) | 1.12.2 | Speed factor for walk amplitude | +| TeamFossilsArcheology/FossilsArcheologyRevival | MIT for code [v: LICENSE L1-5] | `1.20.1`, `b400cf2423dc245f3d18c8c60122835d4be5c6e2` (2026-06-07) | 1.20.1 | GeckoLib 4: additive controllers, a reserved `pitch_root` bone | +| AlexModGuy/AlexsCaves | No LICENSE file; `gradle.properties` says LGPL (see the earlier note) | `1.21.1`, `0ab3c214b72c846c2c1ea713a37e2b4b3a00a9f5` (2026-04-26) | 1.21.1 | Tail turn lag, flight pitch and roll, envelopes, two-leg body drop | +| Project Nublar (this repo) | n/a | `claude/minecraft-dinosaur-geckolib-research-mgtpmv`, `bf4ac64eda2d8c2eb37cffa651f02d33aee841ce` (2026-11-03) | 1.20.1, GeckoLib 4.7.3 [v: gradle.properties L47] | Target of the techniques | + +Not read: L_Ender's Cataclysm. I found no public source repo for it (a search found only add-ons). The original `JurassiCraftTeam/JurassiCraft2` URL asked for credentials, so I read a public mirror. Alex's Mobs uses the same Citadel helpers, so it was not read separately. + +--- + +## KQ0. What does Nublar do today, and where can a procedural layer go? + +### Takeaway +Nublar has one procedural layer. It is a fixed cosine sway with no per-animal state. It does not react to turning, speed, slope or targets. It touches only `tail1` to `tail3`, but every species has four or five tail bones. It writes `head`, which the Brachiosaurus does not have (its bone is `head1`). Nublar has no head look at all. Per-animal client state already has a home: `DinoAnimator`, which lives on the entity and gets a client tick. + +### Cited Findings +- [v] `IdleSway` holds six bone names (`hips`, `neck1`, `head`, `tail1`, `tail2`, `tail3`) with fixed pitch and yaw amplitudes and phases. Angles are a cosine of animation time only. N:`entity/dinosaur/animation/IdleSway.java` L13-45. +- [v] `DinosaurGeoModel.setCustomAnimations` calls the parent, skips dead animals, then adds the sway to each bone's current rotation and calls `resetStateChanges` on it. N:`client/model/DinosaurGeoModel.java` L33-63. +- [v] All six species build `DinosaurGeoModel` with the one-argument constructor. N:`client/ClientRegistrationHolder.java` L45-49. [inf] In GeckoLib 4 that constructor sets "turns head" to false, so the head never follows the look direction. No other code in `N:` reads `netHeadYaw` or the head yaw for bones (grep). The renderer only reads the `head` bone pivot for a synced position. N:`client/renderer/DinosaurRenderer.java` L93-97. +- [v] `Dinosaur` holds one `DinoAnimator` per entity and calls `animator.clientTick()` only on the client. N:`entity/dinosaur/Dinosaur.java` L176, L747-748. `DinoAnimator.clientTick` already computes the horizontal move per tick and feeds `MovementGait`. N:`entity/dinosaur/animation/DinoAnimator.java` L78-87. +- [v] `MovementGait` keeps an exponential average of ground speed (weight 0.3 per tick) and sets the leg clip rate. It does not change the clip's amplitude. N:`entity/dinosaur/animation/MovementGait.java` L39-41, L83-118. +- [v] Chain lengths in the geo files (read with a read-only script): + +| Species | Tail chain under `hips` | Neck chain | Head bone | Top bones | +|---|---|---|---|---| +| Brachiosaurus | `tail1`-`tail5` | `neck1`-`neck7` (under `body > shoulder1`) | `head1` | `Root > hips` | +| Dilophosaurus | `tail1`-`tail4` | `neck1`-`neck5` | `head` | `bone > hips` | +| Gallimimus | `tail1`-`tail4` | `neck1`-`neck8` | `head` | `root > hips` | +| Triceratops | `tail1`-`tail4` | `neck1`-`neck2` | `head` | `Root > hips` | +| T. rex | `tail1`-`tail4` | `neck1`-`neck4` | `head` | `root > hips` | +| Velociraptor | `tail1`-`tail4` | `neck1`-`neck5` | `head` | `bone > hips` | + + `tailLower` and `tailUnder` exist but are side bones, not part of the chain. Source: `common/src/main/resources/assets/projectnublar/geo/entity/*.geo.json`. +- [v] The clips animate the top bones in some species. Count of clips that key `root`: T. rex 14 of 26, Gallimimus 5 of 15. `Root`: Brachiosaurus 9 of 29, Triceratops 4 of 23. `bone`: T. rex 15, Dilophosaurus 8, Velociraptor 8. Nearly every clip keys `hips`, `neck1` and the tail bones. Source: `.../animations/entity/*.animation.json`. + +### Inferences +- [inf] Every technique below must be additive. No Nublar bone is free of keyframes, so an absolute write would erase the artist's motion. The current pattern (read the post-controller value, add a delta, clear the changed flags) is correct and should be reused. +- [inf] A procedural root bone (the Fossils pattern, KQ6) would need a new empty parent bone above `root`/`Root`/`bone` in each geo file. This is an art-pipeline change, not a code change. +- [inf] Per-animal state should live in a small client-only object owned by `DinoAnimator`, created lazily on the first client tick. The shared `GeoModel` gets it through the `animatable` argument. Ice and Fire also creates its buffers only on the client [v: IAF:`entity/EntityDragonBase.java` L250-256]. + +### Gaps +- Not checked in game whether the four-bone tail clips already have enough sway that an extra delta looks doubled. + +--- + +## KQ1. Tail and neck lag after a turn (rate-limited follower) + +### Takeaway +This is the strongest single idea. Keep a "tail yaw" per animal that chases the body yaw at a capped speed. Draw the tail rotated by the difference between the two. When the animal turns, the tail swings out and then catches up. Alex's Caves does this for the Vallumraptor and the Subterranodon with one float and its previous value. + +### Cited Findings +- [v] Vallumraptor keeps `tailYaw` and `prevTailYaw`, both set to the yaw at spawn. AC:`server/entity/living/VallumraptorEntity.java` L99-106. Each tick it saves the previous value (L191) and moves `tailYaw` toward `yBodyRot` by at most 8 degrees, with angle wrap (L315). A getter lerps previous to current by partial tick (L359-360). +- [v] The model lerps body yaw by partial tick, takes the wrapped difference "tail yaw minus body yaw", and turns it into radians. AC:`client/model/VallumraptorModel.java` L469-470. It adds 0.8 of it to `tail` and 0.2 to `tailTip` (L585-586). +- [v] Subterranodon uses the same follower at 8 degrees per tick (AC:`server/entity/living/SubterranodonEntity.java` L81-82, L179, L405) and the same 0.8 / 0.2 split (AC:`client/model/SubterranodonModel.java` L155-156, L225-226). +- [v] The same lag idea drives Alex's Caves hitbox chains through a ring buffer of past yaws. That is already covered in `Multipart entity hitbox systems/citadel_alexs_caves.md`. + +### Inferences +Math, in my words: +1. State per animal: `tailYaw`, `prevTailYaw` (degrees). Neck: `neckYaw`, `prevNeckYaw` if wanted. +2. Client tick: `prevTailYaw = tailYaw`. Then `d = wrapDegrees(bodyYaw - tailYaw)`. Then `tailYaw += clamp(d, -maxStep, +maxStep)`. +3. Render frame, with partial tick `p`: `t = lerp(p, prevTailYaw, tailYaw)`, `b = lerp(p, yBodyRotO, yBodyRot)`, `lag = wrapDegrees(t - b)`. +4. Clamp `lag` to a species limit, for example ±40 degrees. +5. Split `lag` over the chain with weights `w_i` that sum to 1. Each bone gets `rotY_i += -lag * w_i` (sign per GeckoLib's axis flip; the current sway already negates Bedrock angles). + +Constants to start from: +- `maxStep`: about 8 degrees per tick for raptor-sized animals (the Alex's Caves value). Larger animals should lag more: try 4 to 5 for the T. rex and the Triceratops, and 3 for the Brachiosaurus. +- Weights for a four-bone tail: about 0.4, 0.3, 0.2, 0.1. Child bones inherit parent rotation, so the tip already moves the most. A bigger weight near the base keeps the curve smooth. +- Neck: run the same follower with the head yaw as the goal and a faster step (about 12). Spread it over the neck chain. This gives a neck that leads and a tail that trails. + +Where it runs: the step runs on the client tick. The lerp and the bone write run per frame. Cost: two floats per chain per animal, one wrap and a clamp per tick, and four to eight bone adds per frame. No allocation. + +GeckoLib fit: add after the controllers, like `IdleSway`. In 4.x, inside `setCustomAnimations`, reading the state from `animatable`. In 5.x, copy `lag` into the render state during extraction (a `DataTicket`), then add it in a `BoneUpdater`. + +- [inf] The rate limiter gives a linear, slightly robotic catch-up. A critically damped spring (KQ8) on the same `tailYaw` gives an eased catch-up. An under-damped spring gives a whip with one overshoot. Both cost one more float. +- [inf] Lerping `prevTailYaw` to `tailYaw` without wrap is safe only while both stay near the body yaw. Store them unwrapped next to `yBodyRot`, as Alex's Caves does, or wrap the difference before the lerp. + +### Gaps +- The best `maxStep` per species needs an in-game test. + +--- + +## KQ2. The ChainBuffer family (accumulate, hold, decay) + +### Takeaway +LLibrary's `ChainBuffer` was the JurassiCraft 2 tail swing and is still in Ice and Fire. It sums the body's turn into a "variation" angle, holds it for a few ticks, then walks it back to zero in fixed steps. The total is spread evenly over the chain. It works, but it is jerkier than KQ1 and the Ice and Fire copies have two bugs. Use KQ1 with a spring instead. Keep this section as history and as a warning. + +### Cited Findings +- [v] LLibrary original. Each tick: save the previous variation. If the body yaw changed and the variation is under `maxAngle`, add "old body yaw minus new body yaw, divided by `divisor`". If the variation is above 0.7 × `angleDecrement` (or below the negative), count a timer. Once the timer passes `bufferTime`, subtract `angleDecrement` per tick toward zero. Snap to zero and reset the timer when it gets inside one step. The pitch version is the same on `rotationPitch`. LL:`client/model/tools/ChainBuffer.java` L43-69, L80-105. +- [v] Apply step: lerp previous to current variation by partial tick, convert to radians, divide by the number of boxes, and add the same amount to every box's Y (swing) or X (wave). LL:`.../ChainBuffer.java` L137-150. +- [v] JurassiCraft 2 dinosaurs used `maxAngle` 68, `bufferTime` 3, `angleDecrement` 7. JC2:`server/entity/DinosaurEntity.java` L164, L307, L1109-1111. The T. rex animator applies it to its seven tail boxes after all other procedural motion. JC2:`client/model/animation/entity/TyrannosaurusAnimator.java` L45, L72. +- [v] Ice and Fire dragons, on the client only: neck `turn_buffer` (50, 0, 4), `tail_buffer` (90, 20, 5). In the air: roll (55, 1, 2, divisor 0.5), tail pitch (90, 10, 1, 0.5), body pitch (80, 10, 1, 0.5). IAF:`entity/IafDragonLogic.java` L291-299. They are applied to the neck only while breathing fire, to the tail and body when not a passenger, and the flight buffers only while flying or hovering. IAF:`client/model/animator/DragonTabulaModelAnimator.java` L130-141. +- [v] Bug 1: Ice and Fire's `ChainBuffer` adds a second gate. It only adds the turn when the body yaw changed by less than 0.1 degree in that tick. IAF:`entity/util/ChainBuffer.java` L37. The LLibrary original has no such gate (LL L45). +- [v] Bug 2: Ice and Fire's wave apply reads the yaw variation, not the pitch variation. IAF:`entity/util/ChainBuffer.java` L145-150 and `client/model/IFChainBuffer.java` L255-260. LLibrary reads pitch there (LL L149-150). +- [v] `IFChainBuffer` replaces the equality test with a test that treats a difference of about 1.0 as "no change" (IAF:`client/model/IFChainBuffer.java` L31-34, L47). It also clamps each tick's add to ±`maxAngle` (L48). Its swing decay snaps to `angleDecrement` instead of zero (L53-55, L63-65), so the swing never fully returns. +- [v] `ReversedBuffer` is the LLibrary logic with the sign flipped at apply time. IAF:`entity/util/ReversedBuffer.java` L32-58, L126-131. + +### Inferences +- [inf] Bug 1 means the Ice and Fire dragon tail almost never collects a turn: any real turn is more than 0.1 degree per tick. The dragon tail swing is close to dead in 1.20. +- [inf] Bug 3 in all copies: the yaw delta is not wrapped. A yaw that jumps across a 360 boundary (teleport, or a mob whose yaw was reset) adds a huge step in one tick, because the `maxAngle` test runs before the add. +- [inf] The hold-then-linear-decay shape gives a visible "stick, then tick back" motion. Even spreading also means the base bends as much as the tip, which looks stiff on long tails. KQ1 with weights fixes both. +- [inf] Cost is the same as KQ1: two floats and an int per axis. + +### Gaps +- Not run, so the bug effects are read from the code only. + +--- + +## KQ3. Travelling waves along a chain (chainSwing, chainWave, walk, bob) + +### Takeaway +Citadel's chain helpers turn one cosine into a wave that runs down a chain, with a phase step per bone. Driven by walk distance, the same wave becomes a gait-locked tail or neck sway that grows with speed. Nublar's `IdleSway` hand-writes the phases for six bones. A chain helper would cover the real chain lengths (four or five tail bones, two to eight neck bones) with three numbers per chain. + +### Cited Findings +- [v] Chain wave. Phase step per bone = `rootOffset × π / (2 × N)`, where N is the chain length. Bone `i` gets `cos(t × speed + i × step) × amount × degree` added to one axis: Y for swing, X for wave, Z for flap. A global "movement scale" multiplies speed and degree. CIT:`client/model/AdvancedEntityModel.java` L77-124. +- [v] Single-bone helpers. `walk`, `swing` and `flap` add `cos(t × speed + offset) × degree × amount + weight × amount` to X, Y or Z, with an optional sign flip. CIT:`client/model/AdvancedModelBox.java` L309-361. `weight × amount` is a speed-dependent constant lean. +- [v] Bob moves the pivot up and down: `sin(t × speed) × amount × degree − amount × degree`. The "bounce" form uses `−|sin(...)| × amount × degree`, which gives two dips per cycle (one per footfall). CIT:`client/model/AdvancedModelBox.java` L369-378. +- [v] Callers pass either walk distance and walk speed (`limbSwing`, `limbSwingAmount`) or age in ticks with amount 1. The Ice and Fire dragon stacks a walk-driven tail swing and wave with an idle-driven one. IAF:`client/model/animator/DragonTabulaModelAnimator.java` L103-114. The JC2 T. rex does the same on its tail, body and arms. JC2:`client/model/animation/entity/TyrannosaurusAnimator.java` L55-68. +- [v] The Tremorsaurus mixes walk-driven body swing, tail swing, leg walk and a "bounce" body bob, then subtracts the bob from the legs so the feet stay down. AC:`client/model/TremorsaurusModel.java` L363-401. +- [v] DumbLibrary planned JSON modules for the same helpers (`Bob`, `ChainSwing`, `Facing`) with `speed`, `degree`, `root_offset` and `divisor` fields. Their bodies are commented out. DL:`server/json/objects/animation/ChainSwing.java` L20, `Facing.java` L20, `Bob.java` L20-22. + +### Inferences +Math for Nublar, in my words: +1. Inputs per frame: a phase `φ` and an amount `a` in [0, 1]. For idle, `φ` = animation seconds and `a` = 1. For walking, `φ` = the leg clip's phase, and `a` = the smoothed speed over the authored speed, clamped to [0, 1]. +2. For chain bone `i` of `N`: `angle_i = A × a × cos(2π × f × φ + i × k)`, with `k` = the per-bone phase lag in radians. `k` around 0.5 to 0.8 gives a visible wave down a four-bone tail. +3. Add `angle_i` to the bone's yaw (sideways) or pitch (up-down). +4. Optional: scale `A` by `i / N` so the base moves less. This matches how a heavy tail swings. + +Gait lock: the leg clip's phase is the only safe walk clock. The vanilla `walkAnimation.position` drifts from GeckoLib's clip time. Nublar can compute the phase as "controller animation tick × speed, modulo cycle length", from the `MovementGait` values. [inf] + +Cost: one cosine per bone per frame. That is the same as `IdleSway` now. No per-animal state for idle. The walk version reads two values already in `MovementGait`. + +GeckoLib fit: the walk and run clips already have tail motion. The wave should be small (a few degrees) and mostly fill the bones the clip leaves still, or add the side-to-side sway the clip lacks. Check per species which axes the clips key before choosing amplitudes. + +- [inf] Replace `IdleSway`'s six fixed bones with per-species chain lists read from the model once. This fixes the `head1` miss on the Brachiosaurus and the untouched `tail4`/`tail5`. + +### Gaps +- Which axes the Nublar walk clips already key on each tail bone was not tabulated. + +--- + +## KQ4. Look-at spread over the neck, with clamps + +### Takeaway +Citadel's `faceTarget` turns the head toward the look direction by sharing the angle over several bones. JC2 spreads the T. rex look over chest, two neck bones and the head. Nublar has no head look today. A clamped, smoothed and weighted version would make animals track players and prey. + +### Cited Findings +- [v] `faceTarget(yaw, pitch, divisor, bones...)`: each bone gets `yaw / (divisor × N)` and `pitch / (divisor × N)` added, in radians. CIT:`client/model/AdvancedEntityModel.java` L57-65. With divisor 1, the full angle is reached at the last bone. +- [v] JC2 T. rex: divisor 1.5 over `chest`, `Neck1`, `Neck5`, `Head`, so the head reaches two-thirds of the look angle. JC2:`client/model/animation/entity/TyrannosaurusAnimator.java` L70. Tremorsaurus: divisor 1 over `neck` and `head`. AC:`client/model/TremorsaurusModel.java` L401. +- [v] Nublar already limits the head yaw on the entity side with `rotateIfNecessary` against the body. N:`entity/dinosaur/DinoBodyRotationControl.java` L32. + +### Inferences +Math, in my words: +1. Inputs per frame: `yawTarget = wrapDegrees(lerp(p, yHeadRotO, yHeadRot) − lerp(p, yBodyRotO, yBodyRot))` and `pitchTarget = lerp(p, xRotO, xRot)`. +2. Clamp: yaw to about ±50 (±30 for the Triceratops, which has a two-bone neck and a heavy frill), pitch to about ±25. +3. Smooth per animal with a critically damped spring (KQ8) on the client tick, half-life about 3 ticks. The vanilla look target can jump when the target changes. The spring stops the snap. +4. Weights over the chain, sum 1, growing toward the head. For the Gallimimus eight-bone neck: small weights on `neck1`-`neck4`, more on `neck5`-`neck8` and the head. For the T. rex: `neck1` 0.15, `neck2` 0.2, `neck3` 0.2, `neck4` 0.2, `head` 0.25. +5. Multiply by a layer weight `L` in [0, 1] that fades the look out while a clip owns the head (eat, drink, roar, attack, sleep). See KQ5. +6. Add `yaw × w_i × L` to each bone's yaw and `pitch × w_i × L` to its pitch. + +Cost: two floats plus velocity per axis per animal (four floats), one spring step per tick, and two adds per neck bone per frame. + +GeckoLib fit: additive after controllers, as above. Do not use GeckoLib 4's built-in "turns head", which writes only the `head` bone and does not fade during clips. [inf] + +### Gaps +- Head-yaw sync: `yHeadRot` on the client follows the server's look control. Whether it is smooth enough for Nublar's large animals was not checked. + +--- + +## KQ5. Layer weights and blend-outs (envelopes, ghosts, pose easing) + +### Takeaway +Procedural layers need a weight that rises and falls with the clips, or they fight them. Alex's Caves scales procedural motion by a sine envelope over a one-shot's ticks. DumbLibrary fades a removed animation's last pose over 7.5 ticks. JC2 eases pose-to-pose with a sine. For Nublar, a per-layer weight with a short ramp is the piece that makes KQ1 to KQ4 safe. + +### Cited Findings +- [v] Alex's Caves envelope: take the animation tick plus partial tick, minus a start offset, clamped to [0, end]. The weight is `sin(π × t / end)` times an amplitude, then a smooth minimum with 1 (softness 0.1) so it plateaus. AC:`server/misc/ACMath.java` L47-60. The Tremorsaurus uses it to scale the roar head shake and the prey shake. AC:`client/model/TremorsaurusModel.java` L316-330. +- [v] Smooth minimum of `a` and `b` with softness `k`: `h = max(k − |a − b|, 0) / k`, result `min(a, b) − h² × k / 4`. AC:`server/misc/ACMath.java` L47-50. +- [v] DumbLibrary: when an animation is removed, each cube's pose at that moment is stored as a "ghost". Each frame the ghost adds `(ghostPose − defaultPose) × c` to the cube, with `c = 1 − (age since removal) / 7.5 ticks`. Ghosts with `c ≤ 0` are dropped. DL:`server/animation/objects/AnimationLayer.java` L56-77, L94-120. +- [v] JC2 animation passes: each pass moves the parts from the previous pose toward the next pose by a factor. With inertia on, the factor is `sin(π × (t/T − 0.5)) × 0.5 + 0.5`, an ease-in-out. On a pose change, the reached offset is kept, so an interrupted move starts from where it was. JC2:`client/model/animation/AnimationPass.java` L97-105, L173-191, L265-275. + +### Inferences +- [inf] GeckoLib already blends clip to clip (Nublar uses 2 to 5 ticks, N:`DinoAnimator.java` L38-44). The gap is between clips and procedural layers. Give each layer (look, tail lag, sway, lean) a weight per animal. Each tick, move it toward 1 or 0 by `1 / rampTicks`. Lerp it by partial tick at render. Targets come from state that `DinoAnimator` already knows: eating, drinking, attacking, the one-shot action, resting, dead. +- [inf] Use a smoothstep on the ramp (`3x² − 2x³`) so the start and end are soft. Ramp 4 to 6 ticks. +- [inf] A DumbLibrary-style ghost is an inertialization: keep an offset at the switch and decay it. Holden's article does this with a spring decay instead of a straight line [doc]. GeckoLib's own transition does most of this for clips. It is not needed unless procedural layers are switched on and off hard. +- [inf] Cost: one float and its previous value per layer per animal. + +### Gaps +- None for the math. The list of which clips own which bones per species needs a pass over the animation files. + +--- + +## KQ6. Body pitch and roll from motion (slope, climb, turn lean, acceleration) + +### Takeaway +Flying mods tilt the body from vertical speed and roll it into turns. The same math gives land dinosaurs a lean into turns, a nose-down on slopes and a small rock on start and stop. Fossils writes its flight pitch to a bone that no clip touches, so it can set it outright. + +### Cited Findings +- [v] Ice and Fire dragon pitch (server, synced): while in the air and not hovering, add 10 × vertical delta per tick, then clamp to [−60, 40]. Above ±2 degrees, decay toward zero by `planeSpeed × |pitch| / 90`, where `planeSpeed = 6 × (|vx| + |vz|)`, plus 1 degree per tick. On the ground, divide by 1.5 per tick, then snap to 0 under 1 degree. IAF:`entity/EntityDragonBase.java` L2202-2240. The previous value is saved each tick (L1721). The renderer lerps it by partial tick and rotates the whole pose stack. IAF:`client/render/entity/RenderDragonBase.java` L48-52. +- [v] Subterranodon (client and server tick): flight pitch moves toward `−clamp(vy, −1, 1) × 57.3` degrees at up to 10 per tick. Roll changes by 10 per tick while the yaw changes by more than 1 degree in a tick. It decays by 5 per tick otherwise, clamped to ±60. AC:`server/entity/living/SubterranodonEntity.java` L77-80, L177-178, L310, L384-404. The model lerps both, scales roll by fly progress and pitch by fly progress minus hover progress, and adds them to the body bone. AC:`client/model/SubterranodonModel.java` L153-154, L223-224. +- [v] Fossils (GeckoLib 4): when swimming or flying, `setCustomAnimations` sets the `pitch_root` bone's X rotation to the lerped entity pitch. For a ridden flyer it also sets Z from a lerped roll. FA:`client/model/PrehistoricGeoModel.java` L30-52. + +### Inferences +Land version for Nublar, in my words: +1. Inputs per client tick: body yaw change `dYaw = wrapDegrees(yBodyRot − yBodyRotO)`, smoothed ground speed `s` (from `MovementGait`), forward acceleration `acc = s − sPrev`, and slope `dy` (vertical move per tick while on ground). +2. Turn lean (roll): `rollGoal = clamp(−kRoll × dYaw × s / sRun, −8, 8)` degrees. A turning animal leans in, more when fast. +3. Slope pitch: `pitchGoal1 = clamp(−kSlope × atan2(dy, s), −15, 15)`, only when `s` is above the walk threshold. +4. Acceleration rock: `pitchGoal2 = clamp(kAcc × acc, −5, 5)`. Nose dips when stopping, rises when starting. Large animals should get a smaller value. +5. Smooth each goal with a critically damped spring on the client tick (half-life 3 to 5 ticks). Use an under-damped spring for the acceleration rock if a settle is wanted. +6. Render: lerp by partial tick and add to `hips` (pitch and roll) or to a new procedural root bone. Counter-rotate `neck1` by part of the pitch so the head stays level (the Citadel leg articulator does this too, KQ7). + +Cost: six floats per animal, three spring steps per tick, two bone adds per frame. + +GeckoLib fit: `hips` is keyed by nearly every clip, so add, do not set. A Fossils-style empty parent bone above `root` would let the lean be an absolute write and keep it apart from clip motion. That needs a geo edit in all six models. [inf] + +- [inf] Do not sync these values. They come from motion the client already sees. Ice and Fire syncs dragon pitch because it also drives server-side flight logic. + +### Gaps +- Client motion arrives in three-tick pieces (N:`MovementGait.java` L9-11). The acceleration term will be noisy without the speed average Nublar already keeps. Use the averaged speed, not the raw per-tick move. + +--- + +## KQ7. Cheap ground fitting without full IK (leg articulator, smooth body drop) + +### Takeaway +Before going to the CHAOS FABRIK system, there is a cheap step. Citadel's leg articulator, from JurassiCraft 1, reads one ground height per leg and turns it into a body drop, a body tilt, and a simple bend of thigh and calf. Alex's Caves drops a biped's body with a smooth minimum of the two legs. The per-leg height source (`LegSolver`) is in the earlier large-mob note. + +### Cited Findings +- [v] Quadruped: if any leg height is above zero, take the back pair average and front pair average. Body length is the distance between the pairs' forward offsets. Tilt = `atan2(bodyLength × scale, backAvg − frontAvg) − π/2`. Drop the body by `16 / scale × backAvg` pixels. Add the tilt to the body. Subtract it from the lower body, front thighs and neck. CIT:`client/model/LegArticulator.java` L15-37. +- [v] Leg pair: the lower leg (smaller height) gets its thigh rotated back and calf forward by the height difference times per-joint factors. Its foot is rotated to stay flat. CIT:`client/model/LegArticulator.java` L40-52. Ice and Fire dragons use thigh, calf and foot factors 1.0, 0.5, 0.5 behind and −0.15, −0.15, 0 in front, only for wide dragons on the ground. IAF:`client/model/animator/DragonTabulaModelAnimator.java` L143-151. +- [v] JC2 biped: drop the waist by the average height. Factors 0.4 and 0.4 for the T. rex. The leg solver exists only on the client. JC2:`client/model/animation/entity/LegArticulator.java` L14-23; `TyrannosaurusAnimator.java` L50-53; `server/entity/DinosaurEntity.java` L210, L1101-1104. +- [v] Tremorsaurus: body drop = `(1 − smoothMin(1 − hLeft, 1 − hRight, 0.1)) × 0.8`, in blocks, times 16 for pixels. Each leg is then offset by its own height minus that drop. AC:`client/model/TremorsaurusModel.java` L414-421. + +### Inferences +- [inf] For Nublar, the leg-height step runs on the client tick (one or two block reads per leg). The bone adds run per frame with the partial-tick lerp of each height. This avoids the 20 Hz foot jumps the CHAOS audit lists. +- [inf] The smooth minimum stops the body from popping when one foot crosses a block edge. +- [inf] Cost per animal: per tick, two (biped) or four (quadruped) small block reads. Per frame, about ten bone adds. State: one height and its previous value per leg. +- [inf] Bone map: bipeds `hips`, `thighLeft`/`thighRight`, `calfLeft`/`calfRight`, `footLeft`/`footRight`. Quadrupeds (Triceratops, Brachiosaurus) also have `forearm*` and `foot*Front`, and `body` for the tilt. The Velociraptor's right thigh is named `legUpperRight`, not `thighRight` (geo file), so a name table per species is needed. + +### Gaps +- Leg forward offsets per species are not in the geo files as data. They would be read from the bone pivots. + +--- + +## KQ8. The smoothing primitive: critically damped springs + +### Takeaway +Every technique above needs a smoother. The mods use "approach by a fixed step" or "divide by 1.5 per tick". A critically damped spring is better. It eases in and out, never overshoots, has one tuning number (half-life), and can be stepped exactly for any time step. + +### Cited Findings +- [doc] Exact critically damped spring. With half-life `h`, set `y = 2 ln 2 / h`. Toward goal `g` with time step `dt`: `j0 = x − g`, `j1 = v + j0 × y`, `e = exp(−y × dt)`. Then `x = e × (j0 + j1 × dt) + g` and `v = e × (v − j1 × y × dt)`. A cheap form of `exp(−u)` is `1 / (1 + u + 0.48u² + 0.235u³)`. Two springs in series, each with half the half-life, give an S-shaped response. The same decay on an offset gives inertialization. Daniel Holden, "Spring-It-On", https://theorangeduck.com/page/spring-roll-call +- [v] Nublar's speed average is a first-order exponential with weight 0.3 per tick. N:`MovementGait.java` L39-41, L84. + +### Inferences +- [inf] Step springs on the client tick with `dt = 1`. Keep the previous `x` and lerp by partial tick at render. This matches how Nublar already treats tick state, keeps cost fixed per tick, and stops at pause. `e` is a constant per half-life, so it can be computed once per species. +- [inf] Under-damped variant, for whip or settle: a damped oscillator with damping ratio about 0.5. Use only for tail tips and the acceleration rock. +- [inf] Cost: two floats per channel, a few multiplies per tick. + +### Gaps +- None. + +--- + +## KQ9. Clip-level tools: speed-scaled amplitude and additive controllers + +### Takeaway +Two older ideas work at the clip level. Dumb-Code's 1.12 Nublar and JC2 scaled the walk clip's amplitude by speed, so a slow walk has small steps. Fossils patched GeckoLib 4 so that controllers add to each other instead of the last one winning. Nublar already speed-matches the rate. Amplitude scaling is a small extra. The additive-controller mixin is powerful but ties Nublar to GeckoLib 4 internals. + +### Cited Findings +- [v] Dumb-Code 1.12 Nublar: the walk "angle" factor is the interpolated speed × 11, clamped to at most 1. PN12:`server/animation/AnimationFactorHandler.java` L9-17. +- [v] JC2 movement pass: for walk, run, swim and climb, the degree is the limb swing amount (×4 in water), clamped to [0.5, 1] while moving. Standing uses speed 3 for the blend back. JC2:`client/model/animation/MovementAnimationPass.java` L19-38. +- [v] JC2 kept per-animal pass state in a weak map from entity to handler, per growth stage, inside the shared animator. JC2:`client/model/animation/EntityAnimator.java` L19-38. +- [v] Fossils: a mixin on GeckoLib's `AnimationProcessor` routes models that carry a marker interface to a replacement loop. FA:`mixin/AnimationProcessorMixin.java` L40-49. The loop runs all controllers, then for each bone adds each controller's value to the previous one. Only the first controller starts from the bone's initial pose. FA:`compat/geckolib/AnimationProcessorOverride.java` L21-90. + +### Inferences +- [inf] Amplitude scaling on GeckoLib 4: after controllers, for leg bones only, set `rot = rest + (rot − rest) × k`, with `rest` from the bone's initial snapshot and `k = clamp(s / sWalk, 0.5, 1)`. This needs a list of leg bones per species. It must be skipped during the blend into idle, or it will fight the transition. Effort M. +- [inf] The Fossils mixin would let Nublar play a head-only or tail-only clip on top of the body clip. On GeckoLib 5 the same is native: the earlier rendering note says a second controller is additive there. Do not take the mixin for 4.x if the 26.2 port is close. +- [inf] JC2's weak map is the pattern to avoid. Nublar's `DinoAnimator` on the entity is simpler and is already in place. + +### Gaps +- Not checked whether GeckoLib 4.7.3 has the same `AnimationProcessor` method Fossils targets. Fossils' GeckoLib version was not read. + +--- + +## KQ10. How the layers sit on GeckoLib 4 and 5 + +### Takeaway +One order works for all layers: controllers first, then procedural deltas, each times its layer weight. In 4.x this is `setCustomAnimations`. In 5.x it is a `BoneUpdater`, with the per-animal values copied into the render state first. + +### Cited Findings +- [v] GeckoLib 5 `BoneUpdater`s add to bone snapshots after the controllers, in a fixed order. Per-pass data comes from the render state. Covered in `Reference mod survey for Beta/client_rendering_and_animation.md` (Bone updaters section) and the CHAOS audit (Porting section). +- [v] Nublar 4.x write pattern: read the current rotation, add, clear changed flags. N:`client/model/DinosaurGeoModel.java` L46-62. + +### Inferences +Frame order for Nublar (numbered): +1. Client tick (`DinoAnimator.clientTick`): update the gait (existing), the layer weights, tail and neck followers, the look spring, the lean springs, and the leg heights. Save each previous value first. +2. Frame, after controllers: compute the partial-tick lerp of each value. +3. Add, in this order: leg fitting (KQ7), body lean (KQ6), look (KQ4), tail and neck lag (KQ1), chain sway (KQ3, replacing `IdleSway`). +4. Clear changed flags on each written bone, as now. +5. 26.2 port: in the extraction stage, copy about 12 floats per animal into a `DataTicket`. Step 3 moves into one `BoneUpdater`. Step 4 is not needed. + +- [inf] Distance cut: skip steps 1 to 3 past about 32 blocks, as the hitbox budget suggests. Below that, the whole stack is under 30 bone adds and about 10 trig calls per animal per frame. +- [inf] Keep the procedural state on the client object only. The server never needs it. Do not allocate it on the server: `DinoAnimator` is created on both sides today (N:`Dinosaur.java` L176), so the new state object should be created lazily inside `clientTick`. + +### Gaps +- The order of steps 3a to 3e was chosen by reasoning, not tested. + +--- + +## Techniques Nublar could adopt (ranked) + +| Rank | Technique | Source | Bones and species it improves | Effort | Per-animal state | +|---|---|---|---|---|---| +| 1 | Tail and neck turn lag: rate-limited or spring follower of body yaw, weighted over the chain | Alex's Caves Vallumraptor, Subterranodon (KQ1) | `tail1`-`tail4/5` all species; neck chain for Gallimimus, Brachiosaurus, Dilophosaurus, Velociraptor | S | 2-4 floats per chain | +| 2 | Clamped, smoothed look-at spread over neck and head, faded during clips | Citadel `faceTarget`, JC2 T. rex (KQ4) | `neck1`-`neckN`, `head`/`head1`; all species, most for long necks | S-M | 4 floats + 1 layer weight | +| 3 | Layer weights with smoothstep ramps tied to `DinoAnimator` states | Alex's Caves envelope, DumbLibrary ghosts (KQ5) | Every procedural layer | S | 1-2 floats per layer | +| 4 | Critically damped spring helper (pure class, like `MovementGait`) | Holden (KQ8) | Used by 1, 2, 5 | S | 2 floats per channel | +| 5 | Chain-wave idle and gait-locked sway from chain lists; replaces `IdleSway` and fixes the `head1` and `tail4/5` misses | Citadel chain helpers (KQ3) | All tails; long necks; Brachiosaurus head | S | None for idle; walk uses gait phase | +| 6 | Body lean into turns, slope pitch, acceleration rock on `hips`, with neck counter-rotation | Ice and Fire pitch, Subterranodon roll (KQ6) | `hips`, `neck1`; most visible on T. rex, Triceratops, Brachiosaurus | M | 6 floats | +| 7 | Ground fitting: body drop and leg bend from per-leg height, smooth minimum for bipeds | Citadel / JurassiCraft 1 articulator, Tremorsaurus (KQ7) | `hips`/`body`, thighs, calves, feet; all species on uneven ground | M | 2 floats per leg | +| 8 | Speed-scaled walk amplitude for slow walks | Dumb-Code 1.12, JC2 (KQ9) | Leg bones; all species at herd-travel speed | M | None (reads `MovementGait`) | +| 9 | Additive controllers for partial-body clips | Fossils mixin (KQ9) | Head or tail one-shots over body clips | L on 4.x, S on 5.x | None | +| - | Do not port | `ChainBuffer` family (KQ2) | - | - | - | + +Ranks 1 to 5 together are under 300 lines of pure, testable code, plus about 40 lines in `DinosaurGeoModel`. [inf]