Hey Eco Citizens, this week we dive into the intricacies of animal and vehicles interactions with programmer/designer Sean Ater.
Animals vs Vehicles
One issue I looked at this week is animal / vehicle interactions. In 8.0 I made animals try to avoid walking through plants to add a bit of realism and increase animal visibility. Unfortunately plant densities increased and evil switchgrass was added so once again animals struggle in vain to be noticed. Open roads within dense forests are a particularly attractive way for animals to get some attention. Some late-game servers have complained that animals are forming blockades and frequently move parked vehicles off-road.
In general animals on roads is pretty undesirable so I’m making roads cost more for animal movement than the densest plants. This should make roads much safer, even if an animal wants to flee further down a road this should force them off to the side. Also when they must cross roads they will quickly cut across:
Another suggestion was to let vehicles kill animals, which is actually pretty easy:
However when laws prevent killing elk it has to avoid death somehow. Ideally it should still become a ragdoll so vehicles don’t get moved by the animal. One option would be to ‘stun’ animals in that case and let it get back up later. Switching from a ragdoll back to an animated animal is pretty difficult to do well, if we decide to allow roadkill I doubt we will have very nice transitions back to life. We could either have a quick pop back to life or a comical reanimation blending from the ragdoll back to an animated state. (I suppose that’s fine, defying death thanks to laws is pretty ridiculous in the first place)
Another option is to just make animals respond to vehicles more quickly. It turns out they were slow to respond because player velocity wasn’t getting sent to the server while driving, which broke the animal threat calculations. Combining that fix with making animals avoid roads makes it pretty difficult to hit animals with vehicles. (in a truck I was only able to hit a few that were sleeping)
While debugging animal fleeing I also made a simple shader to help visualize our threat calculations that looks kinda cool. Here it is after tweaking the equation so walking (~3m/s) is a bit more threatening and running (~4.5m/s) has a more focused threat area. The player would be in the center of the circle (which represents a constant proximity threat), as player velocity increases threat extends forward. Animals in red would trigger fleeing immediately, animals in green would flee after ~2s if they remain in a green area.
Root Motion Movement
This week Lachlan also made some prototype walk/turn animations for the elk that include root motion. Here is a quick test of blending between them for more realistic turning, letting animations drive the elk’s movement.
Hopefully we will switch to using root motion movement for animals eventually. With root motion we would be giving up direct control over animal position & rotation, instead blendable turn animations act as a steering wheel for the animal. Above i’m manually adjusting an animator parameter that controls blending. While the blend is changing the feet slide a little, when the blend is constant foot placement is almost perfect. Once we get basic root motion working we can add other interesting animations that modify position, like believable transitions from lying down to fleeing.
Currently the server completely controls animal positions, so letting animations that only exist client-side drive movement off the target path will be a major change. It should be an interesting project but may take a while to implement. For 8.1 I’ll probably have to put it on hold and go back to fixing bugs.
Eco is available in Early-Access on Steam
Thanks for all your support!
Sean Ater Programmer/Designer