Micromanaging npc inventory

Remember that said mule work may go towards building a home where they can be warm an cozy, or an improvement to their vehicle home, or a new palisade on their farm to keep nasties out, or new weapons, or new armor, etc.

Or in other words, once you lock out the exploit for trust gain, the only reason to have an NPC to haul stuff is that said stuff is going to be used later for something, and chances are, the NPC will receive some benefit out of it.

They shouldn’t like that they are given these stuff, but they shouldn’t hate that they have to put some sweat into increasing their odds of survival or gaining later creature comforts, at most, you could ask for a minimum trust level to allow that kind of interaction.

Given the huge number of posts since I checked this thread yesterday, this is obviously something that people feel strongly about.

It seems to me that all open world computer games have similar problems with NPCs – they either allow direct control of NPC allies, or they don’t & the NPCs have sub-optimal behavior. Maybe that’s an uninformed opinion, but even if it is, I think a discussion of solutions seen in other games, and judging this game’s solutions by a real world standard, is critically missing from this discussion.

The solution that I’ve seen work most often in other games is allowing direct tactical control of NPCs when the player wants. Can anyone point to a comparable game that has a superior system?

1 Like

Define superior. If you mean, “allows most efficient use of NPCs as combatants”, then yes direct tactical control is superior, but if you mix in the intended feel of the game and overall balance and which set of features is more fun, it gets more complicated.

I like squad combat games, but dda is not a squad combat game. Dda is a survival rpg where you control one and only one character directly. The most comparable game off the top of my head is Fallout. You can acquire companions that are not too far behind you in combat ability, but that benefit is (intentionally) mitigated by the fact that you cannot fully control the companion NPCs.

If you want a dda-based squad combat game you’re going to have to fork the game.

Yeah, sorry, I should have more explicitly asked people to do that in my post. I’m not personally advocating for a squad combat game, I was just using that as an example of the kind of logic this thread seems to be missing.

The point I’m trying to make here is that a lot of talk in this thread is about creating a poorly defined “superior” implementation, and almost no discussion of what we’d like to see, what we’ve seen elsewhere, and in what ways CDDA can/should differ from those specific examples in order to stick to a specific goal.

For example, let’s go with the Fallout example. In what ways do you think Fallout handle inventory management better than CDDA, Kevin?

Honestly, though, I think this entire conversation is probably moot because I’m sure there’s been plenty of discussion about where the actual dev team has decided to go with NPCs and that link exists somewhere, even if nobody has read it in a while.

At some point I’d like to look more into NPCs and maybe try messing around with this sort of thing. Does anyone know of a good, thorough tutorial on how to code NPCs?

They’re one of the most complicated parts of the most complicated parts of the game, magnitudes more complicated than item definitions.

1 Like

That part isnt really comparable, fallout companions come with a reasonable loadout already, and it’s not really expected to change. The thing that’s comparable is the relationship between the player and their companions.

Errr… which fallout are we talking about here?

Right, so my suggestion is this:
NPC’s default equipment is their ‘minimum acceptable’ value for good equipment.
If the player gives an NPC an item, it’s flagged that it originated from the player and can be replaced so long as it’s not worse than the equipment they started with.

Their minimum expectations for gear will slowly climb until it’s slightly below the gear they’ve been given, in which case they won’t accept anything much worse than what they expect or will at the cost of morale, will be more likely to flee and disband, and will like and trust you less.

We would need a inventory for this equipment UI that shows what the NPC considers ‘good’ gear.

How good equipment is to an NPC should really be influenced by skills and of course martial arts, a highly skilled rifleman is going to prefer an average rifle to a decent pistol or SMG simply because they’re much better at using it so it’s going to end up more effective, and the same with melee.

Now that we have the player faction bases and as far as I am aware, at least from code I’ve looked at, NPCs can actually train skills right?

So the player /could/ still have some impact on this, but it’s less power than they would have had before.

We need dialogue options to specify what kind of run we’re going on to adjust priority.
‘We need to travel light’: prioritize armour with lower encumberance
‘We need good protection at the moment’: prioritize armour that protects better.
‘The environment is more dangerous than monsters where we’re going’: prioritize high environmental protection, acid protection.

Obviously different wordings that could be used, but the player specifying their intent should adjust what an NPC thinks is ‘good’

If ‘we need to be quiet’, they’re gonna prefer a crossbow over a rifle, or a pistol crossbow over a pistol, or a bow if they have skill in archery, or it’s just a good bow.
Silenced weapons too of course, perhaps allow them to mod weapons they’re wielding with silencers if they have one in their inventory, they’d naturally have a preference towards silenced guns of their skill expertise.

This may involve compiling a list of which items are the ‘best’ in each situation.

Perhaps there should be an overall ‘equipment morale’ value per NPC that basically tells you how happy they are with their current gear, and if overall morale is too low they can disband and sprint away when shit hits the fan.

2 Likes

–Heh, when you said, “we need to be quiet,” my mind immediately went to the thought of an NPC throwing a grenade. Because they’re stupid. If we implemented that part, we’d definitely need to include grenades too, unless there are silent grenades, which seems weird. Although it seems like a bad idea to let NPCs have grenades in the first place. I’ve never tested if they are smart enough with them, but I’m also not going to, because it’s scary. That said, if I did test it, I’d probably just use DEBUG to make it easier.
–I like all of those ideas you have, pretty nice in my opinion.

Potential problems, some which are shared with the trust-based curency:

  • the NPC grabs something from the player’s loot at their home.
  • The player wants to take their weapon in order to upgrade it. If the ‘trust reward’ for giving them the upgraded weapon is bigger than the penalty for taking it away without giving them anything, then it’s fine. I’d rather not need a second weapon to float them just to do this.
  • Sometimes, the ‘weapon they started with’ is something really good, but it’s either too noisy and/or they could not realistically use for more than a couple encounters until waaay later when ammo is found.

In particular, adjusting ‘worth’ regarding ammo is going to be a tough one.

One thing to consider is that past a certain point, there’s not much reason to continue evaluating all this: once the player has invested, say, a couple weeks into keeping an NPC alive and fed, chances are they are going to keep doing this, and chances are the entire inventory of the NPC came from the player. As such, I see no reason to restrict the player from managing what the NPC carries and what they equip as they see fit by this point.
The tricky part is evaluating when this happens, and closing loopholes that game the threshold without investment.

1 Like

Smoke and tear gas grenades are relatively silent IRL. There’s the sound of them hitting the ground, and then a hiss as they begin spraying their contents.

Also, just tested in game, gave an NPC a machete, as I thought “that’s a good wep”. Then forgot, their skills were poor for it. Tried to give the barbed wire bat back, and they say “nope, my current wep is better”, even though for them it would work out worse (is 1 point “better”, but many levels lower and less effective in their hands).

Thankfully I can force it. So any system used, would be nice to use some sort of points/trust/one off options, even if still having an RND roll, that allows you to get/give things to the NPC. Waiting until you can do so again is fine, but the option to never do something, moves the NPCs from companions, even from benign, to out right opponents [of game mechanics and annoyance].

So the scope and goal of NPCs needs to be considered before they are changed. The effect on the player, atmosphere of the game, and relation to “simulation/reality”. As a tiny change can have massive knock on effects. For example, IMO, just removing the “runs off the map in random diagonal direction” bug would make NPCs really much more interesting… yeah, them staying still would make them work better than the current implementation :rofl:

Maybe a JSON-ized list of equipment that NPC allies will gladly accept would be a good thing? It could include common mid-to-late game equipment and perhaps skip the math check on “what gear is best”. It also allows for the RP angle – “sorry if you don’t like it but we’re a cowboy gang and the outfit is a badge, 12 gallon hats, dusters, cowboy boots, and dual survivor revolvers.” or what have you. It could include some sort of trust penalty if the math check is way off, or it could mitigate the trust penalty, etc.

You mean, anything on the list can be traded with anything on the list without repercussions?

It doesn’t cover the trades where you want to just remove gear for one reason or another, but it does cover most of the rest of trades.

Then again, you might also be able to dynamically generate such list based on tags and stats.

–There is a lot of gear in the game, and what you’re proposing would only realistically work with modded gear if it ended up being mainstreamed into the game. Then you’d need some way for mod makers to add their own gear to said list. I don’t think being that specific is worth it.

Actually, for a modder to add to the list can be easy, they’d just create a little json in their mod that expands the list with the items of the mod, much like one can expand lists for professions.

You are correct, however, that the task of making the initial list would be annoying, and it adds another thing to update when adding items to the game, which is why I’d rather use an automatically-generated list.

@aabbcc I think we’re on the same page there. I wrote a quick map and json object parser in powershell ( https://github.com/overbo/cataclysm-dda-ps1 ) and it really seems like the type of thing where it’s a “jsonitems | where-object { .damage -gt 18 -or _.armorval -gt 20 -or .name -match “survivor*” }” (apologies for powershell pseudocode, it looks like the comment editor removes my dollar signs) type of statement to produce the list. If it’s manually curated it is more or less a bad idea; manual curation is more for mod makers. There’s probably a logical query statement that would produce the list is what I’m trying to say. My c++ is rusty but I can probably produce that query statement and the json that creates it in the language desired; I wouldn’t create a pull request unless folks thought it was worth it – I’d definitely defer to the more established players here.

A static list is not helpful at all. The npc needs to be able to evaluate the item against their own abilities and needs, which is 90% of the difficulty of something like this.
Part of the problem is the concept of only allowing “trading up”, even with a minimal amount of trust, it should be reasonable to have a NPC accept a weapon as long as it meets “good enough” criteria.

2 Likes

Trading ‘good enough’ is easy enough with melee, a little tougher with ranged, but armor? Ouch.

You’re balancing encumbrance, coverage, environmental protection, armor, body slots and flags.
Flags, you could get away with making those items that possess certain flags always be ‘good enough’, like rad immunity.
Ditto for environmental, you could just consider anything above a certain threshold to always be ‘good enough’, freely allowing trading down on this attribute when the circumstances change and there’s no more immediate need for it.

Body slots are a pain thanks to multi-slot items. There are times where trading down for an item that covers less slots makes perfect sense, like reducing encumbrance of a specific body part or avoiding clashes due to covering the same layer as something else, but there are times where it’s ridiculous and the NPC ought to want a replacement for all slots in exchange.

balancing armor and coverage, there might be a rough way around that, but encumbrance is another pain. I don’t think there’s an easy formula that will tell us if a lighter armor is within good enough range of a heavier one.

1 Like