Moondog, day 16 (5 Nov): combat with weight, and creatures with senses

82 commits. Around fifty of those were creature models, reworked one at a time. The rest rebuilt how fighting and sneaking work.

Melee, reworked

Before, melee was a timed click. Now:

  • Weapon classes (15 of them, picked from what's in both hands): dual daggers, shield pairings, two-handers that take the off hand.
  • Hold to charge. A tap hits for 50%, a full charge for 100%. The server keeps the time.
  • A three-strike combo. Press in the last 30% of a swing to chain strikes for x1.0, x1.15 and x1.4. A fully charged third strike staggers, depending on the creature's size.
  • Contact hits. The client sweeps the live arc of the weapon and reports what it touched. The server checks timing, reach, arc and cleave.
  • Swing length comes from Agility, and stamina per swing from weapon, charge and Strength.

Along with it, E now only interacts with what's under the crosshair. The old "nearest thing" fallback kept picking the wrong target in a crowded village.

Fighting back

Creature attacks now warn you first. A windup clip plays, stretched to the creature's warning time (0.5–1.1 s by size), and the blow only lands if you're still in reach and in front. Some attacks are heavy: a longer warning, 1.8x the damage, and they break a block.

Hold right mouse to block. It stops a share of the hit depending on what you're holding (a shield blocks most, bare hands very little), at a cost in stamina. Raise the block within a quarter second of the blow and it's a parry: nothing gets through, and the creature staggers. Dodging and hit sounds came in too, along with crouching and lying prone.

To make sizes mean something I measured every creature's model against the player. Rabbits and crows are small, wolves medium, bears and horses large, the stegosaurus huge.

Stealth

Stage one: creatures see, hear and smell. Each has a sight range and cone, hearing, smell, and whether it sees in the dark. Rather than aggroing on a radius, a creature builds awareness of you. A suspicious one turns and investigates where it sensed you, an alerted hunter attacks, and prey flees. Noise from fights and shots draws creatures in, and pack animals call their own. Stance, darkness, carried light, rain and a new Stealth skill all count. Sneak attacks on an unaware creature do double damage.

Stage two: tall grass. The server reads painted grass into 1 m cover squares at start. Crouched in grass you're much harder to see, and prone even more so.

Models

A long run of creature assets, each in its own commit: house cats in four coats, kestrel, lynx, red panda, skunk, and a lot of yōkai (kappa, tengu, nekomata, nue, rokurokubi, yuki-onna and more), plus the odd Jersey Devil and Mothman. Fourteen in-game creatures got full combat clips with the events that play them. I also split the old batch model scripts so every model has a file of its own, and restored four detailed bodies a batch run had flattened.

Fixes

Login froze the client for 2.5–5.3 s, which the 3-second stall watchdog read as a dead server, so it dropped a healthy connection and redialled. Login now happens behind an "Entering the world..." cover with the watchdog off, and long frames no longer count as server silence. On reconnect, the old player node was still in the tree, so the network code kept steering the old body while the camera followed the new one. Now the old one is removed first.