COMMUNITY - FORUMS - SOULBORN ENGINE
Know Your Place: NPC Scripting

I have read a lot of discussion about NPCs and how they might be scripted for certain behaviors. I love the idea of creating some basic qualities that could govern NPC behavior and having those qualities work within the framework of the NPC's environment to determine behavioral outcomes. I believe looking at an NPC's nature, nurture, and experience when determining behavior scripts would be a great way to fill the world with interesting and complex non-playable characters.

Nature

Nature would govern the NPCs bonuses based on ethnic heritage and perhaps also encompass gender. If a certain ethnic group gains a bonus that benefits a particular tree of skills, NPCs of that ethnicity might favor going into professions that use those skills in order to make the most of them. Likewise, if gender begins to skew more towards males or females, either because of character death or birth rates, NPCs of the more dominate gender could engage in "higher risk" activities, leading to a potential drop off of that gender and a balancing of the NPC/PC gender ratio. For example, NPCs could be set to maintain the status quo, reproducing enough children to replace themselves when they die. If NPCs die unnaturally, some NPCs will produce more children to make up for that. If too many children are produced, some NPCs will engage in high risk behaviors in order to thin their own numbers.

Nurture

Nurture would govern the family the NPC was born into. If a NPC's parents have behavior scripts for being bakers or criminals, then they could likely inherit these scripts. Alternatively, they may generate a different script, mimicking aspirations, prioritizing other professions that use similar skills sets, skill sets that use their favored attributes, or professions based on higher risk.

Experience

As an NPC ages and their physical skills, mental skills, and social skills shift, they should also shift their behavior scripts to reflect this. Middle-aged NPCs should spend their time teaching their trade to other NPCs, while Older NPCs should spend more time sitting or lounging in in-activity, giving PCs a chance to engage with older NPCs socially more often.

What sort of factors would you like to see NPC scripting use in order to determine behaviors?


11/3/2016 8:08:24 PM #1

While I'd love something that envovled I'll be satisfied with "doesn't get stuck pathing into a box".

To be honest I think your ideas are great but a bit out of the league of a MMO. More likely you will have a choice of combat/flight and basic crafting and gathering. Doubt they will get anywhere close to being advanced enough to change behavior.

As I understand how the engine works each NPC has a favor log of people near them and a listing of needs. If needs aren't being met they ask for someone to meet those needs by proposing a contract and offering certain rewards based on their valuables (or favor) to get it completed.

Something to keep in mind. Caspain originally said NPCs were filler until there were enough players to fill a server.

His original goal was zero npcs in the world.

11/17/2016 4:28:09 PM #2

Can devs release a scripting mechanic/app for players to learn, practice and test before this game comes online? We could exchange, trade, and work together to make the best scripts.


12/7/2016 5:15:11 AM #3

I'd love to see something like that!


12/7/2016 9:36:49 AM #4

Certainly seems to be achievable, though there are many ways to approach it. No doubt NPCs like animals will be using improbable's engine.

Each will have defined attributes and could potentially have characteristics stored. There are many ways to approach this, but one approach for skills might be:

  • A child is born. It begins with attributes and a small amount of skill from it's parent's. A second and perhaps third (very low, random) skill may also be assigned. The same survival rules used for animals may be at the core of behavior. At a very high level for example: 1) If being attacked / attacked recently or hostile spotted, if "courage" > "level of danger, including current health", fight aggressor, otherwise flee. 2) If hungry or thirsty, and I'm able to, seek food. 3) If tired, look for the best place to sleep.

  • There should be core behaviors that take priority above "comfort" and "event" behaviors. The above should effectively be "trigger" behaviors which can escalate to the highest priority ie 100. Below that, other triggers may steer behavior with lower priority events. Each "trigger" may have several layers of priority it can shift between, as conditions are met. A "hunger" trigger for example may start low, and gradually rise as thresholds are passed. Once it becomes more important than the other triggers, it takes priority, assuming it's (for example) at least 10 priority points higher than the current "action in progress".

  • For "lifestyle" triggers, NPCs wanting greater comfort or larger families may assess their ability to pay for it. If they consistently fail to be able to afford what they want, their "work ethic" should increase, but depending on their nature, their "criminal inclination" may alternatively increase. Obviously over time, triggers may just as easily drop off.

  • Work chosen may be steered by the NPCs ability to do that work. If they have family, there may be triggers to "train family", "feed family", "provide for family" etc. Events locally or within the region may trigger other behaviors.

  • For work, any number of events, such as the generic "earn money" may trigger a "work" event. The "work" events may in turn have a table of different work options with weightings which can adjust over time. If you become less effective at a job, it may drop down your list. Training someone else may subsequently become higher. If there's no demand for your goods, it may drop down the list, while others with available facilities may rise. This might be a simple list of "Job" (ie mining, carpentry, mercenary if available etc), "Factor" (ie skill, current local margin / prices, demand, available station), "Value" (ie amazingly high skill might be 80, no demand and low margin might be 10, no local crafting station might be 0 - you could still walk to another, or look at building options?). Perhaps these could be simply added up when "work" events are triggered, with the highest total coming out on top, and a "work carpentry" event being triggered with for example "priority 60", and being stopped when something else passes 70. In this work weighting table, nature and nurture could play a part in the decision process.


12/7/2016 11:43:13 AM #5

Like Malais says, I just hope they can make AI that doesn't get stuck on random tree roots and stuff. Would be annoying having an NPC employee who's meant to be gathering firewood for you but just spent 2 hours walking against a tree and then comes back to collect its pay.

I imagine programming NPCs to be able to co-exist in a massive, almost sandbox world is no easy feat. Unless it's one of the things Caspian has been working on for years before KS I think they'll have their work cut out.

All the more reason to get sharing the game with friends! The more players, the fewer NPCs! ;)


12/7/2016 2:09:42 PM #6

as the usual player will create about 4-5 potential heirs to have a joung one when he dies, and 3-4 of those potential heirs will actually be NPCs as they dont get chosen, i dont see a world without NPCs ever. if they stay with the idea of childs growing up and not being agestuck at 15, there is just no way to have a world without NPCs ever and therefore, they need scripts that at least allow NPC-only settlements to function properly. CoE will not work as a game, if the NPC AI is poor.


Friend Code: 30EF47

12/7/2016 2:21:41 PM #7

Posted By Gromschlog at 08:09 AM - Wed Dec 07 2016

as the usual player will create about 4-5 potential heirs to have a joung one when he dies, and 3-4 of those potential heirs will actually be NPCs as they dont get chosen, i dont see a world without NPCs ever. if they stay with the idea of childs growing up and not being agestuck at 15, there is just no way to have a world without NPCs ever and therefore, they need scripts that at least allow NPC-only settlements to function properly. CoE will not work as a game, if the NPC AI is poor.

To have that many heirs you will need a large house.

Each child will require at minimum 1 bed and a package of starter items for when they come of age. Regardless of if you choose to use them as an heir there is always the possibility someone else might. So without those items you won't be able to have a child.

Nobles and wealthy characters will likely have 3-4 commoners will likely have fewer.

12/7/2016 2:22:51 PM #8

Good points!


12/7/2016 2:35:22 PM #9

Posted By Malais at 3:21 PM - Wed Dec 07 2016

Posted By Gromschlog at 08:09 AM - Wed Dec 07 2016

as the usual player will create about 4-5 potential heirs to have a joung one when he dies, and 3-4 of those potential heirs will actually be NPCs as they dont get chosen, i dont see a world without NPCs ever. if they stay with the idea of childs growing up and not being agestuck at 15, there is just no way to have a world without NPCs ever and therefore, they need scripts that at least allow NPC-only settlements to function properly. CoE will not work as a game, if the NPC AI is poor.

To have that many heirs you will need a large house.

Each child will require at minimum 1 bed and a package of starter items for when they come of age. Regardless of if you choose to use them as an heir there is always the possibility someone else might. So without those items you won't be able to have a child.

Nobles and wealthy characters will likely have 3-4 commoners will likely have fewer.

usually, in old times, people had many children and the children would help with daily work. the only reason to have a small amount of children was, that you are unable to get children. as this game plays in times where it was a common practise to have lots of children, i would not calculate with it being otherwise. you can still put several beds in one room as it was common in those times and have the whole family sleep in one or two rooms. a house with 2 or 3 rooms is not a large house. we are not in new age where everyone needs private areas and a house has to have a kitchen, living room, eating room, music/party room, several bathrooms etc. a bed wont be that expensive and the children will earn whats needed to feed them once they are able to do so. you dont need to give your children starter items, but it shouldnt be a problem to do so either. usually, if you get one child each 5-10 years to have on approximately at age of 15-20 to start when you die, you will just keep every children in your house and marry/send it away when its 20-25 (when the next one reaches the age of 15). even if the child only really works for you from 15-20, 5 years of work should clearly be enough to give him a pack of starter items when its time to do so. and you know... actually you dont even need a bed. a bag full straw and a blanket fulfill that job, too. the only reason why people did not have really really many children in early days is, that most of their children died. i dont see that coming in CoE. it was usual, that a woman got pregnant like 10 times, but only 5-7 got born alive and 2-3 children got older than 5 years.

Children dont cost money, they make you wealthy ;) (sure they cost money, but its worth it in the long run (and im not talking of today)) If SbS makes a child system that does not pay off, that might be otherwise. but it would be unrealistic.


Friend Code: 30EF47

12/7/2016 3:51:20 PM #10

If I'm not mistaken, you are limited to one child per room. You can't just pile 15 beds in a good size room and have 13 children.


Join Freeport County, we like boats. And dogs.

12/7/2016 5:03:48 PM #11

Posted By Antelino at 4:51 PM - Wed Dec 07 2016

If I'm not mistaken, you are limited to one child per room. You can't just pile 15 beds in a good size room and have 13 children.

would not make any sense, but would solve the problem of overpopulation with NPCs maybe. Can I determine how big rooms are in my house? If i can decide between 2 rooms with 20m^2 each and 8 rooms with 5m^2, i think i see where it gets, if thats the chosen limitation for kids. however... its getting offtopic. NPC scrips will be needed because NPCs will always exist. Although it would be cool, if there were enough players to not have any NPC left, i just dont see it happen. And without any NPCs, how would new players get in the game? There will just always be NPCs and i actually hope a decent number of them. There is work that players tend to dislike and want to be done by NPCs.


Friend Code: 30EF47

12/7/2016 5:31:45 PM #12

Posted By Gromschlog at 11:03 AM - Wed Dec 07 2016

Posted By Antelino at 4:51 PM - Wed Dec 07 2016

If I'm not mistaken, you are limited to one child per room. You can't just pile 15 beds in a good size room and have 13 children.

would not make any sense, but would solve the problem of overpopulation with NPCs maybe. Can I determine how big rooms are in my house? If i can decide between 2 rooms with 20m^2 each and 8 rooms with 5m^2, i think i see where it gets, if thats the chosen limitation for kids. however... its getting offtopic. NPC scrips will be needed because NPCs will always exist. Although it would be cool, if there were enough players to not have any NPC left, i just dont see it happen. And without any NPCs, how would new players get in the game? There will just always be NPCs and i actually hope a decent number of them. There is work that players tend to dislike and want to be done by NPCs.

SBS has stated you have to have 1 bed and a bundle of goods per kid like I mentioned above. Forgive me I failed to mention that currently you can only have 1 bed per room as well which is why I said you'd need a large house.

12/7/2016 6:28:16 PM #13

Posted By Malais at 6:31 PM - Wed Dec 07 2016

Posted By Gromschlog at 11:03 AM - Wed Dec 07 2016

Posted By Antelino at 4:51 PM - Wed Dec 07 2016

If I'm not mistaken, you are limited to one child per room. You can't just pile 15 beds in a good size room and have 13 children.

would not make any sense, but would solve the problem of overpopulation with NPCs maybe. Can I determine how big rooms are in my house? If i can decide between 2 rooms with 20m^2 each and 8 rooms with 5m^2, i think i see where it gets, if thats the chosen limitation for kids. however... its getting offtopic. NPC scrips will be needed because NPCs will always exist. Although it would be cool, if there were enough players to not have any NPC left, i just dont see it happen. And without any NPCs, how would new players get in the game? There will just always be NPCs and i actually hope a decent number of them. There is work that players tend to dislike and want to be done by NPCs.

SBS has stated you have to have 1 bed and a bundle of goods per kid like I mentioned above. Forgive me I failed to mention that currently you can only have 1 bed per room as well which is why I said you'd need a large house.

or small rooms.


Friend Code: 30EF47

12/7/2016 6:28:58 PM #14

Then we need to buy more house lol ! Npc scripting would be usefull.