Search Unity

  1. Unity 2020.1 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

reducing ai npc's ability to see player while player not moving

Discussion in 'Game Design' started by steveh2112, Mar 15, 2020.

  1. steveh2112

    steveh2112

    Joined:
    Aug 30, 2015
    Posts:
    235
    how would you reduce an ai npc's ability to see the player while player not moving?

    right now i have a system which has limits based on distance from player and vision angle and checks players head and feet. if either head or feet in range and FOV angle, and not blocked, then detected.

    but i'm thinking if player stops moving, detection should be reduced some how.

    a simple way would be to reduce distance and FOV angle but not sure that's totally realistic.

    what do you all think?

    thx
     
    Last edited: Mar 15, 2020
  2. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,562
    It doesn't have to actually be realistic; it just needs to seem realistic and/or consistent to the player. Basing visibility on the player's distance, FOV angle, and velocity sounds like a perfectly fine way to make something consistent that the player can comprehend and predict to a reasonable degree.
     
  3. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    5,263
    Read the state of the player,
    if moving parameters = large values
    else parameters = low values
     
    Joe-Censored likes this.
  4. Not_Sure

    Not_Sure

    Joined:
    Dec 13, 2011
    Posts:
    2,708
    Just make it a value and add or multiply it with darkness, distance, and angle.

    I would make sound a separate system that includes distance, sound level, minus surrounding noise.

    Also, make both a diminishing value so that the player can pause to blend back into hiding.

    Also, also, make an event for “what’s that?”, to “something is fishy”, to “there they are!”, to “where’d they go?”, and “must have left”.

    Oh, and have a value for alertness.

    If they spot you, they should never go back to completely relaxed.

    EDIT: oh, and for the love of god, include a shock value. Some AAA games neglect this. If they spot you there needs to be a hesitation for the player to make a decision. And if their buddy’s head gets blown off, it should make them react.
     
    Last edited: Mar 28, 2020
    angrypenguin likes this.
  5. newjerseyrunner

    newjerseyrunner

    Joined:
    Jul 20, 2017
    Posts:
    893
    If you want realism, then I’d just tie it directly to distance. Fov is unrealistic because our eyes are much more sensitive to motion in the periferals. I assume you aren’t checking every frame right? You could also increase the number of frames between checks if the player is moving slower.
     
    Last edited: Mar 29, 2020
  6. Not_Sure

    Not_Sure

    Joined:
    Dec 13, 2011
    Posts:
    2,708
    I think rather than every frame it works better to cycle through a list of enemies taking turns checking.

    Because 1) saves on cpu and 2) the more distractions there are around you the less likely you are to notice something.
     
unityunity