CleverRaven / Cataclysm-DDA

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

Axes break the laws of physics when making planks #63203

Closed Karol1223 closed 1 year ago

Karol1223 commented 1 year ago

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

Recently #60750 changed some woodworking recipes, and while discussing stuff for that it was brought up how you'd not be making planks directly from logs with hand tools because that's simply unreasonable. Technically doable but the result would be low quality and it'd take way more effort. Even then, you'd not be doing that with an axe but a saw in the first place. Yet the axe did it perfectly fine, in 20 minutes somehow, and even managed to break the laws of physics in the process (10 planks do not fit with the dimensions of our logs). The same use action appears to be used by anything with wood sawing, which while saws can indeed cut wood into planks they can't do it very well on an entire damn log and they certainly cannot break the laws of physics in 20 minutes either. It also appears that same quality is used in faction camps / follower interactions and should be looked into as well.

Alright then, rewriting this and leaving the old one behind as a testament to my hubris. Making planks with hand tools is possible. Not good, but theoretically possible. The issue is currently axes make amazing planks faster than powertools and do so more efficiently as well. This should not be. Our logs allow for roughly 6-8 planks to fit in them with precision cuts. With an axe you'd be looking at 3-5 planks at best. It should also take far longer, I'd throw a rough estimate of an hour for one batch (it may need to be one hour for one plank, but I have not tried to make planks with an axe myself) instead of ~20 minutes it does now (I think 18 specifically, but that's a problem either way). Ideally, while we're at it, that should probably be moved into a recipe instead of a hardcoded use-action. It has no business being a use-action, much less with nested recipes being a thing now. When it comes to saws, though, they should not be able to turn logs into planks. You'd destroy a wood saw trying to do that.

Solution you would like.

Remove the hardcoded 'a'ctivation use from the axes, wood saws and all the other stuff. Make NPCs not able to do that either.

Move the LUMBER activity into a recipe that needs an axe quality and provides a long and inefficient log-plank conversion rate. It could likely use a proficiency of its own as well, but I don't know if adding a proficiency specific to just one recipe is something that'd be approved.

Describe alternatives you have considered.

I could handle the json part myself but there'd be dead leftover c++ code laying around still if I did that myself so I decided it's better to let someone who actually has c++ knowledge handle this and not split it into multiple PRs for no reason.

I still can't handle shit. This needs someone with c++ knowledge to tear out the LUMBER activity. The recipe is json work, and I've already suggested changing #63201 to that, though what happens there is out of my hands.

Additional context

No response

cake-pie commented 1 year ago

there'd be dead leftover c++ code laying around

There shouldn't be. You'd just remove the LUMBER bit from here: https://github.com/CleverRaven/Cataclysm-DDA/blob/02df847acfe3d5ab8d1cd5526e7708fb7b7e8bfa/data/json/tool_qualities.json#L126-L131

It would still be in use here: https://github.com/CleverRaven/Cataclysm-DDA/blob/02df847acfe3d5ab8d1cd5526e7708fb7b7e8bfa/data/json/tool_qualities.json#L79-L84

Karol1223 commented 1 year ago

there'd be dead leftover c++ code laying around

There shouldn't be. You'd just remove the LUMBER bit from here:

https://github.com/CleverRaven/Cataclysm-DDA/blob/02df847acfe3d5ab8d1cd5526e7708fb7b7e8bfa/data/json/tool_qualities.json#L126-L131

It would still be in use here:

https://github.com/CleverRaven/Cataclysm-DDA/blob/02df847acfe3d5ab8d1cd5526e7708fb7b7e8bfa/data/json/tool_qualities.json#L79-L84

The point is that the entire process of 'LUMBER' is a mess. It breaks the laws of physics and takes way too short on any tool that uses it, to my knowledge. The axes are the best example, but a wood saw should not be able to break the laws of physics in 20 minutes to make planks either. The entire usage is a mess in the first place.

dkristoffersson commented 1 year ago

Would also need to update the faction camp mission to have followers chop logs into planks, if that hasn't been done already.

Karol1223 commented 1 year ago

Would also need to update the faction camp mission to have followers chop logs into planks, if that hasn't been done already.

I believe it hasn't. It has been brought to my attention that it exists only a few minutes ago, I wasn't aware it exists. I'll update the issue.

cake-pie commented 1 year ago

the entire process of 'LUMBER' is a mess

Well, that's kind of moving the goalposts since you originally only mentioned the problem with respect to axes and seemed to imply that using a saw was fine.

Delving into the code, I think you need to look into this construction as it uses the same underlying code in iuse::cut_log_into_planks(): https://github.com/CleverRaven/Cataclysm-DDA/blob/02df847acfe3d5ab8d1cd5526e7708fb7b7e8bfa/data/json/construction.json#L74-L85

Karol1223 commented 1 year ago

Well, that's kind of moving the goalposts since you originally only mentioned the problem with respect to axes and seemed to imply that using a saw was fine.

While it is true that I wasn't aware the saws had this ability in the first place and so didn't mention it, I think mentioning the laws of physics breaking in the description should have given away that the saws aren't fine either.

Unfortunately, I am 99% sure that this does indeed put the issue in c++ territory and so it is out of my hands entirely - I can't do anything in c++. Best I can do is file an issue.

Drew4484 commented 1 year ago

Making boards with only an axe is absolutely possible and has been done about as long as we've had wedge-shaped objects. They won't be laser straight and it should take longer to plank-ify an entire log section, but it's absolutely viable.

Karol1223 commented 1 year ago

Making boards with only an axe is absolutely possible and has been done about as long as we've had wedge-shaped objects. They won't be laser straight and it should take longer to plank-ify an entire log section, but it's absolutely viable.

You're not entirely wrong, though I do believe there should be some differentiation. On the devcord during a conversation, an idea was brought up to split planks into proper good quality planks and 'roughly plank-shaped thing that should be useful but won't prove as good as a normal plank'. The problem is at the moment you can make planks with axes or the proper woodworking recipes and... axes do it faster and more efficiently, which is obviously bullshit. Personally, when it comes to splitting planks I'm not that fond of it, since the two would realistically not differ at all in the case of survivor-made items, but I do believe that trying to make good quality planks with an axe is, while theoretically possible, going to take far longer than 20 minutes. And it still definitely won't give you 10 planks with our log dimensions. You'd be looking at 6-8 with precision cuts. I'd hazard a guess with an axe you'd be looking at 3-4. So while you are right that an axe can be used for this, there still are underlying issues to tackle - and jsonifying this into a recipe instead of a use action would be beneficial in the long run, though in that case, I should indeed edit the issue.

When it comes to the wood sawing, though, you are not cutting a whole log into planks with just a wood saw, so the point still 100% stands there, though.

I've kickstarted an edit for woodworking recipes with #60750 and I do feel partially responsible for making the woodworking at least have a foundation to stand on, though I did jump into deep water with this. I honestly need to think of what the best approach would be, but I cannot pretend like making a haphazard makeshift plank with an axe isn't possible. The question is mostly if the uses warrant a differential of that from our current planks (which I don't think they do, but I may be wrong).

cake-pie commented 1 year ago

Making boards with only an axe is absolutely possible

But producing a number of boards that is equivalent to more wood than was in one log should not be possible.

the laws of physics breaking

Here is your culprit: https://github.com/CleverRaven/Cataclysm-DDA/blob/02df847acfe3d5ab8d1cd5526e7708fb7b7e8bfa/src/activity_actor.cpp#L5490-L5497

it is out of my hands entirely - I can't do anything in c++. Best I can do is file an issue.

Actually implementing JSON alternatives for what you want culled, and making sure it all works correctly, is the part that takes actual effort. Figuring out what parts of C++ can be deleted or need updated is easy by comparison.

not split it into multiple PRs for no reason

Counterarguments:

I've looked into the code, and here's a plan for how the work could be broken down:

Part 1

Part 2a

Part 2b

Pipe Dream

Karol1223 commented 1 year ago

Counterarguments:

if you do the JSON, it'll reduce the hurdle for someone else to deal with the C++ part you clearly have certain ideas about how this should be fixed; if someone else works on it but misunderstood something or has different ideas, it'll lead to more overhead in reviewing and make changes having both the replacement and original coexist in the same build makes it more convenient to test and compare the two it would be safer to make sure the replacement is working as intended before deleting C++ that is no longer wanted

All of those are valid. For now I've suggested the change in #63201 as I've already yelled at the author too much there about wood saws not being able to cut logs into planks (which I still think they are not, at least not any random saws, but I digress) while the axes should still have that ability while ideally in a recipe form. That PR could easily be changed into axe-plank recipes and I would feel bad simply doing it myself now given that that particular PR motivated me to finally open that issue in the first place. I'll try to help the author keep the code clean but I'll only do the PR for recipes myself if the author of #63201 doesn't want to cooperate, which at the moment I still don't want to assume they won't, at least not until they answer.

Profit0004 commented 1 year ago

As the author of #63201 I am not in disagreement, but because of the sharp number of core mechanics that will be changed if all of that is implemented I really don't want to wade into that water. I am matching already existing mechanics, and if a change is decided upon by the community we can change any value to match, but I do not know how to touch the action menu stuff and certainly do not want to be responsible for poking around in there.

Profit0004 commented 1 year ago
Profit0004 commented 1 year ago
Karol1223 commented 1 year ago
  • Volume wise there are 8 planks per log assuming a standard 4 foot 2x4 plank. (1 1/2" by 3 1/2" actual dimensions plus milling losses) or 12 planks per log if you accept the volume given in game of 4.13L per plank. Obviously it is not possible to do a perfect conversion but it is not actually breaking the laws of physics.

The volume and the dimensions are different things, though. The issue is that you'd only be able to calculate it from base volume if the log was a solid cube of wood, which it is not. I've calculated the diameter from the volume and the longest side and you'd be looking at 6 or 8 (likely 8) planks with precision cuts. Unfortunately axes don't do precision cuts, but 8 does seem reasonable for powertools (which I mentioned in another PR, don't remember the number now)

cake-pie commented 1 year ago

63219 starts the C++ culling by taking out done_trunk_plank. The next step, removal of LUMBER use action, will require replacement crafting recipes be in place.

I do not know how to touch the action menu stuff and certainly do not want to be responsible for poking around in there. there is also an area action that will need to be changed as well

Don't worry, see workload breakdown plan here, someone else can take care of that.

With reference to that plan,

63178 addresses part 1, json, sawing with power tools

63201 addresses part 2a, json, sawing with power tools

So it's just a matter of hashing out among you guys what the stats should be in order have reasonable requirements and sane amounts of outputs, then making either ensure the two PRs match, or put it all into one PR.

Karol1223 commented 1 year ago

Exactly what cake-pie just said. You don't need to fix everything, all I'd be asking is for you to have your recipe modified to use the axe quality (and several number changes to match that, but I'd let you know about them after/if you change the quality in the first place). If you don't want to do that, it's fine, I'll just make a PR for that but I feel bad usurping the possibility for you to do that.

Profit0004 commented 1 year ago

Exactly what cake-pie just said. You don't need to fix everything, all I'd be asking is for you to have your recipe modified to use the axe quality (and several number changes to match that, but I'd let you know about them after/if you change the quality in the first place). If you don't want to do that, it's fine, I'll just make a PR for that but I feel bad usurping the possibility for you to do that.

No, by all means, feel free to change it after it gets merged, if you are comfortable doing so. I personally do not want to be responsible for changing such an established system and the ensuing balance chaos that may come from that. I will support such an action, but I am just not a regular enough contributor to feel I am in a position to make such sweeping changes, and so I defer to people who are much more active in the project.

github-actions[bot] commented 1 year ago

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.