Feature Specification: NPC/Mob AI

Scripted ALFA systems & related tech discussions (ACR)

Moderators: ALFA Administrators, Staff - Technical

Locked
User avatar
ç i p h é r
Retired
Posts: 2904
Joined: Fri Oct 21, 2005 4:12 pm
Location: US Central (GMT - 6)

Feature Specification: NPC/Mob AI

Post by ç i p h é r »

NPC/Mob AI
Currently, there is one notable system which handles our AI needs: JAI. This package can serve as the basis for our discussions, but I think it is worthwhile to consider what we want out of an AI system to help us choose what to use as our basis for NWN2. I'll start off by sketching out the framework.

For a short explanation of the feature specification format, visit:
http://www.alandfaraway.org/phpbbforum/ ... hp?t=27229

Functional Requirements
Combat AI
Behaviors relating to combat situations. This will generally only apply to hostile creatures and spawns, but it can pertain to NPCs who find themselves in a combat situation. This is what JAI primarily addresses.
  • Melee AI
    Ranged AI
    Divine Casting AI
    Arcane Casting AI
    Monster AI
Non-Combat AI (NPC Roles)
Behaviors relating to non-combat situations. This will only apply to individual NPCs and special sentient creatures that populate the world of Faerun. The following is a list of possible NPC roles that might require specific AI:
  • Guards*
    Priests
    Nobles
    Artisans
    Merchants
    Inkeepers
    Bartenders
    Waitresses
    Commoners
    Guildmembers
    Smugglers
    Slavers
    Thieves
    Pirates
    Farmers
    Beggars
    Children
*A jail area can be designated for each locale. If a jail has been designated, guards may attempt to arrest players. Players who are the subject of an arrest will have the opportunity to surrender and be ported directly to a jail cell or fight and face the possibility of death. Players who choose to fight will be considered outlaws in that locale.

AI Variables
A variety of factors can influence decision making. They are listed as follows:
  • Role
    Alignment
    Relative Strength
    Intelligence & Wisdom
    Impulsiveness (Random Choice)
    Reputation
    Morale
Patrolling
Setting up and configuring patrol routes using waypoints.

Activities
Defining activities to perform along patrol routes.

Professions
Defining a set of repeatable activities that constitute a profession.

Monster Reputation
As players kill creatures of a specific racial type, their reputation among those tribes will grow. Eventually, a reputation threshold will be surpassed beyond which monsters will flee upon perceiving the player. Creatures that flee will run to the nearest despawn point to escape or simply despawn if their escape route is blocked. Fleeing creatures will be granted a 10% movement rate increase.

Creatures with an Intelligence score of less than 3 are not aware enough to recognize a reputation and are thus unaffected by this.

NWN Object Dependencies
Jail Area Template, Conversation Templates

Local Variables and External Configs
TBD

Logging and Debugging (global LOG & DEBUG (on/off) constants)
TBD

Persistence Requirements
TBD

Event Dependencies
OnConversation, OnHeartBeat
Last edited by ç i p h é r on Fri May 19, 2006 10:32 pm, edited 2 times in total.
User avatar
ç i p h é r
Retired
Posts: 2904
Joined: Fri Oct 21, 2005 4:12 pm
Location: US Central (GMT - 6)

Post by ç i p h é r »

From Riotnrrd:

http://www.alandfaraway.org/phpbbforum/ ... php?t=6108

This begs the question whether we should keep the two systems separate, as they are currently represented in this forum, or unify them and discuss them in one thread.

Riot, if the information in the link above is up to date (the post is almost a year old), I'll move it into main post.
User avatar
Riotnrrd
DMA's Technical Liaison
Posts: 1682
Joined: Sat Jan 03, 2004 2:04 pm

Post by Riotnrrd »

I last updated that thread about a month ago (though it was originally created a year ago). Posting it here would be fine.

When you say, should we keep the two systems separate, do you mean NESS and AJAI?

I think of NESS and AJAI as being somewhat separate, but related. NESS handles how particular creatures or groups are spawned, while AJAI controls the behavior of the creatures after they have spawned. In this sense, they are separate. However, they are related in my mind due to the fact that they are both tools used towards my goal of realistic, challenging, non-predictable spawns. Further, NESS controls the spawns throughout their lifetime; NESS also integrates loot drops and corpse decay.

By this definition, if spawns / encounters are a major category, then NESS and AJAI would each be separate subsystems.
User avatar
ç i p h é r
Retired
Posts: 2904
Joined: Fri Oct 21, 2005 4:12 pm
Location: US Central (GMT - 6)

Post by ç i p h é r »

Alright, I'll keep the threads as they are and sort the requirements according to subsytem.
User avatar
ç i p h é r
Retired
Posts: 2904
Joined: Fri Oct 21, 2005 4:12 pm
Location: US Central (GMT - 6)

Post by ç i p h é r »

Moved patrols, activities, and professions categories under AI.
User avatar
AcadiusLost
Chosen of Forumamus, God of Forums
Posts: 5061
Joined: Tue Oct 19, 2004 8:38 am
Location: Montara, CA [GMT -8]
Contact:

Post by AcadiusLost »

Anyone heard of good, adaptable AI systems on the vault? I'd been holding out hope for Ronan to reappear and make this a pet project, but I think we're fast approaching a time when we'll need at least rudimentary AI functions.

Alternatively, if we can make the OE AI do what we need without too much fuss, that's allright as well. Priorities to start with seem to be:

-Random Walking (ideally with "return home" and maximum radius options)

-Ambient Animations (PCs do them incessantly, and yet our NPCs and mobs are statuesque)

I know Indio has NPCs on patrol routes in 003, presuming he's used standard OE walkwaypoints for this, though I've no familiarity with them. I'd like to see patrolling, tasks, and some basic morale in early on if we can make it happen.
Thangorn
Haste Bear
Posts: 2081
Joined: Fri Oct 01, 2004 1:00 pm
Location: Queenstown, New Zealand

Post by Thangorn »

I'm working on something that works through the spawn system to offer random walking and ambient animations for the template inn..

now that you've updated the hak, it /should/ be elementary. Two or three scripts referenced by the spawn system by the variable "ACR_SPAWN_SCRIPT_!".

further to our discussion on this Acadius: RandomWalk functions are Fire and Forget functions, you need to do a ClearAllActions to stop it. If you dont it just runs continuously after being fired once. Therefore I imagine that its not going to be too much of a lag beast to manage.

Only problem I can forsee doing it this way is that even after a DM Clears All Actions, the spawn waypoint will update the child's behaviour on its heartbeat and start it off random walking again unless the script sets a variable on the child which tells the waypoint to stop making the child walk around.

Ambient anims are a whole different kettle of fish but I'm think a spawn script that randomly selects an action for the NPC to do from a particular list of cases (so no hammering and shovelling :) ) with 40% - 50% of the cases being no action. I'd like to tie this in somewhere with a rumour/random speak system down the track too.

sound workable in theory?
On indefinite real life hiatus

[22:52] <Veilan> obviously something sinister must be afoot if a DM does not have his social security number in his avatar name!
User avatar
AcadiusLost
Chosen of Forumamus, God of Forums
Posts: 5061
Joined: Tue Oct 19, 2004 8:38 am
Location: Montara, CA [GMT -8]
Contact:

Post by AcadiusLost »

Sounds like I need to get you a hak with a working ACR_SPAWN_IN_SCRIPT_# parameter ASAP- I'd love to have something working to distribute with the next ACR. I'll email it tonight.

I'd somehow missed ActionRandomWalk() in the lexicon. Eventually it would be nice to get a more nuanced implementation that periodically checks distance from origin for Return Home or maximum radius as well, but the Seamless ATs and despawning of inactive areas should reduce the chances of mobs wandering next to AT targets, or group spawns scattering over the whole area.
Thangorn
Haste Bear
Posts: 2081
Joined: Fri Oct 01, 2004 1:00 pm
Location: Queenstown, New Zealand

Post by Thangorn »

I'd like to help move this along if possible.
I'm just wondering if can we get a meeting together in IRC to discuss creature and spawn script AI functions and distribute tasks if necessary?

Acadius, Riotnrrd, anyone else?
On indefinite real life hiatus

[22:52] <Veilan> obviously something sinister must be afoot if a DM does not have his social security number in his avatar name!
User avatar
Riotnrrd
DMA's Technical Liaison
Posts: 1682
Joined: Sat Jan 03, 2004 2:04 pm

Post by Riotnrrd »

On vacation for another week, but sure.
Locked