CleverRaven / Cataclysm-DDA

Cataclysm - Dark Days Ahead. A turn-based survival game set in a post-apocalyptic world.
http://cataclysmdda.org
Other
10.65k stars 4.18k forks source link

Debug tool: spawn requirements and craft #60094

Open I-am-Erk opened 2 years ago

I-am-Erk commented 2 years ago

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

Attempting to debug and playtest crafting is, to put it mildly, a pain in the ass. Debug Hammerspace grants you all components and tools, but prevents crafting failures, cannot test component inheritance (eg calorie and vitamins), disassembly, proper use of charge, destruction of components... ie. almost anything you might want to playtest with crafting. If you want to actually test a few recipes, you have to debug in components to all those recipes, plus the tools to use them, plus the charges for the tools. It is a huge amount of work and leads to insufficient playtesting of crafting PRs because we are not made of infinite time here!!

Solution you would like.

We need a debug tool, or tools, that allow us to spawn the requirements to a recipe in order to craft it. There are several ways this could be done, here are two I like:

I don't care which we pick as long as we pick one. What should happen when you attempt to craft something under this framework is:

If there is a tool requirement for the recipe that could not be spawned as an item, we get a debugmsg like:

Recipe requires a tool with LIFT 1 but no spawnable item has this quality!

crafting aborts and you have to make a lift furniture before going onward.

Describe alternatives you have considered.

Another option would be a debug command to select a recipe by ID and spawn one of every ingredient that you could use in that recipe. However I prefer the random version because random component selection is a very good way to playtest.

We could keep the hammerspace tool as is and make this a new one. However I believe the current hammerspace mutation is actually just a trap, it is marketed as a debug tool but makes a lot of relevant debugging impossible. I think this is in every way a superior option.

Additional context

As far as tools go, once implemented this may also be very handy for testing and CI.

I am marking this as P2 because there are some major crafting changes ready to implement, and they are almost impossible to adequately test without either this or a horde of volunteers

ZeroInternalReflection commented 2 years ago

What are your thoughts on a system like this?

https://user-images.githubusercontent.com/89038572/185609155-4607d01e-e2f5-4fc5-b8fb-e60722d66672.mp4

  1. Have a debug mutation (currently "Hammerspace Light") that enables a debug action in the crafting menu
  2. Upon using the debug action, have an opportunity to enter a random seed for the items (For instance, if you encountered a combination that didn't work and you need to retest, it's a lot easier to note that number than to recreate every item by hand)
  3. For each quality requirement, tool, and component of the selected recipe, generate a list of possible options and randomly select one (this currently ignores your current crafting inventory)
  4. Spawn the items and note what was spawned in the log. If no spawnable item meets the requirement, note that too.
I-am-Erk commented 2 years ago

That looks like exactly what I want. As a debug option I don't think there's any need to compare to current crafting inventory, it's ok if it generates something you already had.

Brambor commented 3 months ago

If you want to actually test a few recipes, you have to debug in components to all those recipes, plus the tools to use them, plus the charges for the tools.

The problem with just spawning 1000 of every item is then that you cannot check whether the charges / items were used up, right? That is the only reason why you want to spawn exactly what you need.