Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

AI in a open world co-op game.

Discussion in 'Game Design' started by StarGamess, Jan 11, 2015.

  1. StarGamess

    StarGamess

    Joined:
    Jul 21, 2014
    Posts:
    179
    I'm trying to make a Co-op RPG game. And my question is how should i design the AI, the game has 8 player co-op and ofcourse i dont want the AI to be active when players are 2km away. I also need the AI the select one of the 8 players and preferably the one who is the closest to him. But once he has chosen a target he should only let him go once he has reached a certain distance. I'm not asking for any code i know how to make AI but never done it in multiplayer so my question is how should i do all this in MP.
     
  2. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    12,523
    Level of detail (LOD). Every so often, each AI computes the distance to all players and records the closest distance. Base the AI's update frequency on this distance. If a player is very close, update frequently. If a player is far, update less frequently. At the farthest distance level, turn off AI updates entirely until a player enters the AI's "wake up" trigger collider.

    Make sure to overlap your LODs and only switch LOD when the players exit the current LOD, not when they enter a new LOD. This prevents jitter if the distance wavers over the line.
     
  3. StarGamess

    StarGamess

    Joined:
    Jul 21, 2014
    Posts:
    179
    Thanks man that helped alot.