# The Month of the NPC - Roadplan in OP, creature-rewrite branch in repo

**URL:** <https://discourse.cataclysmdda.org/t/the-month-of-the-npc-roadplan-in-op-creature-rewrite-branch-in-repo/3188>\
**Category:** The Lab\
**Created:** [September 23, 2013, 9:57pm UTC](https://discourse.cataclysmdda.org/t/the-month-of-the-npc-roadplan-in-op-creature-rewrite-branch-in-repo/3188 "2013-09-23T21:57:00Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![kevin.granade](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/kevin.granade/32/1316_2.png) [@kevin.granade](https://discourse.cataclysmdda.org/u/kevin.granade)\
**Post date:** [September 26, 2013, 5:32pm UTC](https://discourse.cataclysmdda.org/t/the-month-of-the-npc-roadplan-in-op-creature-rewrite-branch-in-repo/3188/21 "2013-09-26T17:32:56Z")

</div>

> [@An0n3](#):
>
> be careful about lumping NPC’s into the same creature group as players though, you wouldn’t want them to all starve to death in the first week because whoops hunger/thirst.

Says who? \<_\<  
The code is even worse than you think though, the hunger/thirst/fatigue clocks aren’t even implemented in the player class, they’re in the main game loop \>_\<  
So NPCs have those stats, but they don’t decriment.  
That is an example of something we’d want seperate for players vs NPCs, we might want NPCs to eat, drink, and sleep, but the system probably needs to be different from the one for players.

---

<div class="post-metadata">

**Author:** ![GlyphGryph](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/glyphgryph/32/847_2.png) [@GlyphGryph](https://discourse.cataclysmdda.org/u/GlyphGryph)\
**Post date:** [September 26, 2013, 5:57pm UTC](https://discourse.cataclysmdda.org/t/the-month-of-the-npc-roadplan-in-op-creature-rewrite-branch-in-repo/3188/22 "2013-09-26T17:57:15Z")

</div>

For now I’d say we wouldn’t want them to do it at all.

We should decide what the bare basic requirements are going to be the NPCs, actually.

I have down:  
Have names  
Have inventory (and a way to spawn them with something held and in their “pack”)  
Have mutations and bionics  
Are able to decide to attack/ignore/flee from other mobs depending on circumstance. (probably pretty simple)  
Able to fire weapons/use ranged bionics to attack enemies.  
Able to equip appropriate equipment.  
Player can initiate communication with them  
Able to hand out quest hooks and reward player for quest hooks

Right now I think this is the core of what we need from the in-game NPCs - I’d be interested in seeing what else you think we need from them. We know the current code is buggy for them, so I’d prefer to chop out as much of the cruft as possible. For this initial implementation I won’t worry about their weight limit or volume limit and will probably have basic rules for behaviour and equipment management. There won’t be any handing off of items or buying or selling or tracking of gratitude except as a reward for quest hooks, which will probably be pretty simplified.  
But I might be missing something else we need - this is mostly to obtain “functional NPCs that meet Kickstarter requirements”.

---

<div class="post-metadata">

**Author:** ![StopSignal](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/stopsignal/32/1923_2.png) [@StopSignal](https://discourse.cataclysmdda.org/u/StopSignal)\
**Post date:** [September 26, 2013, 6:16pm UTC](https://discourse.cataclysmdda.org/t/the-month-of-the-npc-roadplan-in-op-creature-rewrite-branch-in-repo/3188/23 "2013-09-26T18:16:37Z")

</div>

Well, i think that is very basic. We should point higher.

What about having a “Goal” thing for them.

I mean, what they need. They are hungry? Goal, FOOD|FIND\_MEAT, MAKE\_FIRE (magical fires that don’t need something to be lighted, and they try to avoid making them near things), GENERATE\_COOKED\_MEAT. Thirsty? Goal, BOTTLE, WATER, MAKE\_FIRE (magical fires that don’t need something to be lighted, and they try to avoid making them near things), GENERATE\_CLEAN\_BOTTLED\_WATER. Cold? Goal, CLOTHES (those are added to them magically). Hot? REMOVE\_CLOTHES. Tired? Goal, FIND\_SAFE\_ZONE (place with no bad creatures nearby and sleep) Wounded? Goal, FIRST\_AID|BANDAGES.

If they trade and need desperately one of those items, then they will pay more.

---

<div class="post-metadata">

**Author:** ![kevin.granade](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/kevin.granade/32/1316_2.png) [@kevin.granade](https://discourse.cataclysmdda.org/u/kevin.granade)\
**Post date:** [September 26, 2013, 6:35pm UTC](https://discourse.cataclysmdda.org/t/the-month-of-the-npc-roadplan-in-op-creature-rewrite-branch-in-repo/3188/24 "2013-09-26T18:35:42Z")

</div>

I get where you’re coming from, but that falls squarely into “AI”, which really doesn’t matter for what we’re concerned with right now, which is just making them work at all. If the game interactions work, it’s a matter of implementation on the AI side of things to get goal-oriented behavior.  
In other words, implementation at the level we’re considering shouldn’t limit how AI works, so it doesn’t matter at the moment.  
There will be a ton of NPC-specific code to evaluate various things, like compare food types to each other.

As for the list, I’d add Navigate/move, which is actually kind of hard, I guess we can have them just wander at random or not move by default, the second has the benefit of being less likely to get them killed.  
Probably want to explicitly exclude activating items for now, that’s the source of a lot of NPC crashes at the moment.  
Might be implied already, but they should be able to deliver any backer-supplied conversation.  
Do we want to worry about roles at the moment? I’m guessing no, and just ditch all the doctor/trader/ninja crap that’s in there right now, they’re all just trying to survive.  
Take damage, be affected by fields, or is that implied as shared by all creatures?  
Die. diediediedidiediedie  
I’m guessing we’re going to say no to becoming a player follower at first, which is a bummer since it’s a regression, but making that work right is also potentially very difficult.

How about this, at what point are we going to wreck the existing NPCs? In other words how long can we limp along with both new and old NPCs so we don’t have to have NPC features regress?

---

<div class="post-metadata">

**Author:** ![GlyphGryph](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/glyphgryph/32/847_2.png) [@GlyphGryph](https://discourse.cataclysmdda.org/u/GlyphGryph)\
**Post date:** [September 26, 2013, 8:49pm UTC](https://discourse.cataclysmdda.org/t/the-month-of-the-npc-roadplan-in-op-creature-rewrite-branch-in-repo/3188/25 "2013-09-26T20:49:37Z")

</div>

StopSignal, I… don’t think you understand the point of “basic requirements”. \>\_\>

> [@Kevin Granade](#):
>
> As for the list, I’d add Navigate/move, which is actually kind of hard, I guess we can have them just wander at random or not move by default, the second has the benefit of being less likely to get them killed.

I think they will not move in most situations, and only in response to “threats” - either to flee or attack. There will obviously need to be some sort of navigation at work there though.

> [@Kevin Granade](#):
>
> Probably want to explicitly exclude activating items for now, that’s the source of a lot of NPC crashes at the moment.

Agreed. This reminds me that they WILL need to be able to reload, though.

> [@Kevin Granade](#):
>
> Might be implied already, but they should be able to deliver any backer-supplied conversation.

I don’t think I’m going to worry about that for the first go. As long as they can converse at all I’m happy, which will be needed for quests.  
Do we want to worry about roles at the moment? I’m guessing no, and just ditch all the doctor/trader/ninja crap that’s in there right now, they’re all just trying to survive. And there aren’t actually any conversation-related kickstarter rewards.

[quote=“Kevin Granade, post:24, topic:3188”]Take damage, be affected by fields, or is that implied as shared by all creatures?  
Die. diediediedidiediedie[/quote]  
This should be true of ComplexCreatures in general, since NPCs will have the same body plan and damage calculations players do. But it should go on the list, yes.

> [@Kevin Granade](#):
>
> I’m guessing we’re going to say no to becoming a player follower at first, which is a bummer since it’s a regression, but making that work right is also potentially very difficult.

Yeah, that’s right out for now. Want to get a stable bug free foundation fully realized before even considering it.

> How about this, at what point are we going to wreck the existing NPCs? In other words how long can we limp along with both new and old NPCs so we don't have to have NPC features regress?

NPCs aren't included in core right now, and the regression is something I think most players would accept in exchange for it being bugfree and mainlined. There will certainly be some whining, but I think we want to avoid having both systems in place at the same time, and I'd rather hae "on-by-default" NPCs for .9 than insure our NPCs are as "feature rich" as the ones we currently have.

On the other hand, I think becoming a follower would be a pretty natural expansion of the work I’ll be doing here that won’t take long to get implemented once this goes in - I strongly suspect it won’t be a problem, and I suspect that this is the only major regression issue people are likely to care about.

I did think of one more requirement: Spawn Rules. We need to figure out where and how they’ll be spawned, keeping in mind we don’t need to use the system that exists right now there might be better ways to do that. For basic requirements, I’m probably just going to spawn them statically on squares in some buildings, like shelters.

---

<div class="post-metadata">

**Author:** ![An0n3](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/an0n3/32/2257_2.png) [@An0n3](https://discourse.cataclysmdda.org/u/An0n3)\
**Post date:** [September 26, 2013, 8:54pm UTC](https://discourse.cataclysmdda.org/t/the-month-of-the-npc-roadplan-in-op-creature-rewrite-branch-in-repo/3188/26 "2013-09-26T20:54:00Z")

</div>

You mean I can’t have bugged out entities handing me lit sticks of dynamite as quest rewards anymore?

DARN.

---

<div class="post-metadata">

**Author:** ![GlyphGryph](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/glyphgryph/32/847_2.png) [@GlyphGryph](https://discourse.cataclysmdda.org/u/GlyphGryph)\
**Post date:** [September 26, 2013, 9:02pm UTC](https://discourse.cataclysmdda.org/t/the-month-of-the-npc-roadplan-in-op-creature-rewrite-branch-in-repo/3188/27 "2013-09-26T21:02:25Z")

</div>

At least short term I’ll probably make rewards hardcoded from a quest reward list.

---

<div class="post-metadata">

**Author:** ![kevin.granade](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/kevin.granade/32/1316_2.png) [@kevin.granade](https://discourse.cataclysmdda.org/u/kevin.granade)\
**Post date:** [September 26, 2013, 9:05pm UTC](https://discourse.cataclysmdda.org/t/the-month-of-the-npc-roadplan-in-op-creature-rewrite-branch-in-repo/3188/28 "2013-09-26T21:05:45Z")

</div>

> [@An0n3](#):
>
> You mean I can’t have bugged out entities handing me lit sticks of dynamite as quest rewards anymore?

No, they’ll do it INTENTIONALLY now 😉

Re: Navigation, one area it’d be easy to improve on the existing behavior is to have them “want” to stay in their assigned place. So if they spawn in the shelter, they might run out and attack something, but then once the threat is past they’ll wander back inside.

Unlike the existing shelter NPC, who will steadily migrate further and further away from the shelter once they leave.

---

<div class="post-metadata">

**Author:** ![GlyphGryph](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/glyphgryph/32/847_2.png) [@GlyphGryph](https://discourse.cataclysmdda.org/u/GlyphGryph)\
**Post date:** [September 26, 2013, 9:16pm UTC](https://discourse.cataclysmdda.org/t/the-month-of-the-npc-roadplan-in-op-creature-rewrite-branch-in-repo/3188/29 "2013-09-26T21:16:01Z")

</div>

that’s a good idea - if they do move to fight something, some sort of “return to initial position” logic would be a very, very good addition.

---

<div class="post-metadata">

**Author:** ![kevin.granade](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/kevin.granade/32/1316_2.png) [@kevin.granade](https://discourse.cataclysmdda.org/u/kevin.granade)\
**Post date:** [September 26, 2013, 9:29pm UTC](https://discourse.cataclysmdda.org/t/the-month-of-the-npc-roadplan-in-op-creature-rewrite-branch-in-repo/3188/30 "2013-09-26T21:29:59Z")

</div>

Worst case, have them drop virtual breadcrumbs \<\_\<  
But really, we have a generic method to do a A\* path search, as long as you aren’t calling it all the time that’s all you need.

---

<div class="post-metadata">

**Author:** ![SilverDragon](https://avatars.discourse-cdn.com/v4/letter/s/f0a364/32.png) [@SilverDragon](https://discourse.cataclysmdda.org/u/SilverDragon)\
**Post date:** [September 27, 2013, 4:18am UTC](https://discourse.cataclysmdda.org/t/the-month-of-the-npc-roadplan-in-op-creature-rewrite-branch-in-repo/3188/31 "2013-09-27T04:18:36Z")

</div>

> [@Kevin Granade](#):
>
> [quote=“An0n3, post:26, topic:3188”]You mean I can’t have bugged out entities handing me lit sticks of dynamite as quest rewards anymore?

No, they’ll do it INTENTIONALLY now ;)[/quote]  
No they will fallout style pick pocket you and place it in your inventory lit!

anywho i definatly dont mind if the npc code as is gets removed completely to be replaced with the new, even if they lose a few things overall its much better that way and once the base has been built and stabalised its all shiney extras from there, assuming that theres no other pressing feature to move on to after the base is finished.

Also old NPC’s “when they moved” if you turned in a quest to them would be all, sure ill teach ya something, lets just get somewhere safe first! and then proceed to walk directly into a bee hive . . . ., or get distracted by enemys/hunting and be unable to go back to teach, silly NPCs XD

---

<div class="post-metadata">

**Author:** ![An0n3](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/an0n3/32/2257_2.png) [@An0n3](https://discourse.cataclysmdda.org/u/An0n3)\
**Post date:** [September 27, 2013, 1:03pm UTC](https://discourse.cataclysmdda.org/t/the-month-of-the-npc-roadplan-in-op-creature-rewrite-branch-in-repo/3188/32 "2013-09-27T13:03:16Z")

</div>

You could also abuse bugs in trading with them to get rich and have them teach you everything they know.

I don’t know why anyone would be attached to NPC’s aside from using that glitch to cheat.

---

<div class="post-metadata">

**Author:** ![ramesesniblet](https://avatars.discourse-cdn.com/v4/letter/r/ce73a5/32.png) [@ramesesniblet](https://discourse.cataclysmdda.org/u/ramesesniblet)\
**Post date:** [September 27, 2013, 2:44pm UTC](https://discourse.cataclysmdda.org/t/the-month-of-the-npc-roadplan-in-op-creature-rewrite-branch-in-repo/3188/33 "2013-09-27T14:44:46Z")

</div>

Would it be possible to bounce dialogue trees to xml files? I’m not much of a coder but xml files are super easy to edit (and there are tools to format dialogue trees into xml files) and it would allow some fancy quest stuff by changing variables and stuff. Stuff being a technical term. So currently the code picks which kind of quest they give, but with this it could pick it from an xml file and you can create your own quests and whatnot. Yay modding.

Functionality is obviously a priority but I would love to be able to give NPCs a less… uncuth manner of speech 😃

---

<div class="post-metadata">

**Author:** ![An0n3](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/an0n3/32/2257_2.png) [@An0n3](https://discourse.cataclysmdda.org/u/An0n3)\
**Post date:** [September 27, 2013, 2:50pm UTC](https://discourse.cataclysmdda.org/t/the-month-of-the-npc-roadplan-in-op-creature-rewrite-branch-in-repo/3188/34 "2013-09-27T14:50:15Z")

</div>

People have complained about the rowdy nature of NPC speech in the past. Personally I enjoy it, and it IS a crazy messed post-nuclear hellhole, but I can understand how some people don’t like it.

Having someone chase you and wave you down just to tell you to fucking fuck off mother fucker and then run away is textbook Cataclysm NPC.

---

<div class="post-metadata">

**Author:** ![kevin.granade](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/kevin.granade/32/1316_2.png) [@kevin.granade](https://discourse.cataclysmdda.org/u/kevin.granade)\
**Post date:** [September 27, 2013, 3:01pm UTC](https://discourse.cataclysmdda.org/t/the-month-of-the-npc-roadplan-in-op-creature-rewrite-branch-in-repo/3188/35 "2013-09-27T15:01:18Z")

</div>

1. xml: NO (we’re using JSON everywhere for this kind of thing)
2. profanity: I’m fine with it being cleaned up as a (default off) option, but I’m not interested in doing the work to make it happen.
3. Again, we’re talking about getting very basic functionality going here, dialog and quest trees will be built on top of this, but we’re not concerned with that level of functionality right now.

---

<div class="post-metadata">

**Author:** ![vultures](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/vultures/32/69_2.png) [@vultures](https://discourse.cataclysmdda.org/u/vultures)\
**Post date:** [September 27, 2013, 3:10pm UTC](https://discourse.cataclysmdda.org/t/the-month-of-the-npc-roadplan-in-op-creature-rewrite-branch-in-repo/3188/36 "2013-09-27T15:10:51Z")

</div>

Well, NPCs must be responsive to the player class functions since we need advancement in the whole “party” department. Sure, AI can deprave us of the right to tell 'em to do whatever we don’t want to, but dividing rations, organizing equipment and such should be a wholeset of player’s decision making / discretion.  
What gangs (“mobs”) could do is have a set of scripted actions (since factions are animal lovers, assassins, tree-huggers and tech-phr3aks) so they look like they “listen” to a certain leader’s call. Luring a throng of Zs onto this gang’s porch to see them all eaten is well, just priceless. 🙂

---

<div class="post-metadata">

**Author:** ![phaethon](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/phaethon/32/981_2.png) [@phaethon](https://discourse.cataclysmdda.org/u/phaethon)\
**Post date:** [November 25, 2013, 6:30pm UTC](https://discourse.cataclysmdda.org/t/the-month-of-the-npc-roadplan-in-op-creature-rewrite-branch-in-repo/3188/37 "2013-11-25T18:30:00Z")

</div>

Is there a work-in-progress NPC branch somewhere? Seems like a good way to coordinate effort.

---

<div class="post-metadata">

**Author:** ![Heruedhel](https://avatars.discourse-cdn.com/v4/letter/h/dec6dc/32.png) [@Heruedhel](https://discourse.cataclysmdda.org/u/Heruedhel)\
**Post date:** [November 27, 2013, 5:43pm UTC](https://discourse.cataclysmdda.org/t/the-month-of-the-npc-roadplan-in-op-creature-rewrite-branch-in-repo/3188/38 "2013-11-27T17:43:38Z")

</div>

Is it too late or can I still join this party?

I am a professional C++ developer with over a decade of experience. I’ve done AI before (though not this kind of AI) and I hope I can be of help.

So are you guys still in the planning stage, or are you breaking things down into tasks or what?

---

<div class="post-metadata">

**Author:** ![GlyphGryph](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/glyphgryph/32/847_2.png) [@GlyphGryph](https://discourse.cataclysmdda.org/u/GlyphGryph)\
**Post date:** [November 27, 2013, 5:49pm UTC](https://discourse.cataclysmdda.org/t/the-month-of-the-npc-roadplan-in-op-creature-rewrite-branch-in-repo/3188/39 "2013-11-27T17:49:00Z")

</div>

I came up with a plan but it fell apart because I’m a shit coder and NPCs are hard and I was basically the only one working on it. 😛

I will be trying again starting this weekend though, and hoping to get something out by Christmas, so any assistance would be appreciated.

---

<div class="post-metadata">

**Author:** ![Heruedhel](https://avatars.discourse-cdn.com/v4/letter/h/dec6dc/32.png) [@Heruedhel](https://discourse.cataclysmdda.org/u/Heruedhel)\
**Post date:** [November 27, 2013, 6:00pm UTC](https://discourse.cataclysmdda.org/t/the-month-of-the-npc-roadplan-in-op-creature-rewrite-branch-in-repo/3188/40 "2013-11-27T18:00:06Z")

</div>

Can you share the outline of this plan for discussion? or is this something that’s completely out of your thought process until the weekend?

[Previous page](https://discourse.cataclysmdda.org/t/the-month-of-the-npc-roadplan-in-op-creature-rewrite-branch-in-repo/3188.md?page=1)

[Next page](https://discourse.cataclysmdda.org/t/the-month-of-the-npc-roadplan-in-op-creature-rewrite-branch-in-repo/3188.md?page=3)
