Skip to content

Artifical Intelligence

Mooses2k edited this page Aug 22, 2024 · 15 revisions

6. ARTIFICIAL INTELLIGENCE

6.1. OPPONENT AI

Main job is managing player perception of our AI - not breaking immersion

With higher fidelity models, higher expectation of AI fidelity - maybe have all the cultists have a rictus grin to force uncanny valley instead of trying to fake it; for now it's the perpetual shadow of their hood or masks

FACTIONS (for interesting dynamics in dungeon, with different dispositions to other factions)

  • Aggressive
  • Ignore
  • Avoid
  • Hunt
  • Friendly
  • Neutral
  • Hungry
  • Defender
  • Territorial
  • Flighty
  • Malevolent
  • Trapper
  • etc

BEHAVIOR STATES:

  • Idle
  • Wandering
  • Alert/Investigating
  • Chasing
  • Positioning - Flanking/Ambushing
  • Attacking
  • Fleeing

SENSES: Implemented senses:

  • Direct player sight
  • Footstep and object hearing
  • Touch

Other ideas:

  • Tremorsense
  • Echolocation
  • Scent
  • Temperature
  • Witchsight
  • Scry/Locate Creature
  • Heartbeat sensor
  • Terahertz radar

AI BEHAVIORS - FOR EFFECTIVENESS AND VERSIMILITUDE

Every encounter/opponent type will be balanced in some way. Some will be utterly and instantly lethal but have large weakness or tell such as loud or slow or, in the case of traps, for not being annoying, the more deadly the trap, the more obvious it will be made. There will still be a feeling of skill in avoiding or working around them, but we want to avoid 'unfair deaths' as much as possible, of course, especially since it's a permadeath game.

Many monstrosities are hunters and are only to be avoided, not defeated; how to telegraph this?

Each character remembers what they've heard and said; also, have probability weights for various things like 'enemies nearby', 'enemy is player', 'player is tough', etc

"How about not charging somebody with a melee weapon when they're lighting you up with a minigun from down range? God, melee AI is the absolute worst in almost every game.

I want my suppressive anti-personnel weapons to demoralize the enemy. Make them freak out and dive behind cover, maybe even panic and drop their weapon. Maybe run away entirely if I'm far too high level for them. I want their commanding officer to shoot them in the back as they run.

I want enemies to shove their friends out of the way if I throw a grenade, or jump out of a window.

I want enemies to have memories longer than a gold fish and not return to passive status with an arrow in their knee repeating "Must have been my imagination.." I want reinforcements called if they find a dead body. I want the level torn apart by their search for me, until they've covered every square inch three times, and surely found me. I want their commanding officer to berate them if they fail to find me, but never return to passive stance.

I want them to move the bodies of the the dead to a different room, and yell into the darkness their oath of vengeance for the death of their friend. I want him to level up with me from then on, and become a kind of freeform procedurally generated nemesis who never stops hunting me till one of us is dead.

I want behavioral gradients between 100% health and 0% dead. I don't want to unload on someone with absolutely no reaction, with no behavioral difference at all between 100% and 1% health until that last shot, even if it was only in their foot, kills them when the last dozen to their chest and head did nothing but remove HP. I want to shoot someone in the arm and have them favor it, drop their longarm and pull their pistol, firing inaccurately from one hand while cradling the other.

I want to shoot someone in the leg and see him fall, not dead but incapacitated. I want to see covering fire from his squad mates to suppress me while the medic tries dragging him behind cover, if they know where I am and where the shot came from. If not, I want to pick off his squad mates as they attempt to drag him behind cover.

I want the last member of the squad, with a bullet in his gut, to wait laying slumped against some rubble, maybe even playing dead among the dead bodies, and wait for me to round the corner to collect loot. I want him to curse at me to get my attention, and when I meet his eyes, he laughs and releases the grenade spoon he'd been holding, sending us both to hell."
-- https://www.reddit.com/r/Games/comments/2r3dug/the_state_of_ai_fear_is_now_ten_years_old_its_ai/

Enemies may wait and aim at where they last saw you

In traditional OSR pursuit rules: most pursue to the range of their senses (vision, hearing, scent)

AI tactics:

  • flank
  • if player in light, they're in dark other than thrown torch, take thrown torch and remove from play or throw back
  • throw consumables
  • hide around corners and wait, sometimes until receive more sensory info
  • fall back to defenses and barricade door
  • Some monsters will be scared and cautious and will retreat if think they're seen, then loop around or wait for opportunity
  • Cultist can throw in bomb and close door and even spike it to kill with smoke
  • Some enemies fear or avoid light, some, open flame (torch not candle)
  • some characters can open doors

feint, cut more likely to land, but opens player up for longer

some games make enemy's first attack have no chance to hit? only a few enemies allowed to shoot at you at once

notice changes in environment like new lights, doors in different states, furniture moved or destroyed, items gone AI should (usually) be predictable should kick away bombs, pick up weapons in environment if needed have the game adapt to player strategy to force changes periodically so it doesn't get boring

  • if sneaky, set more noise traps
  • if gunner, set more cover and ambushes

have enemies listen for types of damage and react accordingly (fire makes them act differently than melee damage)

Simple reaction time for humans: 200ms. Go/no go reaction time for humans: 400ms. If modeling distracted, hard to identify, complex reaction action, add more. Aiming adds time.

DF potential, fleeing and tricking enemies and surviving can be much more exciting

Blocking monsters off should be a big tactic

Monsters can often open doors even if stuck, but not if blocked or barred or staked

Someone throwing his pistol to momentarily confuse the opponent into thinking it's a flash bang, then use that second of confusion to attack.

Boss cultists can kill fleeing cultists

"It'd be a lot of camping, laying in a corner, ambushing, hiding behind cover, and storming your position en masse. You know, like real players would. That might be cool from a technological perspective, but how fun will it be to play against that kind of AI. Obviously that depends on the player, but I reckon too much of a challenge takes away from the enjoyment.

Think about a level where the AI just spams grenades at you while you're hiding in a building. Very lame, but smart from a human perspective. In real combat I imagine soldiers don't want to go into a room where they know there are enemies either.

For example, you have mission to take out bandits camp in deep dark dungeon of industrial factory. Whenever enemy spot/hear you, they're turning off their flashlights and sitting quite in cover or dark corners til you make the first step. If you wait long enough, one of them will check your position, silently. And others will cover scout.

Another situation, outdoor fights. Enemy will try to surround you. If you focus too much on one guy, then his mates will flank you and kill, obviously. Or simply throw couple of grenades in you (if it's safe for them), you won't survive in 90% cases. So, you have to check your back to prevent flanking.

Also, NPC's AI related to their ranks and faction. High rank Military and Mercs more organized, more aggresive, they prefer to use suppressive fire when working in group.

Mutants got different AI, but it's depends on the specific type of mutant. Like dogs and pseudo-dogs. Big pack of dogs always'll try to swarm you and pseudo-dogs trying to take you out in 1-2 leaps from behind or sides. When you fighting with them, you must pull back, hold dogs and keep pseudo-dogs in sight, otherwise you gonna die very quickly." -- https://www.reddit.com/r/Games/comments/2r3dug/the_state_of_ai_fear_is_now_ten_years_old_its_ai/

Area denial and resource denial strategies

Enemy chases, starts breaking down door, player can stab through

[REDACTED] flee or stay at edge of light if you have a pinklight lantern

NPCs can block off players or chase them to where you want them to be agressively keep player away from the alt stair in borehole with the elk?

Fog low to ground, sometimes cultists/etc crouch and sneak (player partially hidden in it too)

The most important part of personalities for entities encountered are: goals, allies, enemies, and plans. Whatever it takes to place them into the fabric of the setting as entities with agency.

Some more behaviors

  • Standing look around
  • Melee weapon choose
  • Melee attack
  • Sprint
  • We're lit up, get out of the light
  • Ambush
  • Throw light
  • Flee
  • Wait dying
  • Flank Some traits, I think from IA and elsewhere:
  • Can open doors or probably just ‘has hands’
  • Will try to break doors when chasing
  • Tries to stay at range
  • Fears light
  • Pack tactics
  • Can try to flank
  • Can throw consumable
  • Ambusher
  • Spellcaster
  • Hosting adult parasite
  • Hive Hosting
  • spirit
  • No shadow
  • Invisible
  • Spider climb
  • Levitate
  • Fly
  • Hover
  • Bloated
  • Resistant to b/p/s (like worm masses resist piercing which means ineffective backstabs in IA)
  • Deadened (can't feel pain)

Track time spent searching and give up, but don't go back to idle

https://www.lancaster.ac.uk/stor-i-student-sites/tamas-papp/2020/04/23/fear-shortest-path-for-challenging-ai/

Have AI patrol around large rooms and to objects not just random tile nearby.

AI should make sure it can get back from where it plans to go (Rain World pathfinding does this)

AI BEHAVIORS - FOR HORROR

(many of these tricks should be used only once per run to avoid over-familiarity) (things (rarely) moving quickly just at edge of vision (one of the types of VotE Darkness?)) (Have enemy that peeks around the corner at you)

Sometimes when possessed, Enemy marionettes around, slamming into stuff

If the player stays in the same place for about 45 seconds, someone on the level or the one below begins moving towards them or maybe It Follows style enemy, even comes into safe room? maybe the third time; the [REDACTED], it's head waiting right outside the saferoom rarely

Have cultists/etc sometimes standing and waiting in creepy places like behind where a door would open to, or under a table or in a wardrobe; zombies behind grate doors

Don't be predictable, don't spawn enemy right after player picks up item. Or, conversely, have a hugely signposted set piece thing and you get sniped or turned to stone as you touch it (signposted being skeletons or broken statues bits lying all around the base

Upon encountering some enemies, go to 2 frames a second, camera shutter sound, daguerrotype border, maybe color fades away

An enemy you should have to look at the ground near them. Vision blanks if look at directly - one of the floating eye enemies

when loose visual track of player - would eventually help to have a behavior to have them go into nearest room if lose visual contact do a look aruond animation -

6.2. NON-COMBAT AND FRIENDLY CHARACTERS

Enter to initiate chat at first, standard RPG convo menu or IF-style text parsing? Needs more design thought.

OSR-style reaction rolls - not every cultist attacks on sight

6.3. SUPPORT AI

We've made a custom behavior tree AI system.

Navmesh generation at runtime is procedural and custom-made.

6.4. MACHINE LEARNING AND FANCY STUFF

Would be neat to integrate GPT-3 into character chat. Would be neat to use some machine learning for level design. Would be neat to use machine learning for some opponent AI.