TTLG|Thief|Bioshock|System Shock|Deus Ex|Mobile
Results 1 to 8 of 8

Thread: AI Patrols and 180 Degree Turns

  1. #1
    Member
    Registered: Jan 2001
    Location: Formby, NW England

    AI Patrols and 180 Degree Turns

    This describes a simple way to have a patrolling AI perform a 180 degree turn in a way that looks natural. By default, such abrupt turns looks awful.

    The simplest setup is to have two TrolPts each linked to the other with an AIPatrol link:


    The problem is that each time the AI turns around it's very quick, and the AI tries to keep walking so it performs a quick, tight, loop, and it looks unnatural.

    The next thing a lot of people do is replace the TrolPt with a TrolPausePt, set up an AIWatchObj link and insert a 'Face angle' action (either replacing the pause or adding to it). That's the right idea, but it still looks awful. Here's a video showing how bad it looks:


    When the TrolPausePt is made visible, it becomes clear that the AIWatchObj radius causes the actions to begin before the AI considers itself to have arrived at the patrol point. When the actions have finished, the AI then resumes its patrol, which means it finishes heading towards the point, then does another bad turn.


    You can reduce the radius but the AIWatchObj timing doesn't allow for a natural looking about-turn to be made.

    This is how to make it look good:

    Create a marker just beyond the patrol point. Use the AIWatchObj link to have the AI go to that, then face a direction:


    Data for the AIWatchObj link to the TrolPausePt:


    Here's how it looks in game:


    With the two objects made visible, you can see how the guard walks past the TrolPausePt and gets close to the marker. When the AIWatchObj actions have finished, he still heads to the TrolPausePt but he's already facing the correct direction:

  2. #2
    Member
    Registered: Aug 2007
    Location: LosAngeles: Between Amusements
    Nice idea.

    Just out of curiosity, why did you not have the AI turn relative to itself or relative to the marker's orientation? If you don't specify anything, isn't the angle relative to the world?

  3. #3
    Member
    Registered: Jan 2001
    Location: Formby, NW England
    I've rarely even thought about relative angles, so I always use absolute values. However, the main point of the first post is to encourage people to do a few extra steps to improve their AI patrolling. The exact means of getting them to face a certain direction is down to the user's preference.
    Last edited by R Soul; 23rd Sep 2017 at 11:44.

  4. #4
    Member
    Registered: Aug 2007
    Location: LosAngeles: Between Amusements
    Fair enough.

  5. #5
    Desperately dodgy geezer
    Registered: Nov 2001
    Location: The Wailing Keep
    Excellent idea, Robin. Thanks for the demo.

  6. #6
    Member
    Registered: Sep 1999
    Location: Portland, OR
    I love how we're in the youtube era of dromeding to actually show things in action. Thank you for this!

  7. #7
    Member
    Registered: Jan 2006
    Location: On the tip of your tongue.
    This is a great idea - it's so simple it feels like common sense, but looks really good, like "Why didn't I think of that!?".

  8. #8
    Member
    Registered: Jun 2016
    Location: MN, United States
    Nicely put. Perfect that you made this topic too, I'm at the stage of putting in patrolling ai in my FM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •