CleverRaven / CleverRaven/Cataclysm-DDA
Zone orders: NPC stations
- Dominant language
- C++
- Stars
- 13.1k
- Forks
- 4.6k
- Avg merge
- 2d 1h
- Merged PRs (30d)
- 200
Description
### Is your feature request related to a problem? Please describe.
[I am generating a new project entry](https://github.com/CleverRaven/Cataclysm-DDA/projects/47) to expand this using temporary zones, allowing players to do a mundane action in a large area that is temporarily specified and deleted when the job is done. This allows us to create a bunch of new zone activities that would be a bit impractical using the current "persistent" zone interface, just because it's annoying to manually create and delete a bunch of zones.
This feature, due to the ability to assign NPCs, would also be a great way to handle some new combat commands for better NPC management.
### Solution you would like.
A few new closely related zones for NPC orders:
1. Station here (strict): NPC remains inside the specified area and treats the boundaries of the zone as blocking terrain
2. Station here (relaxed): NPC will leave the area and chase enemies but return to it if no enemies in sight
3. Attack here (strict): NPCs will only attack enemies within the specified area and will completely ignore others
4. Attack here (relaxed): NPCs will only attack enemies within the specified area, unless they are attacked themselves, in which case they can fight back.
5. Fall back: NPCs will fall back to this zone if enemies enter their "station here" zone.
These require the addition of some new features for NPC AI, and some of these may not be trivial to add. Ideally, we would allow an NPC to be assigned to multiple zones here, so you could station an NPC behind cover and order them to attack enemies coming through the door.
Adding 'strict' zones should require at least a rudimentary Morale score for NPCs. A very rudimentary morale should be based on their trust for you, and whether or not the NPC is being attacked. If the NPC is under attack, they should consider whether or not they want to continue following your orders, or do their own thing and break formation. later this could be expanded to consider things like how many enemies are visible, how dangerous they are, and how allies are performing against the enemy, but a first pass can be quite simple.
'Relaxed' zones will also require some intelligence, to keep NPCs from meandering too far away chasing zombies. I don't know enough about pathfinding to suggest a solution here, but it's a problem that needs solving in multiple areas.
Fall back zones may also benefit from testing the NPC's bravery score: braver NPCs may attempt to hold their zone longer before falling back. This could lead to fun stuff like cowardly NPCs falling back almost immediately on sight of the enemy. Fall back should check that the fall back zone is itself not overrun, and cancel if it is.
### Describe alternatives you have considered.
There are many other ways to do this. I'm open to suggestions.
### Additional context
This is part of a [larger project](https://github.com/CleverRaven/Cataclysm-DDA/projects/47) that I suspect will have *vast* qol and NPC management implications.
These zones do not need to be restricted to Area Actions. The same framework with persistent zones could be used to establish "posts" for NPCs in a stationary base, and for static NPC factions, would allow designers to build some simple more intelligent NPC scripting.
Contributor guide
Research direction
No implementation files or tests are named. Start by tracing the existing temporary and persistent zone framework, NPC orders, AI, morale, and pathfinding behavior; narrow the proposal to a small, testable subset before implementation. Done should include defined zone semantics and coverage for stationing, attacking, fallback, and behavior when NPCs or zones are threatened.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- ai, game-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100