Skip to Content
 

Enemy AI Mechanics

12 replies [Last post]
saiyanslayer
Offline
Joined: 10/08/2013

Heya all! Long-time lurker, first time poster.

I'm working on a small game for my friends and I could use some input on a mechanic I'm trying to work out.

The game: 2-6 players work together to complete objectives in a survival game. Players have customizations (tech suits), weapons and gear, and abilities depending on their character type (soldier, survivalist). Players can search, attack, and move to avoid enemies and gather objectives.

The issue: the enemy is not controlled by anyone and I'm having a hard time getting a AI system working correctly. I decided to borrow from Zombicide and use how the enemies are programmed to first go after the first player they see. If they cannot see a player, they go after the loudest player.
My current idea is using a Threat system. Players who take certain actions or have certain gear create more threat than other players, and thus become targets and lure enemies to themselves (plus use the highest threat rating to spawn more enemies). This seems to be okay, but I can't work out the details:

  • Should gear and components create a minimum threat for that character?
  • How quickly should threat be generated? Increment it for each attack, or just once for any number of attacks?
  • Should threat decrease naturally?
  • Could a player spend actions intentionally lowering their threat?
  • If tied to enemy spawning, how quickly should threat escalate? Should a single shot at the start step the spawning to a new level? Would another shot after that step it to the next level?

    I'm attached to the threat idea because it could tie into players starting with better gear and more troublesome spawns. I'm open to input though.

    Any thoughts?

  • Jacksmack
    Offline
    Joined: 09/22/2013
    Non-Player Character Opposition

    So first off I don't know if AI would be the correct term for what you are doing, but that's beside the point.

    I think that threat can work, but it really depends on your theme and environment as to whether or not threat is the best option.

    You talk about how it is sifi with tech suits, but you leave out what the opposition is. If the opposition is something that doesn't have ears but feels vibrations then the heaviest player would get the most threat when moving, or a player with an engine that is running.

    If you want to explore complexity you might have different threat types, one for visual and another for auditory or vibration. This might help pull a manageable amount of enemies to different players.

    And a glowing energy sword would be really powerful but draw a lot of visual threat.

    One option I don't see a lot for enemy spawning is cards on the areas that get flipped as you explore. A deck of enemy loadouts that you shuffle and set up on spaces of a map would allow you to control the overall difficulty of the senario without completely removing the surprise for the players.

    Just some partial thoughts for you.

    questccg
    questccg's picture
    Offline
    Joined: 04/16/2011
    Doubts???

    You seem to have a lot of "questions" regarding your AI mechanic. I will make some assumptions to explain my ideas:

    1-You have a board
    2-And it looks something like a Chess board (Squares)

    3-Zombies move 1 square at a time following specific rules:

    -If a player is in the SAME *LANE* (Horizontally or Vertically), the Zombie will move 2 squares in the DIRECTION of the player (Assuming in the line of sight - See a player).
    -If NOT, then the Zombie moves towards the general direction of the *LOUDEST* player (until he is in the line of Sight). The Zombie will move 1 square at a time.
    -If a CLOSER and therefore louder player in in the same lane (again Horizontally or Vertically), the Zombie will change his movement such that he is always chasing the CLOSEST player. The Zombie will move 2 squares at a time...

    saiyanslayer
    Offline
    Joined: 10/08/2013
    Thanks for the feedback. The

    Thanks for the feedback.

    The theme is that the world was invaded by an alien civilization and the players are survivors of the initial attack. The enemy faction is a host of flying hunter-killers, human remains reanimated into scouts, a machine that reanimates those bodies, and some kind of huge hunter-killer. The hunters use various forms of detection, but they primarily look for electrical signals and radio waves to hunt groups of people.

    As for the spawning, I was thinking of doing it similar to Zombicide where a spawn card is drawn for each spawning zone. The amount of enemies spawned would depend on the threat level and the card. For a surprise factor, I was thinking that if a group is spawned outside of (player) sight, a spawn token (with a colour representing what threat it spawned in) would be placed instead. All spawn tokens revealed would then have a card drawn for each. That mechanic seems kinda hokey in one way, but cool in another.

    questccg: spot on with what I was thinking, except I didn't consider having the enemy's movement increase once it spots a player. That would work well.

    questccg
    questccg's picture
    Offline
    Joined: 04/16/2011
    Multiplication

    saiyanslayer wrote:
    ...As for the spawning, I was thinking of doing it similar to Zombicide where a spawn card is drawn for each spawning zone. The amount of enemies spawned would depend on the threat level and the card. For a surprise factor, I was thinking that if a group is spawned outside of (player) sight, a spawn token (with a colour representing what threat it spawned in) would be placed instead. All spawn tokens revealed would then have a card drawn for each. That mechanic seems kinda hokey in one way, but cool in another.

    Why not simply "MULTIPLY" Zombies. Let me explain (it's actually pretty simple).

    When a SPAWN card is drawn, the CLOSEST Zombie to that player MULTIPLIES itself (2 Zombies instead of 1) one space behind/next to the Zombie. So it's like as if the Zombie just appears from the crowd of zombies. This would feel LESS RANDOM. Simply another Zombie joins the fray.

    Why this is cool: players will have to battle MOBS of Zombies instead of just one... Like you could have 3 Zombies all on your tail! I see potential in this...

    The SPEED (2 spaces instead of 1) was something to help accelerate the Zombies so they can come in contact with Players quicker. It also makes the Zombies more challenging to escape (without a battle).

    saiyanslayer wrote:
    questccg: spot on with what I was thinking, except I didn't consider having the enemy's movement increase once it spots a player. That would work well.

    Good at least I have an understanding how your game plays! :)

    Kroz1776
    Offline
    Joined: 10/09/2013
    Test it out! :D

    I think you'll get a lot of good ideas here but you won't know what will work until you test it. I'd pick the ideas you get here that you like best, and playtest it. See what others think of them and then tweak them until they are what you and the playtesters deem correct.

    saiyanslayer
    Offline
    Joined: 10/08/2013
    After the Playtest

    So I gave it a whirl, using Zombicide for models, maps, and spawning cards (I added one to each spawn).

    Started two of the 'players' with higher Threat, causing the enemy spawns to be a bit nastier. I had threat decrease once at the start of the player's turn, and had it that all ranged actions caused one threat per use. Threat was measured in threes: blue level was 0-3 threat, yellow was 4-6, etc.

    I found that there was some push to be conservative with your actions, but the player with the biggest gun was dictating how much threat each other player could make. If someone had pretty high threat, everyone else could go nuts to catch up. I also found I made the weapons too good; the group could hold off the worst scenarios easily and only got damaged when I intentionally got sloppy.

    I have a few ideas of what I should try next and would like some opinions:

  • Do another playtest with weaker weapons to get a fear of spawning too much
  • Move the threat track to one shared by all players. Use the kills to determine what spawns
  • Each action that creates threat causes a die to be tossed into the Threat pool. At the start of the enemy turn, roll each die and spawn a card at the corresponding spawning location. Doubles rolled spawn a tougher enemy, triples spawn a mobile spawner, quadruples or above spawn a big nasty guy.
  • Each action that creates threat places a spawn token at the nearest spawner. The spawn tokens have an image of what they spawn hidden, some may even multiply or cause an event.

    Any thoughts?

  • Kroz1776
    Offline
    Joined: 10/09/2013
    The Threat has gone up!

    I read your test results and I was wondering how would changing the spawning mechanic from threat to kills change the gameplay?

    I'm assuming with this change that threat will only be used for enemy movement. If so wouldn't it still allow for the players with less threat to go wild until they caught up?

    I'd do a test run just making the weapons weaker and see how that goes and then implement other changes. With weaker weapons the players with less threat can still go "crazy" but they'll have less effect than before. By making the weapons weaker, you create harder choices to make. Do I shoot the enemy and gain some threat? Or do I try to move over here and maybe get (fill in blank) that will get us closer to victory. Before I'm assuming if the player had less threat, the choice was more obvious. Blow the enemy away, and then get the item. By having weaker weapons, it makes people think, "Well I MIGHT be able to kill the monster/alien/zombie, and that would make it easier to get the item I need. But I might not kill the monster in which I've just received more threat and wasted some actions.

    This is my opinion though knowing nothing about your game other than what I've read here.

    saiyanslayer
    Offline
    Joined: 10/08/2013
    Threat is Used for Determining Spawns

    Threat is used to determine what spawns in a round. A high threat will allow more enemies and even uglier enemies to spawn. It is also used for targeting, but I'm starting to see that it's not that useful/important for targeting as is it for scaling challenges for the players.

    Kroz1776
    Offline
    Joined: 10/09/2013
    Tasty human meatbags!

    saiyanslayer wrote:
    Threat is used to determine what spawns in a round. A high threat will allow more enemies and even uglier enemies to spawn. It is also used for targeting, but I'm starting to see that it's not that useful/important for targeting as is it for scaling challenges for the players.

    I see. I still think you should try changing the weapons power level and seeing if that helps. I think it's ok if you have someone with lots of threat taking lots of hits while everyone else does other things generating threat.

    This reminds me of scenes where a person makes one last desperate stand and draws the enemy away so that his buddies can continue. I would just avoid making someone who the only good option IS for them to be that last stand man.

    saiyanslayer
    Offline
    Joined: 10/08/2013
    Another playtest

    Did another playtest. Reducing the weapons did give a better feel, but threat just didn't seem to be interesting. I think I'll just drop how threat is generated and have that as a map criteria. If it is a sneaking mission, killing too many guys rises the alarm. Another map may specify that killing a specific type of enemy will jump the alert to a specific level.

    Kroz1776
    Offline
    Joined: 10/09/2013
    Battle on Soldier!

    Keep us posted! I know I'd love to hear the changes that are going on. If all else fails, there are two other things you could try.

    The first one is make it so that the enemies move towards their objectives first, and then towards any person nearby. This won't work if they don't have an objective other than, kill all humans.

    The second one takes out the AI aspect of it and make someone play as the bad guys kind of like Mansions of Madness or Super Dungeon Explorer. Although I don't think this is the direction you'd like to head, I suggest it as a last ditch effort but I have faith that you'll find a solution that will allow you to keep the enemies in the realm of AI.

    saiyanslayer
    Offline
    Joined: 10/08/2013
    Thanks!I am staying away

    Thanks!

    I am staying away from an enemy player, but I also realize I have to keep an open mind. The enemy always targets the closest player first (if two are equal distance apart, both are hit with a ranged attack). They then target the closet player they cannot see. Hopefully that's all I'll need.

    Edit:
    Made some simple maps. I have streets for corridors, walls of damaged ruins, and rooftops for elevation. Problem is that elevation is giving me a headache. I would like to use it, but determining line of sight becomes a bigger issue and it is harder to determine enemy movement because you have so many different options. Gonna have to think about it for a bit. I'll play with the idea that enemies only use elevation when chasing someone within their movement range.
    Other than that, the enemy player mechanic seems to be fairly good.

    Syndicate content


    forum | by Dr. Radut