Spawn systems, NPC behaviors, and loot drops

Scripted ALFA systems & related tech discussions (ACR)

Moderators: ALFA Administrators, Staff - Technical

Ronan
Dungeon Master
Posts: 4611
Joined: Sun Feb 20, 2005 9:48 am

Spawn systems, NPC behaviors, and loot drops

Post by Ronan »

Currently, NESS does all three of these things (if you want it to). For NWN2, I'd prefer to have them much more loosely coupled. They could be related as follows:

The spawn system would handle the spawning of creatures, reducing their number as they are killed off or increasing if they are not. It would be based off of waypoints with intuitively named local variables and generous comments explaining how things work to builders.

I'd prefer the behaviors be a part of the creature's AI, and naturally only do anything when not in combat. But of course we can't have 10 DM-spawned guards suddenly decide to all go on the same patrol route, nor can we create a NPC resref for each desired behavior. So I think we should have spawn waypoints pass information on the desired behaviors to the creature in the form of local variables. DM-spawned NPCs of course would not have these variables, and would therefore not have any behaviors.

I think this works well, because NPC behaviors could likely be modular with respect to any AI system, ie a simple insert in the heartbeat script,

Code: Select all

if( !GetIsInCombat(oCreature) ) {
  RunBehaviors(oCreature);
  return;
}
And for loot drops, I don't see any need to integrate loot with either of these systems.

Thoughts?
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 »

I think the NPC behaviors work well with NESS simply because you can configure specific behaviors at specific waypoints. Now where the actual scripts reside (under NESS or under AI) is not material in any way, just that the waypoints themselves serve as triggers for behaviors. So, if the two systems pay attention to the waypoint flags, each could react accordingly.

As for loot drops, much the same reasons apply as above.

In general though, I too prefer less coupling so these systems can be used independently of one another if need be.
Ronan
Dungeon Master
Posts: 4611
Joined: Sun Feb 20, 2005 9:48 am

Post by Ronan »

ç i p h é r wrote:I think the NPC behaviors work well with NESS simply because you can configure specific behaviors at specific waypoints. Now where the actual scripts reside (under NESS or under AI) is not material in any way, just that the waypoints themselves serve as triggers for behaviors. So, if the two systems pay attention to the waypoint flags, each could react accordingly.
Yeah, there will have to be varaibles passed to creatures spawned from a specific waypoint. But I don't think the spawn system should handle the execution of any behaviors.
ç i p h é r wrote:As for loot drops, much the same reasons apply as above.
I'm not sure I understand why a builder would rather define loot drops on a spawn point instead of a blueprint. I can see how it could be used, I'm just not certain I've ever seen the need for it in practice.
User avatar
Fionn
Ancient Red Dragon
Posts: 2942
Joined: Sun Jan 04, 2004 7:07 am
Location: Seattle, WA

Post by Fionn »

Sounds great. Spawn, Behavior, & Loot should be separate systems.

We should definetly have AJAI (or whatever) predefined for each NPC roll. Guards, Commoner, Archer, Support/Healer, Caster, Warrior, Sentry, Thief... It might be good to have it tie into Faction/Align too.

While we're at it, Guards need to have a CheckLaws(oPC) onPerceive function. This should allow options for subdue/attack based on sub/race, reputation, equipped items, percieved actions, etc.
PC: Bot (WD)

Code: Select all

     -----          -----          -----          -----
    /     \        /     \        /     \        /     \
   /  RIP  \      /  RIP  \      /  RIP  \      /  RIP  \      /
   |       |      |       |      |       |      |       |      |
  *| *  *  |*    *| *  *  |*    *| *  *  |*    *| *  *  |*    *|
_)/\\_//(/|_)(__)/\\_//(/|_)(__)/\\_//(/|_)(__)/\\_//(/|_)(__)/\\_(
User avatar
Fionn
Ancient Red Dragon
Posts: 2942
Joined: Sun Jan 04, 2004 7:07 am
Location: Seattle, WA

Post by Fionn »

Ronan - presuming we get it right the first try, it matters not how the code touches. Presuming we wish to replace AJAI with something much better, it's much easier to simply change the pointers to the new interface. Much harder if we have to rewrite ANESS to use another AI.
PC: Bot (WD)

Code: Select all

     -----          -----          -----          -----
    /     \        /     \        /     \        /     \
   /  RIP  \      /  RIP  \      /  RIP  \      /  RIP  \      /
   |       |      |       |      |       |      |       |      |
  *| *  *  |*    *| *  *  |*    *| *  *  |*    *| *  *  |*    *|
_)/\\_//(/|_)(__)/\\_//(/|_)(__)/\\_//(/|_)(__)/\\_//(/|_)(__)/\\_(
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 »

Ronan wrote:I'm not sure I understand why a builder would rather define loot drops on a spawn point instead of a blueprint. I can see how it could be used, I'm just not certain I've ever seen the need for it in practice.
I suppose it's really a question for builders. I suspect the configurations for managing the loot drops are of more significance. Specifically, having the ability to disable loot drops at a spawn point as well as setting up loot decay. Loot decay could certainly be pulled out and applied globally, but granular control isn't necessarily a bad thing.

If you want to scratch this, we should poll builders in the DM forum and get some feedback on it. If you want to isolate the scripts so they are not bundled with NESS, I don't think there will be any objections there.
Fionn wrote:We should definetly have AJAI (or whatever) predefined for each NPC roll. Guards, Commoner, Archer, Support/Healer, Caster, Warrior, Sentry, Thief... It might be good to have it tie into Faction/Align too.
I definitely agree. I started a very rough outline a while back to start fleshing this out as well as some other things being discussed in and around this thread. I'd like to keep relevant discussion pertaining to AI in one place if possible so it's easier to work into a spec. If you have specific input you'd like to add, please post in thread below:

http://www.alandfaraway.org/phpbbforum/ ... hp?t=27674
Ronan
Dungeon Master
Posts: 4611
Joined: Sun Feb 20, 2005 9:48 am

Post by Ronan »

You know, the more I think about it the more I start to believe we need an encouter system seperate from the spawn system. The encounter system should keep track of populations and randomly generate spawn locations, ie dynamically creating encounters. The spawn system should spawn and despawn those encounters (as well as statically placed spawns like bartenders of course), and not know the encounter system is even there.

I think this is going to be a lot of work. I'm hesitant to start on either system until we know more about this "groups" functionality in NWN, and I know some builders will at least want an interface as soon as they start building.
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 »

Is the grouping "system" exposed to scripts? I thought it was just a palette tool to help builders paint groups of objects into the mod.
Ronan
Dungeon Master
Posts: 4611
Joined: Sun Feb 20, 2005 9:48 am

Post by Ronan »

I thought it sounded like it was, but I can't really remember now.
User avatar
Fionn
Ancient Red Dragon
Posts: 2942
Joined: Sun Jan 04, 2004 7:07 am
Location: Seattle, WA

Post by Fionn »

NESS already supports spawning camps - at least I've been told it does. If BW doesn't expose thier version to script, that must makes it a bit harder to do.
PC: Bot (WD)

Code: Select all

     -----          -----          -----          -----
    /     \        /     \        /     \        /     \
   /  RIP  \      /  RIP  \      /  RIP  \      /  RIP  \      /
   |       |      |       |      |       |      |       |      |
  *| *  *  |*    *| *  *  |*    *| *  *  |*    *| *  *  |*    *|
_)/\\_//(/|_)(__)/\\_//(/|_)(__)/\\_//(/|_)(__)/\\_//(/|_)(__)/\\_(
Ronan
Dungeon Master
Posts: 4611
Joined: Sun Feb 20, 2005 9:48 am

Post by Ronan »

Fionn wrote:NESS already supports spawning camps - at least I've been told it does. If BW doesn't expose thier version to script, that must makes it a bit harder to do.
It does, but Obsidian mentioned defining creature groups for doing such things as AI tasks, I think. Hopefully something mor effecient than what we have now.
User avatar
Fionn
Ancient Red Dragon
Posts: 2942
Joined: Sun Jan 04, 2004 7:07 am
Location: Seattle, WA

Post by Fionn »

Aye - that would be preferred. My point was simply that it's doable either way if we wish it.
PC: Bot (WD)

Code: Select all

     -----          -----          -----          -----
    /     \        /     \        /     \        /     \
   /  RIP  \      /  RIP  \      /  RIP  \      /  RIP  \      /
   |       |      |       |      |       |      |       |      |
  *| *  *  |*    *| *  *  |*    *| *  *  |*    *| *  *  |*    *|
_)/\\_//(/|_)(__)/\\_//(/|_)(__)/\\_//(/|_)(__)/\\_//(/|_)(__)/\\_(
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 »

Right, and for the purposes of the specification, it matters not. Whether we're spawning "camps" or "groups" can be left up to the implementation. The only requirement is the ability to spawn in numbers greater than 1.
User avatar
indio
Ancient Red Dragon
Posts: 2810
Joined: Sat Jan 03, 2004 10:40 am

Post by indio »

Ok. To summarise:
- Spawn System (just spawns mobs/groups, in whatever numbers needed)
- Encounter System (determines configuration of mobs...number, variety, strength, recurrence)
- Loot System
- AI System (defines activities at spawn location)
Image
User avatar
Fionn
Ancient Red Dragon
Posts: 2942
Joined: Sun Jan 04, 2004 7:07 am
Location: Seattle, WA

Post by Fionn »

Static/Dynamic Spawn systems - do we want 2 guards, or a growing tribe of Orc.
PC: Bot (WD)

Code: Select all

     -----          -----          -----          -----
    /     \        /     \        /     \        /     \
   /  RIP  \      /  RIP  \      /  RIP  \      /  RIP  \      /
   |       |      |       |      |       |      |       |      |
  *| *  *  |*    *| *  *  |*    *| *  *  |*    *| *  *  |*    *|
_)/\\_//(/|_)(__)/\\_//(/|_)(__)/\\_//(/|_)(__)/\\_//(/|_)(__)/\\_(
Locked