Aller au contenu

Photo

Kamal's Commoner AI : Released


  • Veuillez vous connecter pour répondre
11 réponses à ce sujet

#1
kamal_

kamal_
  • Members
  • 5 250 messages
I've released my generic commoner ai, including a demo module, an erf with the required vfx, and a readme. Enjoy and happy building! The readme includes the list of available activities for npcs.
Neverwinter Nexus  or Neverwinter Vault

This is an ai system for the generic commoners that occupy your towns/cities etc. It is not meant for anyone you want to follow a specific behavior or schedule. The goal is to provide an simple to implement, but relatively advanced AI for those "unimportant nameless npc" groups that fill out and add ambiance to game worlds. This ai allows your generic commoners to have schedules and carry out quasi realistic actions, automatically, and in as simple for a builder to implement manner as possible.

This system is based on Uncle FB's original NPC control code http://nwvault.ign.c...s.Detail&id=278 and includes additional activities provided by Lugaid of the Red Stripes from his Dana'an series http://nwvault.ign.c...h.detail&id=370 and nwvault.ign.com/View.php?
view=NWN2ModulesEnglish.Detail&id=474.
DannJ's Handy VFX http://www.neverwint...ds.com/mods/173 has been integrated, since it handles a number of things there are activities for but not items to equip, such as books.

Old threads: Demo release:
social.bioware.com/forum/1/topic/167/index/11399425

Original thread requesting ideas:
social.bioware.com/forum/1/topic/167/index/7761124/1

Modifié par kamal_, 05 août 2012 - 11:32 .


#2
bealzebub

bealzebub
  • Members
  • 352 messages
I downloaded this today, and it took me approx. 2 hours to set up all the npcs in an old area from my baltron's beacon .mod. Great stuff, thanks kamal

I think you should add a little to the read me, to make it clear for novice builders. Other wise you are going to get a slew of questions.
Things like a discription of the time periods, like the one from uncle fb. (act1 = hours 11-14). Maybe some info on making specific NPCs do a specific task. And the read me says nothing about the included .sef files.

This is a great product, and will prove to be a great asset to the community. thanks again.

#3
kamal_

kamal_
  • Members
  • 5 250 messages
Great. I'll make those updates to the readme tonight.

#4
PJ156

PJ156
  • Members
  • 2 983 messages
I will use this for my next project Kamal_ it sounds great.

PJ

#5
kamal_

kamal_
  • Members
  • 5 250 messages

bealzebub wrote...

I downloaded this today, and it took me approx. 2 hours to set up all the npcs in an old area from my baltron's beacon .mod. Great stuff, thanks kamal

I think you should add a little to the read me, to make it clear for novice builders. Other wise you are going to get a slew of questions.
Things like a discription of the time periods, like the one from uncle fb. (act1 = hours 11-14). Maybe some info on making specific NPCs do a specific task. And the read me says nothing about the included .sef files.

This is a great product, and will prove to be a great asset to the community. thanks again.

The specific npc's was covered under unique schedule. I've made it clearer. Also, I've added the below section on times.


The times for the beginning of an activity period are defined in the script sh_npc_randomizer. They can
be changed in that script to suit your needs if desired. Note that redefining Midnight to before actual
midnight (setting to 23 for 11pm for instance), can result in an npc selecting the wrong action. The time
periods are currently in 4 hour intervals, but there is no need for that to be the case, as long as the
periods progress through the day and Midnight occurs after actual midnight and is the first period of the
day.
Midnight: 0100
Wake: 0500
Act1: 0900
Act2: 1300
Dinner 1700
Sleep: 2100

#6
kamal_

kamal_
  • Members
  • 5 250 messages
The first update to the commoner ai will be the inclusion of "generics". I need to improve things a bit with the deciding to go home so they don't all do it at once and cause lag, and make some more generics, so this should be out in a few days.

youtube demo

New "generic" scripts trade the activity flexibility and location variability of my commoner ai for increased performance. They will come in two types, one set that has the npc go home at night, and one set that does not. They will stop their activity if they are in conversation, behave normally if they are in combat, and return to what they are doing once the conversation/combat ends.

The generics should be suitable for use with npcs that will see combat, as it builds off the sitting enemies/better sitting code. Of course if you use them with non-pc races not all animations may work. My default commoner ai does not support combat.

The "generics" do a single activity all day, the ones that "go home" will return home at night and then return to the spot for their activity the next day. They carry out their activity where they were spawned or placed, and will go back to their spot if bumped out of the way. The generics are even easier for a builder to implement than the regular commoner ai, as the only requirement for the generics is to be running the heartbeat script for the activity, no waypoints or anything else needs to be placed.

Summary:
Type 1:
At night they go home (picking a random static door in range, walk to it, and go hidden)
In the morning they carry out a single activity in one location, all day. (end being hidden, move to where they were placed/spawned, and do an activity)
Type 2:
Just carry out a single activity 24/7 where they were spawned/placed.

The animations vary during the activity, unless the activity is a single animation such as meditating.

The time to go home, and the time to wake up, are set in the heartbeat script, to make it easy to change. Not all the commoner ai activities will be included, but there's template scripts for making your own.

I should credit Kaldor Silverwand, who's sitting and bard scripts from his Silverwand Sample Campaign formed the core of the generic scripts (I don't think there's much left from his scripts).
Silverwand Sample Campaign

Modifié par kamal_, 07 janvier 2013 - 02:47 .


#7
kamal_

kamal_
  • Members
  • 5 250 messages
Version 1.1 released (at least at the Nexus, Vault's not updating yet):

The following generic activities are included and available in both "go home at night" and "24 hour" versions: bard_drum, bard_flute, bard_lute, bard_sing, cheer, dancer, forge, meditate, merchant, post, sit, sit_cards, sit_drink, sit_eat, sit_general, sit_read, sit_still, talk, reading, practice_melee, practice_ranged.

These work entirely via heartbeat, no waypoints or anything else need to be placed (though the "go home" versions require static doors in range to "go home" to.), so they are good for dropping onto npcs to add ambience.

As an added bonus, the generics should handle combat/conversation/bumping just fine, so they can be assigned to hostiles. Have your orcs sitting and eating when the hero walks in!

Modifié par kamal_, 07 janvier 2013 - 04:35 .


#8
luna_hawke

luna_hawke
  • Members
  • 88 messages
Hi Kamal. The system looks great.

Do you know if any persistent worlds run this system?
Mainly I'm curious about possible lag issues?


Thanks

#9
kamal_

kamal_
  • Members
  • 5 250 messages
luna_hawke:
I don't think any PW's run this system, I'm not aware if any have even tested it. I developed it for my single player module and have no experience developing for the performance limitations of a PW. Also, I'm not the best scripter. As far as I can tell, the full commoner ai is too resource intensive for a PW if you'd want to use it with a fair number of npcs, and you'd get lag.

bealzebub's module is the only released module using this that I'm aware of (my module isn't released yet).

The generics seem to have better performance than the full ai, and could be better suited for a PW (though they are still more resource intensive than a stock heartbeat). The generics don't change activity so often (what normally causes a lot of the lag), and don't search for random waypoints or select activities at random etc.

I've put a hundred generics in an area to test. I did not have any issues while they did their activities. I got lag when 20-30 of them decided to go home or wake up at the same time. You could edit that by having a few versions of the heartbeat with different times, or put in some random number of heartbeats to wait when the go home/wake time changes (I've already considered adding that).

Modifié par kamal_, 08 janvier 2013 - 12:24 .


#10
luna_hawke

luna_hawke
  • Members
  • 88 messages
Kamal, I forgot to add for less visited towns or example you could despawn the NPC's when nobody is in the area in a PW setting.
When someone enters the area, respawn the NPC.

In that case they would just figure out what they need to do right?

Despawning and respawning them wouldn't screw them up I would imagine?

Thanks

#11
kamal_

kamal_
  • Members
  • 5 250 messages
With the generics, they only need the heartbeat on them, so despawning and respawning shouldn't cause them any problems. They start acting on their first heartbeat, so there's a slight pause before they do anything. So unless you were spawning them right in front of players, I don't think it would be a problem.

#12
kamal_

kamal_
  • Members
  • 5 250 messages
Version 1.2 released.
Random waypoint selecting generic scripts. NPC's using these will choose a waypoint at random for their activity instead of simply remaining where spawned/placed. The random generics comes in the 24 hour and the “go home” variety. The “go home” variety choose a new activity location each day.

Adds heartbeat scripts of all four generic heartbeat types for the following new generic activities: bartender, cook, instruct, listen, sentry, shovel, sit_ground, stand_chat, woodsman, work, worship.

Adds heartbeat scripts of the new random waypoint types for the generic activities introduced in v1.1.

Waypoints categorized into Full AI and Generics. The random generics require waypoints. The random generics use waypoints with different tags so you can have random generics and full ai npcs in the same area.

Readme updated to explain the generic activity heartbeats and their usage better. Hopefullly things are clear.

More variety in the Full AI taunt activity.

That's probably it for generics.