We're Hiring

Eco Peaks: Animal Vehicle Interactions

March 9, 2019

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

The Eco Team is a collection of introverted and sometimes genius programmers/designers based in Seattle and Australia. We all grew up and thrive in the video game culture, so of course making them is our dream job. We look forward to continuing to put out quality games for the community of players.

2 thoughts

  • Reply
    Alyss

    Hope you guys fix the collision between animals and cliffs as seeing a bison climbing up a 4 block high (In game Avg. 1 Storey Building Standard Height is 3 Block) 90 degree hill with one jump doesn’t make sense, not even kangaroos can do that. The bisons should perceive the terrain as an obstacle and not up it so easily.

    • Reply
      SeanAtr0n

      It’s not an easy problem to solve. Sometimes it looks like they climb more than 2 blocks if they are going up a hill quickly but they can only climb 2 blocks at a time. They prefer to avoid climbing whenever possible, we just need to figure out a cheap way to select better destinations that avoid climbing. (We may need to simulate 1000+ active animals on popular servers so individual animals can’t afford to be very smart.)

Leave a Reply

Your email address will not be published. Required fields are marked *