Aller au contenu

Photo

Kamal's Commoner AI Demo/Proof of Concept


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

#1
kamal_

kamal_
  • Members
  • 5 240 messages
It's reached show time.

For visibility, the demo area does not have a daynight schedule. A pedestal at the center of the waypoints for each activity is named according to the tag of the surrounding waypoints, so you can see what surrounding npcs are doing. Debug text indicates what period of the day it is, and what activity the npc has chosen. For the demo, the time randomization has been disabled so it's clearer what is happening.

The npc's will start doing their things automatically. Talk to the any npc to advance the time and turn the alternate schedule "holiday mode" on or off. Currently, when you turn on "holiday mode", you must advance the time period for it to begin.

Readme

Demo Note:this demo currently being updated for speed and is being debugged, the include does not currently compile.

Original demo
Demo


There are some things to note about specific activities in this demo.
Training one and two, npc's equip, but no animation.
Do not use the "assassin" activity, it currently breaks the hearbeat.
Wandersweep does not equip anything, but plays animation correctly. There is no broom in the default toolset.
Npcanimate and Animatecustom do nothing, their waypoints are not in the demo area.
PracticeRanged and PracticeMelee need some work.
Wanderrandomly does strange things

See the lute players, they don't have lutes in their inventory, npcs autoequip what they need :-)
500x300http://dl.dropbox.com/u/3879894/ai_demo.jpg[/img]

Modifié par kamal_, 28 juillet 2012 - 01:24 .


#2
Kanbyen

Kanbyen
  • Members
  • 11 messages
Fun!

#3
kamal_

kamal_
  • Members
  • 5 240 messages
To change the chance of an activity, open the module in the toolset, and edit the local ints on the "Required Ipoints" or the "Alternate Ipoints" depending on which schedule you want to alter. It's straight percentage. Npc's will automatically adjust their activities based on the percentages you set.

Modifié par kamal_, 14 avril 2012 - 11:40 .


#4
M. Rieder

M. Rieder
  • Members
  • 2 530 messages
Kamal, this is shaping up to be fantastic. When the time comes, I'll be checking this out to set up my city ambience. God! It will be so much easier than having to script it all myself. Much better too, from the looks of things. Great job.

#5
kamal_

kamal_
  • Members
  • 5 240 messages

M. Rieder wrote...

Kamal, this is shaping up to be fantastic. When the time comes, I'll be checking this out to set up my city ambience. God! It will be so much easier than having to script it all myself. Much better too, from the looks of things. Great job.

Using this system, it should take no more than an hour to do the ambiance npcs for a external area of a town, and probably 30 minutes or less once you familiarize yourself with the system, unless you want to have a very wide variety of activities going on (requiring placing of lots of waypoints).

One of the nice things about the system is that because the npc's only need the heartbeat, that 30 minutes or less to implement ambiance for an area is pretty much the same no matter how large the town is. The extra implementation time for a town of 100 versus a town of 10 is how long it takes you to place the extra npcs on the map, or change your spawn script to 100 from 10.

If you use Apep's dynamic commoners (http://nwvault.ign.c...s.Detail&id=162) like I am for my work, you don't even need to edit the appearance/dress/name of the townsfolk, they can do that automatically too. Any size town of random appearance/dress/sounding/named commoners carrying out their lives, in an hour or so, is the goal.

Implementing activity schedules for important npcs with the unique schedule functionality should take 10-15 minutes per npc, mostly in editing the tags of the ipoints and waypoints you place for that npc's use.

Modifié par kamal_, 15 avril 2012 - 01:59 .


#6
kamal_

kamal_
  • Members
  • 5 240 messages
Other than generic town exterior, some use cases I've come up with for this sytem.

Npc's to a tavern, where they enter in the morning, sit and drink/eat during the day, and get up from their seats in the evening and some play in an impromptu band while others dance, then leave late at night until the next morning. (SitDinner, BardSong, Guitar, Lute, Drum, DanceMale, DanceFemale, Clap, GoHome)

Mourners in a graveyard (Sad, Kneeltalk, GoHome)

Temple interior (Worship, Meditate, Instruct, GoHome)

Prisoners (Cower, SitGround, SleepNonBed)

Shopkeepers (Work, TendStore, GoHome)

Modifié par kamal_, 15 avril 2012 - 02:09 .


#7
bealzebub

bealzebub
  • Members
  • 352 messages
I just finished checking out yer demo. It seemed to work as advertised. A few wonky animations, such as when a npc went from NpcForging to NpcSitdinner, he would jump up periodicaly and hit the anvil, then go back to eating.
I've been having a hard time with Uncle FB's, and I'm looking forward to giving this a try.

#8
M. Rieder

M. Rieder
  • Members
  • 2 530 messages
Kamal, now you have my mouth watering! One hour for a whole town? Unheard of! This will save days - literally days if not weeks!!!

#9
I_Raps

I_Raps
  • Members
  • 1 262 messages

bealzebub wrote...

A few wonky animations, such as when a npc went from NpcForging to NpcSitdinner, he would jump up periodicaly and hit the anvil, then go back to eating.


I'm not sure what's "wonky" about that - substitute "keyboard" for "anvil" and you've described my typical eating habits perfectly.

#10
rjshae

rjshae
  • Members
  • 4 485 messages

I_Raps wrote...

bealzebub wrote...

A few wonky animations, such as when a npc went from NpcForging to NpcSitdinner, he would jump up periodicaly and hit the anvil, then go back to eating.


I'm not sure what's "wonky" about that - substitute "keyboard" for "anvil" and you've described my typical eating habits perfectly.


What, you don't eat off the keyboard? :whistle:

This all sounds excellent. Can't wait to give it a go. It certainly sounds simpler than the big town behavior spreadsheet I'd been working on.

Modifié par rjshae, 16 avril 2012 - 09:43 .


#11
nicethugbert

nicethugbert
  • Members
  • 5 209 messages
NEAT!

Hmm, I wonder what PJ156 would make of this. He had his town NPCs on a schedule.

#12
kamal_

kamal_
  • Members
  • 5 240 messages
bealzebub : Thanks for letting me know. While I did test every activity, testing every combination would be time prohibitive. I have seen some oddities once in a while, like an npc suddenly adopting the animation they are only supposed to play once they reach their waypoint.

M. Rieder and rjshae: the ipoints and waypoints are included in the demo module, you could just add another blank area to the module and play with things. The readme should be enough information for building. Give it a try and let me know if things aren't clear.

nicethugbert : PJ156 uses Uncle FB's npc control, in fact I'd wager he knows more about it than even Uncle FB himself at this point. I emailed FB at one point with a question on something, and FB said he hadn't looked at the code in a few years. My code has lots of heavily altered Uncle FB code, and I've asked a few questions of PJ156 and Lugaid to make sure my implementation is keeping things "the way they should work".

Modifié par kamal_, 16 avril 2012 - 10:59 .


#13
M. Rieder

M. Rieder
  • Members
  • 2 530 messages
One thing I would really like to see added are some bawdy dancing half-orc wenches.... is that possible with this system? It it is, you are my hero forever.

#14
kamal_

kamal_
  • Members
  • 5 240 messages

M. Rieder wrote...

One thing I would really like to see added are some bawdy dancing half-orc wenches.... is that possible with this system? It it is, you are my hero forever.

Drop in female half orcs, assign half the DanceFemale activity and half the Drink activity. (AnimalGraze also works, it's a standing drink animation)
:sick:

Modifié par kamal_, 17 avril 2012 - 01:07 .


#15
rjshae

rjshae
  • Members
  • 4 485 messages

kamal_ wrote...

M. Rieder wrote...

One thing I would really like to see added are some bawdy dancing half-orc wenches.... is that possible with this system? It it is, you are my hero forever.

Drop in female half orcs, assign half the DanceFemale activity and half the Drink activity. (AnimalGraze also works, it's a standing drink animation)
:sick:


Don't forget the "Save vs. Will or go temporarily blind" effect. :blink:

#16
nicethugbert

nicethugbert
  • Members
  • 5 209 messages
Beer Googles: -10 will save vs. dancing female half orcs. Cursed Item.

#17
Tchos

Tchos
  • Members
  • 5 042 messages
When I was testing this, I couldn't advance the time forward without introducing a few seconds of freezing on every heartbeat, so I sat and watched a full cycle without advancing the time (starting with the change to midnight). It ran smoothly then, but when the time period eventually changed to the time period following midnight, everything ground to a halt, with a message in the box saying that there was an invalid male dance waypoint. The screen froze completely, with tiny stutters of movement every 12 seconds or so, followed by another long freeze, etc. Any idea what could fix that?

Also, is it possible to use this system to make NPCs engage in two-by-two conversations? Conversation waypoints don't seem to check to see if there's anyone nearby, and in this case, they ended up talking to themselves.

Is it possible to use this to have an NPC wander around the city, and if they happen to pass near a point-of-interest waypoint, they may randomly choose to stop and perform the activity there? How about if they pass near another NPC, they may choose to stop and chat with each other for a short time? Is there any wandering activity setting that can allow an NPC to do more than one task within a time period?

Adding some notes to what you've already noted, "drinking" NPCs don't equip cups. "Mingle" NPCs stand and do nothing. NPCs that had equipped spoons for cooking don't unequip them when they go do something else.

#18
Dann-J

Dann-J
  • Members
  • 3 161 messages

Tchos wrote...

Adding some notes to what you've already noted, "drinking" NPCs don't equip cups.


I'm including the ability to sit and eat/drink in my next module. It's a real pain to script though - drinking animations all use the offhand, so you have to have something else equipped in the right hand to be able to have the stein in the left. I settled on spawning a dagger and a stein and equipping them both. Even then, the dagger cuts into the character's face a bit when they play an eating animation, and they try to disembowl themselves with some of the sitting conversation animations. The spoon is even worse though, since it's a lot longer than a dagger.

I'm thinking it'd be easier to create a beer stein model VFX that attaches to the left hand, rather than equip an actual item. Then apply and remove the VFX as necessary. That means I'll have to completely re-do my scripts though (just when I got the current method working - bar the occasional self mutilation attempt).

#19
kamal_

kamal_
  • Members
  • 5 240 messages

Tchos wrote...

When I was testing this, I couldn't advance the time forward without introducing a few seconds of freezing on every heartbeat, so I sat and watched a full cycle without advancing the time (starting with the change to midnight). It ran smoothly then, but when the time period eventually changed to the time period following midnight, everything ground to a halt, with a message in the box saying that there was an invalid male dance waypoint. The screen froze completely, with tiny stutters of movement every 12 seconds or so, followed by another long freeze, etc. Any idea what could fix that?

Also, is it possible to use this system to make NPCs engage in two-by-two conversations? Conversation waypoints don't seem to check to see if there's anyone nearby, and in this case, they ended up talking to themselves.

Is it possible to use this to have an NPC wander around the city, and if they happen to pass near a point-of-interest waypoint, they may randomly choose to stop and perform the activity there? How about if they pass near another NPC, they may choose to stop and chat with each other for a short time? Is there any wandering activity setting that can allow an NPC to do more than one task within a time period?

Adding some notes to what you've already noted, "drinking" NPCs don't equip cups. "Mingle" NPCs stand and do nothing. NPCs that had equipped spoons for cooking don't unequip them when they go do something else.

Quick note before I go to work...
Inavlid waypoint messages should happen if there are no correctly named waypoints for an action in the area, or possibly if more npc's select an action than there are waypoints for the action (though I thought I caught that and gave them ambient animations when that happened).

2 by 2? Not sure if possible.

Point of interest? The default case (activity 200) is supposed to be ambient animation, which is supposed to pay attention to points of interest. Making a wandering npc do that I guess would be possible.

Only one task per time period. The time randomization code (disabled in the demo) does make an individuals time period not exactly the default period length, so an activity might not last a full period.

#20
rjshae

rjshae
  • Members
  • 4 485 messages

DannJ wrote...

Tchos wrote...

Adding some notes to what you've already noted, "drinking" NPCs don't equip cups.


I'm including the ability to sit and eat/drink in my next module. It's a real pain to script though - drinking animations all use the offhand, so you have to have something else equipped in the right hand to be able to have the stein in the left. I settled on spawning a dagger and a stein and equipping them both. Even then, the dagger cuts into the character's face a bit when they play an eating animation, and they try to disembowl themselves with some of the sitting conversation animations. The spoon is even worse though, since it's a lot longer than a dagger.

I'm thinking it'd be easier to create a beer stein model VFX that attaches to the left hand, rather than equip an actual item. Then apply and remove the VFX as necessary. That means I'll have to completely re-do my scripts though (just when I got the current method working - bar the occasional self mutilation attempt).


That would also be cool. The current sit-and-drink animations look a bit daft right now with the off hand empty. I tried it with a weapon model that had the shaft and head removed, but it doesn't show up.

#21
kamal_

kamal_
  • Members
  • 5 240 messages

rjshae wrote...

DannJ wrote...

Tchos wrote...

Adding some notes to what you've already noted, "drinking" NPCs don't equip cups.


I'm including the ability to sit and eat/drink in my next module. It's a real pain to script though - drinking animations all use the offhand, so you have to have something else equipped in the right hand to be able to have the stein in the left. I settled on spawning a dagger and a stein and equipping them both. Even then, the dagger cuts into the character's face a bit when they play an eating animation, and they try to disembowl themselves with some of the sitting conversation animations. The spoon is even worse though, since it's a lot longer than a dagger.

I'm thinking it'd be easier to create a beer stein model VFX that attaches to the left hand, rather than equip an actual item. Then apply and remove the VFX as necessary. That means I'll have to completely re-do my scripts though (just when I got the current method working - bar the occasional self mutilation attempt).


That would also be cool. The current sit-and-drink animations look a bit daft right now with the off hand empty. I tried it with a weapon model that had the shaft and head removed, but it doesn't show up.

Any improvements people make, please submit and I can add it and give you credit!

#22
rjshae

rjshae
  • Members
  • 4 485 messages

kamal_ wrote...

Any improvements people make, please submit and I can add it and give you credit!


First I'll just say that I haven't tried this yet because it looked to have a lot of stuff to go through for something that is still in beta, and right now just working on a module is taking up most of my hobby time. But it does sound like something I'd like to incorporate later on in the module.

I wanted to ask whether this will include something for posted NPCs that will randomly look and/or turn in reaction to NPCs and PCs moving in their vicinity? I.e. I wanted to have "lurkers" who just watch movement in their immediate neighborhood. I'm using something like that for guards who turn to face PCs as they are detected, but I was hoping for something more comprehensive and flexible.

Thanks!

#23
kamal_

kamal_
  • Members
  • 5 240 messages

rjshae wrote...

kamal_ wrote...

Any improvements people make, please submit and I can add it and give you credit!


First I'll just say that I haven't tried this yet because it looked to have a lot of stuff to go through for something that is still in beta, and right now just working on a module is taking up most of my hobby time. But it does sound like something I'd like to incorporate later on in the module.

I wanted to ask whether this will include something for posted NPCs that will randomly look and/or turn in reaction to NPCs and PCs moving in their vicinity? I.e. I wanted to have "lurkers" who just watch movement in their immediate neighborhood. I'm using something like that for guards who turn to face PCs as they are detected, but I was hoping for something more comprehensive and flexible.

Thanks!

As far as beta versus release, other than getting the individual activities working that aren't, the code's in pretty good shape. There shouldnt (becuase never say never) be changes to how you would implement things as a builder..

I'm assuming you're editing the perception scripts to have your guards face the pc? I'm purposefully trying to keep everything called only from a heartbeat script, so I would have to say that idea probably wouldn't be doable unless you added significant code. I would think whatever you're doing to get the guards to face the pcs would work with my scripts though. Once the npc reaches it's waypoint and faces it, it doesn't reset it's facing (iirc, I've been working on other things and not this recently).. If you're doing the facing the PC via some action, this could be added to the scripts I have as an activity, and there are template activities defined as well as instructions on adding new activities.

#24
rjshae

rjshae
  • Members
  • 4 485 messages

kamal_ wrote...

As far as beta versus release, other than getting the individual activities working that aren't, the code's in pretty good shape. There shouldnt (becuase never say never) be changes to how you would implement things as a builder..

I'm assuming you're editing the perception scripts to have your guards face the pc? I'm purposefully trying to keep everything called only from a heartbeat script, so I would have to say that idea probably wouldn't be doable unless you added significant code. I would think whatever you're doing to get the guards to face the pcs would work with my scripts though. Once the npc reaches it's waypoint and faces it, it doesn't reset it's facing (iirc, I've been working on other things and not this recently).. If you're doing the facing the PC via some action, this could be added to the scripts I have as an activity, and there are template activities defined as well as instructions on adding new activities.


Thanks.

Hmm, now that I think about it, I could probably use a trigger area to turn the head or change the facing of a particular NPC. (Head tracking like they have in Dragon Age II would be a lot more work.) Think I'll give the trigger idea a try.



... tried it; works like a charm. Kind of a nice effect too. :)

Modifié par rjshae, 01 juin 2012 - 03:28 .


#25
Dann-J

Dann-J
  • Members
  • 3 161 messages

kamal_ wrote...

Any improvements people make, please submit and I can add it and give you credit!


I've uploaded various VFX that replace the need to create and equip hand-held items:

http://www.neverwint...ds.com/mods/173

Drinking animations now have the choice of beer stein, wine bottle (chianti) or chalice.

It's a lot easier applying and removing model FX attached to the hands than it is spawning items in the inventory and equipping them.