1,835 Commits over 792 Days - 0.10cph!
Hook up livestock coats, not yet gene driven, tested networking, saving, corpses, babies
Cherry pick 163070: Fix gen2 AI never updating its position in the brain grid, causing some brain based spatial query to be stale
Add transparent layer to new navmesh bake, unity navmesh parity, else it ignores fences and npcs go through
Reduce minRegionSizeMeters for navmesh to not nuke small regions, fixing "no navmesh on bandit watch towers", need a better fix in the future
Fix scientists going through unopenable doors (new navmesh, the puzzle doors)
Fix gen2 AI never updating its position in the brain grid, causing some brain based spatial query to be stale
- Old cows will go to sleep and die peacefully, instead of player the combat death anim when dying of old age
- Cows get slower as they age, they also stay closer to home
- Cows can lie down just to chill, old cows chill more than normal
- When night falls, cows regroup and sleep together, some cows are early risers and some like to wake up late
- Hook sheep and lamb corpses
- Hook the death anims with forward momentum that are played when animals are killed while they are running
- Fix ai.fillHungerlivestock doing the opposite of what it says
- Fix cows never getting hungry or thirsty after feeding or drinking once, or getting full from one single grazing
- Fix cows being unable to find food after grazing once, because they search radius was smaller than the "overgrazed" marking
- Make cows roam less they seemed more like a pack of wolf than chilling cows
- Add a cooldown to the livestock flee trigger so one hit cannot re-fire it through randomIdle or chargeRun
- Back off strayed-from-mother and strayed-from-herd for 15 s after a failed walk back
- Require a reachable trough or barrel before it wins over grass or shore
- Add RegroupSearchRadius so cows can find a herd further than the stray distance
- Only send a staggered bull into flee when the hold-ground rule says he would run
- Sample two rings and take the nearest spot in the grass and water searches
- Record herd distress only when there is an attacker, and spend it on the first charge
- Back off the mate search when nobody is found or the female is unreachable
- Throttle the shore search after a miss, mirroring the grass search
- Collapse graze and drink into shared consume transition and state classes
- Share one speed ramp helper across follow, consume, mating and return walks
- Add IsHerdMate, IsDependent and a centred FindNearestDependent, and use them everywhere
- Wrap the remaining client-compiled FSM members in #if SERVER
Fix cows not fleeing sometimes, add tests for bull and cows behaviour
Fix super fast acceleration on cows and sheep
Bull can kick and charge, protects the herd and moves between you and them. Can play toreador with the bull like with the croc. Herd sticks together when in danger instead of scattering. Fix cows decelerating instantly.
Generate and connect animation montages, add hurt and death behaviours + anims
Delete duplicates and replace the original animals
Fix boar chasing too fast, fix animals not running away properly when player on foundation
Fix animals clipping with the player
Second part missing from the initial commit
First step to port old animals to new AI system (no behaviour change, it just makes them easier to maintain, we'll do proper behaviour rework in the future)
Improve navmesh doors perf, doors now remember which polys are theirs instead of searching the
navmesh on every open/close
Standardize navmesh door benchmark to follow same conventions as agent path following benchmark
Fix siege towers doors, better behaviour for NPCs when door is slammed on them
Rewrite some navmesh door bug repro test that passed even without its fix
Improve navmesh doors perf
Allow closing and opening door to be taken into account by the navmesh, but without a full rebuild
Fix navmesh generated on divesites, not generated in some doorways, some monument rooms not having navmesh, and scientist corpse colliders on wrong layer
Fix navmesh building on dive sites
Fix navmesh not being present in some rooms behind doors even if scientists can open them (potentially missile sillo and ghostship), the room navmesh a disconnected island because the door was baked into the navmesh, blocking the doorwash, and we prune disconnected navmesh regions
Fix scientist2 corpse not being on the ragdoll layer and thus blocking movement and projectiles
Fix low res navmesh on ghost ships
Fix old ais fleeing when player jumps
Fix Assets/Scripts depending on the test framework, which could potentially break builds that exclude tests
Fix navmesh generating in places in shouldn't, potential fix for "navmesh failed to be created", and optimization of NPC path following
Path following optimizations (around double perf), also a bunch of instrumentation and a benchmark setup:
- only string pull the beginning of the path, we will string pull again eventually so not need to run the algo for the whole path (steering agents only)
- only re-string pull the current path if we moved past a threshold or passed a path corner, not every frame (steering agents only)
- when chasing a moving target, instead of recalculating a new path, try to extend the previous path a bit instead to save time
- use unity transform SetPositionAndRotation instead of setting both independantly
- fuse some native method calls, so that we only call one method and skip the interop cost for the other call
- do not check corridor validity if no tile has changed since pathing
Fix prevent building volumes being baked into the navmesh instead of ignored
Add convar to toggle navmesh optis on and off
Gate per tile interlocked add needed for logging when logging is off
Fix ghostship A having no navmesh
Remove unused param in bake stats
Remove some spammy and uninformative logs
Adds lots of instrumentation, and increase navmesh build speed by around 30%, implemented common optimizations I've seen before or discussed with Lorenz:
- when rasterizing triangles, reuse values between neighbors instead of re-clipping the triangle against every column (7%)
- heightfield is supposed to have faster insertion than compact heightfield thanks to linked list, but because it wastes so much time pointer chasing during iteration it's actually slower, also instertion is not that bad when the column fits in cache (4%)
- fuse some span filtering operation to iterate once instead of 3 times on the spans (only 1% for rust maps sadly...) + the pooling from sbox doesn't really benefit us
As well as some new findings found from profiling:
- during heigthfield stage when comparing span A to span B for walkability tests, don't do everything from scratch when comparing B to A (9% whole map, but monuments and bases specifically x4 speed with this)
- watershed iterates through the whole list of regions multiple times, faster with lookup (7%)
Can get another 10% if we halve the detail mesh precision, automatically sampled lots of tiles for vertical differences to test and the difference is negligible
The real bigger order of magnitude gain is to not limit the number of threads and not time slice geometry collection, it stalls the server but goes 6x faster, could do it at server boot and just throttle the subsequent dynamic navmesh updates (player building bases, nodes etc).
Fix heavy scientists not moving after being dropped by the heli on some seeds (small oilrig only?), the AI zone was too small to encompass the drop points so they couldn't find them