Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Area action", a QoL feature using zones to get stuff done quickly #53290

Open
I-am-Erk opened this issue Dec 8, 2021 · 6 comments
Open

"Area action", a QoL feature using zones to get stuff done quickly #53290

I-am-Erk opened this issue Dec 8, 2021 · 6 comments
Labels
[C++] Changes (can be) made in C++. Previously named `Code` Inventory / AIM / Zones Inventory, Advanced Inventory Management or Zones NPC / Factions NPCs, AI, Speech, Factions, Ownership (P5 - Long-term) Long-term WIP, may stay on the list for a while. Quality of Life QoL: degree to which players are comfortable, and able to enjoy CDDA

Comments

@I-am-Erk
Copy link
Contributor

I-am-Erk commented Dec 8, 2021

Is your feature request related to a problem? Please describe.

Many actions in this game (and any game) require repetitive mundane actions with player input. A classic example is "searching all the bodies after a battle", or in our game "pulping all the zombies". There is no reason this should require constant player input: an AI can do this very simply.

We already have the framework to get an AI to do this for you. Using that framework would not only make it easy for players to automate their avatars to do boring actions, but also would be a very easy stepping point to order NPCs to do it.

Solution you would like.

Leverage the zones mechanic to create temporary zones in a limited area, immediately perform a zone action in that area, and delete all relevant zones. For this issue, I don't suggest adding any new mechanics to zones (that will come in a follow up issue). This issue is only about a UI to define and assign the zones.

Process
  1. Keypress to open "area action". This should be connected to zone management keys somehow, I would suggest we take the current zone management key and make it default to area actions, with a double tap to get to the full zone manager menu.
  2. Select a type of action from a list. This would be defined by the existing available zone activities, but aren't the same. For example, "sort out all weapons" would be an area action.
  3. Once the action type is selected, get an optional sidebar menu to define possible details needed for the action type. On first implementation these details will be "action radius" (default 10, adjust with +/- keys). "max time" (default 1 hour), and "people assigned" (default the player*). *(I don't know if zones currently support multiple characters performing zone actions at once. If so, all NPCs traveling with the player should also be assigned by default).
  4. Concurrent to step 3, select the center point for the action. Algorithmically: define a region centered on that point, of radius n defined above. Flood fill that region based on pathability. Every pathable tile from the centerpoint within the radius is the new "activity zone". Display this area as a blinking overlay on the map, allowing the user to move the cursor or adjust the radius using +/- to change the size. Press enter to confirm location and move to step five
  5. If appropriate, define a target point for the action. This is where items will be sorted to from within the activity zone, for example. This tile will be removed from the activity zone if it was within it.
  6. All assigned characters perform the specified zone activity until the time runs out or the activity is done.
  7. Delete all the zones and finish the activity. Note: If activity breaks early due to player input or interruption, we may wish to save the zone and allowing a "resume area activity" option from the area activity menu.
Result

This allows a quick and easy way to define a zone and rapidly do a simple mundane action in that area, such as sorting out all of a particular type of loot. By allowing NPCs to be assigned to the zone, you can conceivably ask NPC1 to gather all weapons while NPC2 gathers all food and you gather all clothes. As we add more zone activities that relate to this command, the ability to assign NPCs to the zones will become very powerful.

Describe alternatives you have considered.

Initially I considered just centering the zone on the player, but that is difficult when we start including NPCs in the mix.

Additional context

This is the first step of a larger project that I suspect will have vast qol and NPC management implications.

@I-am-Erk I-am-Erk added NPC / Factions NPCs, AI, Speech, Factions, Ownership Inventory / AIM / Zones Inventory, Advanced Inventory Management or Zones [C++] Changes (can be) made in C++. Previously named `Code` Quality of Life QoL: degree to which players are comfortable, and able to enjoy CDDA labels Dec 8, 2021
@I-am-Erk I-am-Erk added this to To do in Using zones for quick area actions via automation Dec 8, 2021
@PatrikLundell
Copy link
Contributor

PatrikLundell commented Dec 9, 2021

  1. You can currently order several companions to "sort out stuff", deconstruct vehicles, etc. by giving the order to them one at a time, so giving them all the order in one action ought to work. They don't "know" about each other and they can cancel their activities prematurely because they don't have the smarts to move around others, but that's an issue with the base functionality. (In the case of vehicle deconstruction there's code intended to block them from removing the same part that mostly works [there is a crash bug with a lesser cancellation case in it]).
  2. If the target location is defined as an item sort zone there's no need to poke holes in the unsorted stuff zone as the sorted goods zone takes precedence (and you want to remove things that don't belong there to a suitable zone if there is one). I can't think of any current zone cases where there's a need to poke a hole in it (I haven't performed any check, though).
  3. Well, they'll cancel prematurely at times...

There is currently functionality to define custom item zones, and I THINK there's a way to save one such definition. For sorting out loot I'd definitely want to use such a target zone that I'd gradually refine (and modify over time, as the priorities change). I may well want to have several such custom target zones for use in different environments.

As per 3., I don't think it's useful to split targeted items between companions. It's more efficient to have them all go through all items at the tile they're at before moving to the next one and it will probably result in fewer cancellations due to blocked paths than separating the tasks. Also, that's how unsorted zones work currently, so there would be no need to change anything in that logic.

Also, I'd like this to interact seamlessly with the "normal" zone system, so you could set up zones using this new UI, complement with additional target zones, and then get to work, or do things in the reverse order, i.e. start with the "additional" zones and then invoke this UI (and get to work immediately).
There are a couple of reasons why you may not want a single target single tile zone:

  • Large items being sorted (e.g. drums) so a single tile isn't enough.
  • Sort items into different target zones so you can e.g. have one containing all the "must have" things and others with "stuff I'll grab if I've got cargo capacity left".
  • Sort things into zones so that you can then have this area as a local storage area where you can go and get things sorted into different locations, rather than dig down into a giant pile of sort of potentially useful stuff.

The biggest zone management improvement I can think of is not on the list referenced, however, and that's awareness of the third dimension. I think we're moving towards the ability to use base basements to a larger degree (if for no other reason to get liquids to stay liquid), and the ability to get companions to bring loot brought back down into the basement would be quite useful. It would also be very useful when dragging loot out of labs and other multi Z level structures. I believe this has been mentioned as a suggestion before (and possibly in the last week or so).

@I-am-Erk
Copy link
Contributor Author

I-am-Erk commented Dec 9, 2021

Great stuff Patrick. Zlevel zones are a separate issue but one I'll add

@ilovehans10
Copy link
Contributor

I think this is an amazing idea that will greatly improve the game but I would just like to interject a little something. Is there any reason for specifically using a circle for the quick zone actions?

I feel like the current zone system and this new quick zone system could be improved by adding more shape options. A few shapes that could work would include convex polygons (draw by the player by moving the cursor to the corners hitting a add corner button and then hitting a confirm button), line segments, or as you mentioned circles. The option to use other shapes would allow for the easy pulping of a radius around a turret, the easy cleaning of just a rectangular room, or fully utilizing storage in a strangely shaped space.

@PatrikLundell
Copy link
Contributor

I don't interpret the "radius" as a circle, but rather the current "box" system used for zones, reduced down to a square for UI ease of use. Other shapes don't really work with the underlying grid, as you'd have to determine whether a tile intersected by a zone boundary are inside or outside (it's not hard technically, but it's a challenge to get people to understand whichever implementation you decide on [e.g. any part inside = inside, >=50% = inside, any part outside = outside]).

If you want to tailor it to match strangely shaped spaces you're better off using the existing zone system (which would then have been enhanced with with whatever functionality that gets added by this set of changes, as the functionality available should be the same, with only the UI differing). A use case I have where I actually need weirdly shaped zones is vehicle disassembly zones, where I have to add the tiles the wing mirrors are at, while excluding all the other tiles surrounding the targeted vehicle, as I definitely DON'T want to dismantle the lifting "vehicles" that have to be placed there to get the companions to be able to remove everything. I do this by drawing one zone over the vehicle itself and then a single tile deep zone from one mirror to the other (adding the wing mirrors separately works as well, but that's one more zone to define and one more to remove afterwards).

@I-am-Erk
Copy link
Contributor Author

Too many options are a problem for the quick system. They'd be great for persistent zones.

I'm not married to the circle, but I think both of you are missing the crucial "flood fill"stage. First you designate a rough area to include, then you use flood fill to exclude inaccessible regions. That means if you're in an enclosed space, the zone will just autofill it. If you're outside, I think a circle is a good tool because all points are equally distant when pathfinding.

If you have complex terrain you want to specifically and carefully exclude, you may want to use a persistent zone rather than an area action. These are designed to be "zoop, zoop, done" without a difficult interface with lots of options.

@github-actions
Copy link
Contributor

github-actions bot commented Dec 6, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Please do not bump or comment on this issue unless you are actively working on it. Stale issues, and stale issues that are closed are still considered.

@github-actions github-actions bot added the stale Closed for lack of activity, but still valid. label Dec 6, 2022
@I-am-Erk I-am-Erk added (P5 - Long-term) Long-term WIP, may stay on the list for a while. and removed stale Closed for lack of activity, but still valid. labels Dec 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C++] Changes (can be) made in C++. Previously named `Code` Inventory / AIM / Zones Inventory, Advanced Inventory Management or Zones NPC / Factions NPCs, AI, Speech, Factions, Ownership (P5 - Long-term) Long-term WIP, may stay on the list for a while. Quality of Life QoL: degree to which players are comfortable, and able to enjoy CDDA
Development

No branches or pull requests

3 participants