Some ideas for the structure of an NPC overhaul

So, last night I had this sudden inspiration about how NPCs can be implemented, neatly and dynamically without much slowdown (hopefully). I wrote it down, along with a BUNCH of other ideas I had.

–Simplified combat for simulating npc battles far away from the player. If we ignore physics and positioning, just considering skill and gear, combat can happen outside of the reality bubble.

–“Event queue”, so that at specific minutes things happen, like NPCs eat food, drink water, finish crafting, return from missions, etc. This would open the door for massive NPC actions, without a nasty slowdown.

–NPC missions, player can form parties and send the teams out to do various things, like skirmish zeds, scavenge areas, chop wood, raid rival villages, etc. Rival computer-controlled factions can do the same.

–NPC crafting, they can start a crafting job and then the end is placed in the event queue, then repeat if commanded to. That way, someone can boil water for you! If you have a bunch of people, you can queue up more complex tasks, like crafting heavy wood arrows from metal, plastic, and wood.

–NPC command interface, player needs to be able to see a general idea of their stats and traits, and assign them to buildings or teams accordingly. Hourly schedule?

–Raid parties: Instead of dynamic spawning as happens close to the player, raid parties spawn from hazard zones and move around randomly, sometimes heading close to other parties. Parties might try to run from stronger, or at least larger parties, ignore other parties until they’re close enough to fight, or path to other parties agressively to intercept potential problems. Players can build these and command their own, and some spawn from danger zones, like portals, rival settlements, swamps, mines, waste disposals, triffid groves, spires, etc. Parties would normally be just walking, but should be able to be assigned vehicles. Only 1 vehicle per party, and each party member would need a seat. Perhaps during engagements, ranged party members could fire their weapons, and melee party members would be forced to smash the vehicle. Ramming seems like it would just be too difficult to reliably work, and in any event would seriously overpower vehicles, even MORE so. But, with logistical difficulty, NPC vehicles could add so much to the game. Between tanks that wander around and defend your territory to high-capacity scavenging vehicles, this would just be awesome.

–Party interactions: If raid parties manage to get all the way to a square, they can interact with it, either scavenging from town buildings, chopping forests, gathering water, etc. Fungi parties might convert an area into fungal bed, eventually (over the course of a season or more) creating another spire. Netherworld inhabitants might create new portals, factions might create new outposts/settlements, etc.

–Outposts, small areas attached to villages that can do jobs that villages themselves cannot. For example, survivors can draw water from LMOE shelters, pools, and rivers, then go on a mission to trade the water to the main village, or lumber outposts that go to nearby forests and chop trees, then cut into logs/planks and send home. Outposts might also include a presence at strategically-important locations, such as missile silos, mines, power stations, waterworks, etc.

–Building functionality is defined by furniture and tools as well as designation; a kitchen might have a water tank, FOODCO, and RV Kitchen Unit, while a chem lab might have that and more. Any building can have survivors assigned to it, and then they can use the stuff inside to do automated crafting. Buildings can basically be built like vehicles, but wheels cannot be attached, and engines only charge batteries, but do so significantly faster than if they were in vehicles. But realistically, you’re gonna want solar panels. (Perhaps panels should be nerfed? I can’t seem to go lower than 90% on my one-panel vehicle in the current version, even after boiling hundreds of units of water on the RV unit.)

–Some structures would have to be scavenged in a special mission, headed by the player. Dissectors, Telepads, etc. can be claimed and then built in some special buildings for awesome purposes, like the medical room or a teleport hub that can allow teleportation between your settlements.

–Building types!

  • Workshop: The most general building, it allows survivors to perform crafting jobs

  • Warehouse: For keeping your stuff, with water/gas/hydro tanks, fridges for food, dressers for clothes, tables for tools. Requires the proper furniture for each storage. Any building can, in theory, work that way, but every settlement must have a primary storage warehouse. Requires at least one of each basic storage furniture (to be expanded). Survivors assigned here can perform scavenging or harvestry missions.

  • Library: Shelves and computers. Survivors can be assigned here to read their skills up, which would work along the “event queue” system. Lower-intelligence survivors can also maintain their skills here if there are books of their level. Requires shelves for the books. Scavengers drop books off here. Computers can be built here, where downloaded log files can be reviewed, and the lights would allow books to be read at all hours.

  • Medical: This type of building would have beds for the wounded to recover in, as well as potentially cyborging stations and hospital structures. Cyborging stations, surgery rooms, etc. require MediSoft and computers as well as a metal table.

  • Gym: Survivors can be assigned here to train their skills in safe sparring matches (their strength for the purposes of training is reduced to 1? need to work on that), so long as there are at least 2 total survivors assigned to the building at that time. Use the simulated combat system? Would require a special floor. Survivors that have martial arts skills can be assigned here to train those skills.

  • Target range: Survivors will be able to grind their ranged combat skills, albeit at the cost of ammo. But, with the NPC crafting job system, ammo should be easily obtainable. Requires a fenced area, not necessarily inside?

  • Garage: Survivors assigned here can repair vehicles to full, replacing grey components from building storage and, if commanded to, strip given vehicles to components. Before doing that, they will siphon all tanks into storage. You still have to drive vehicles to them in order for them to strip vehicles. Requires a Vehicle Welding Rig.

  • Armory: Survivors assigned here will be available to go on military missions, either intercepting raid parties or performing their own raids. Survivors assigned here can also be led directly, so that you can clear towns or perform raids yourself. You might lead a team to strip a vehicle in the field, or claim a special structure.

  • Guard Post: Guard teams see and respond to hostile parties that get close, but stay within the perimeter. Ammo and some supplies are stored here?

  • Perimeter: Defines the outer boundaries of the settlement. Guards patrol this area, as if on missions.

  • Abattoir: Survivors assigned here will wander around, killing wildlife. They then bring the wildlife back and run it through a dissector, getting more meat/bones/sinew/fur than standard butchery.

Now, this is a HUGE proposal, so it should really be a low priority; bugfixes first after all. I would love to hear discussion about it, though. Ideas?

Wow.

Ahlikeit

Surprisingly a lot of NPC trouble comes more from a lack of consistent implementation behind the scenes then it does from a lack of content (not that lack of content is a good thing). This has mostly begun to be addressed by the creature rewrite, the base of which is in place already (though it has a lot of work to be done still). Once that is reworked to properly call the correct functions instead of constantly prompting about whether or not a creature is an NPC then pretty much the only major NPC blocker will be their AI functions, which are extremely basic at the moment.

To put it slightly differently, yes, our goals our fairly similar to yours. The challenge in dealing with NPC’s, however, comes not from successful and clear NPC goals, but rather with the backend implementation of said goals within the code structure.

Currently NPCs pick up every rock, get pissy, will trade a mini nuke for a V-twin engine, and just generally don’t know when to quit.

[quote=“i2amroy, post:3, topic:5087”]Surprisingly a lot of NPC trouble comes more from a lack of consistent implementation behind the scenes then it does from a lack of content (not that lack of content is a good thing). This has mostly begun to be addressed by the creature rewrite, the base of which is in place already (though it has a lot of work to be done still). Once that is reworked to properly call the correct functions instead of constantly prompting about whether or not a creature is an NPC then pretty much the only major NPC blocker will be their AI functions, which are extremely basic at the moment.

To put it slightly differently, yes, our goals our fairly similar to yours. The challenge in dealing with NPC’s, however, comes not from successful and clear NPC goals, but rather with the backend implementation of said goals within the code structure.[/quote]

That’s what I thought the trouble was; AI coding is inevitably the hardest to get juuust right. I mostly was just laying out some ideas for an “ideal” goal. Hopefully I’ll have time (and skill) to work on this myself, maybe. Unfortunately, this will be my first major project, and I am apprehensive about it, to say the least… :S

Well we’re always welcome for more coders. :smiley:

That said if you do decide to help with this you might want to start looking at the creature base structures that have already been laid down to start expanding on them. Alternatively if you want something easier feel free to start looking through github’s bugs and picking ones out to help fix. We’ve already marked quite a few with the “Easy-Fix” tag to help narrow the list down, but there are quite a few fairly easy ones that just need someone to give them a bit of TLC to fix them up.

Why don’t we just make NPCs into monsters, jury-rig up something like migospeech.json for them behind scenes, and just have them drop stuff from a list?

I don’t see why they need to be as complicated as the player.

Also, why don’t zombies groan? I noticed that the other day. Someone needs to implement groaning inside migospeech.json, now that we can add monsters other than migo to the list. But I digress.

We just need to steal some NPC codes and implement them.

[quote=“TheGrifter, post:7, topic:5087”]Why don’t we just make NPCs into monsters, jury-rig up something like migospeech.json for them behind scenes, and just have them drop stuff from a list?

I don’t see why they need to be as complicated as the player.

Also, why don’t zombies groan? I noticed that the other day. Someone needs to implement groaning inside migospeech.json, now that we can add monsters other than migo to the list. But I digress.[/quote]

That’s the hackish way.

Pretty much. A lot of the problems and bugs we deal with now are because way back when said systems were implemented they weren’t implemented right. Putting in large hacks like that will only be setting us up for failure later, and will actually put us farther away from the goal of well working NPC’s (as well as essentially wasting whatever dev time goes into the hack).

While hacks might give you a bit of content in the short run, sometimes in the long run it’s better to put in the time and rebuild a good system from the ground up rather then trying to make an increasingly broken system “work” through more and more hackish methods.

Pretty much. A lot of the problems and bugs we deal with now are because way back when said systems were implemented they weren’t implemented right. Putting in large hacks like that will only be setting us up for failure later, and will actually put us farther away from the goal of well working NPC’s (as well as essentially wasting whatever dev time goes into the hack).

While hacks might give you a bit of content in the short run, sometimes in the long run it’s better to put in the time and rebuild a good system from the ground up rather then trying to make an increasingly broken system “work” through more and more hackish methods.[/quote]

This isn’t a permanent solution, sure. It’s a lousy hack’s idea of how to do it, sure. It’s a layman’s view on the thing.

But it’s fairly simplistic, and could be easily implemented.

Just make them into a monster, give them similar AI characteristics to wolves, or pigs, or bunny-rabbits depending on if they’re soldiers or cops, or pedestrians, and give them all the PARROT special ability like migo. There’s your humanity for you. A parroting meat pinata. There are people in real life like that.

The beauty of this is how simply it could be done. They’d be generic, sure. But they’d be less prone to crash the game. So throw together some code from migos, some docile animal, and the turrets if the person is supposed to have a gun, and there you have it: Humanity, done simply.

The main reason z-levels are so screwed is because Whales made a hawkish solution that just made more trouble down the line. Z-levels now simulate depth very simplistically, and kinda sorta work… But it definitely isn’t good. While making NPCs generic monsters might work, it’s just creating more problems.

This is why we used monkeys instead of men on the first wave of space rockets. Because we knew that the first generation solution would be clunky, and poorly thought out. But without those monkeys on rockets, we’d have nothing to go on when we wanted to strap men to the same rockets, and fire him out to the moon.

What I’m saying is that you have to work with what you have, and be willing to take risks, initially.

This isn’t strapping monkeys to rockets as a test for the rest. This is making a rocket that is literally a barrel filled with dynamite pointed upwards, putting a monkey on top, and implying that this is the entire program. It isn’t taking a risk. Taking a risk would be putting in the time and effort to overhaul the system.

You are twisting my already stilted and unlikely metaphor, and are starting from a compromised position, basing your argument on crazy monkey and barrel based solutions. This isn’t a barrel of monkeys, for sure.

If you want to complain about the quality of the metaphor, blame the guy who created it. :stuck_out_tongue: Anyway, by central point stands.

It certainly does not stand.

I’m willing to discard the entire framework of monkeys and rocketry, but your whole rebuttal argument still exists based on that metaphor.

Let me put it to you in different words: My solution for NPCs is a lot like the eighties. It’s a good decision, for now. And sure, it might screw us over in the future, but think of all the awesome movies made in the eighties…

Let’s stop using metaphors entirely.

The safe way is to create a hacky solution out of the things we have. This is a short term solution at best and is basically procrastination. The risky way is to overhaul the NPC system from the ground up. This is long term but will pay off, not just by NPCs, but by also overhauling the definitions of creatures in general. I would rather be patient and wait for a great system rather then have an incomplete system right this second.

[quote=“TheGrifter, post:7, topic:5087”]Why don’t we just make NPCs into monsters, jury-rig up something like migospeech.json for them behind scenes, and just have them drop stuff from a list?

I don’t see why they need to be as complicated as the player.[/quote]
The main reason they need to be so complicated is managing an inventory (which is the main thing that breaks) and tying into the conversation code and missions (which is second most common cause of problems). The thing that is breaking is precisely the things where they are different from monsters, because that is functionality we need.
Having “monstrous humans” that don’t communicate and don’t manage items is a possibility, I’m in favor of it for certain classes of enemies, but that is not a NPC, it’s a much more limited thing.

I’ve also been meaning to do this, it also has a nice side effect of causing them to clump up because they’re attracted to noises made by other zombies.

[quote=“Kevin Granade, post:19, topic:5087”][quote=“TheGrifter, post:7, topic:5087”]Why don’t we just make NPCs into monsters, jury-rig up something like migospeech.json for them behind scenes, and just have them drop stuff from a list?

I don’t see why they need to be as complicated as the player.[/quote]
The main reason they need to be so complicated is managing an inventory (which is the main thing that breaks) and tying into the conversation code and missions (which is second most common cause of problems). The thing that is breaking is precisely the things where they are different from monsters, because that is functionality we need.
Having “monstrous humans” that don’t communicate and don’t manage items is a possibility, I’m in favor of it for certain classes of enemies, but that is not a NPC, it’s a much more limited thing.[/quote]

A “monster” thats a human that has a set inventory would be a alright start though. Wouldnt it? And, when we get NPCs fully working, just remove them, add in the working ones. Though, there may be future problems that I cant really think of. But- maybe a “monster” that has a random chance to spawn in a cabin, with a shotgun and a few rounds? Or- something like that. But- Do monsters even know how to use guns? (im unsure if turrets work in a different way than having a gun in their inventory and just firing that, or, its a special ability or something) fdsaiufnhdsi im rambling now. Sorry.