The Castle Doctrine Forums

Discuss the massively-multiplayer home defense game.

You are not logged in.

#1 2013-05-27 05:34:12

DrNoid
Member
Registered: 2013-04-06
Posts: 56

Dog movement rules

Now that we have maps and we can puzzle our way through defences I ran into a knowledge gap: What are the exact rules for dog movement?

  1. Movement order:

    • When dogs try to get to the same spot, which dog goes first?

    • When two dogs behind each other go in the same direction, which dog goes first?

  2. Diagonal movement:

    • When you're exactly diagonal from a dog, where does it go?

    • If that direction is blocked by a dog, does it take the other direction

Offline

#2 2013-05-27 10:18:59

jasonrohrer
Administrator
Registered: 2013-04-01
Posts: 1,233

Re: Dog movement rules

Some experimentation during the self test (with chihuahuas to be safe!) will help answer some of these questions (like the diagonal question).

It has to do with various decisions made in the code about what is processed first.

The house grid is processed from a South-first (bottom rows first), West-first (left tile in each row first) order.  So, if two dogs are competing for the same spot, the South one or the West one will get their first.

If dogs are following each other and moving West, they will continue to follow each other with no gap.  If they are moving East, the West-most dog will try to move first but be blocked by the dog that it's following.  The East-most dog will then move, leaving a gap between the two for the rest of the trip.  This happens to the family, too, as they follow their exit path.

When dogs chase you, they look at the unblocked squares around them (N, S, E, and W), and pick the one that's closest to you.  If the square that they're on is closest to you out of their unblocked options, they stay where they are.

Offline

#3 2013-05-27 10:46:45

zed
Member
Registered: 2013-04-16
Posts: 171

Re: Dog movement rules

One last little point (to save anyone else from having to sourcedive): when there's a tie, a mobile prefers the direction furthest towards the end of that list (N,S,E,W).

Also: cats generally use the same rules to flee from your new position, but if you move directly onto a cat, it instead flees from your *previous* position.

Offline

#4 2013-05-27 10:49:23

jasonrohrer
Administrator
Registered: 2013-04-01
Posts: 1,233

Re: Dog movement rules

You're actually saving me from having to sourcedive in order to answer this question.  smile

Offline

Board footer

Powered by FluxBB 1.5.8