CleverRaven / CleverRaven/Cataclysm-DDA

Hundreds of items have nonsensical densities and need correction

Open
#54,811 15 comments 7 reactions 0 assignees View on GitHub
(P5 - Long-term) [JSON] <Suggestion / Discussion> Help Wanted Items / Item Actions / Item Qualities
Dominant language
C++
Stars
13.2k
Forks
4.6k
Avg merge
2d 1h
Merged PRs (30d)
205

Description

### Describe the bug

Several hundred items (which I have identified) have densities that appear to be way out of line with their material composition. All current instances of this need to be resolved in order to merge a test that will prevent this from happening in the future.

### Steps to reproduce

1. Look at item stats for something like burdock wine (one of the items on the list), noting the volume, mass, and also note how charges apply to volume and mass if applicable (volume is for one stack of the amount of charges, mass is per charge)
2. Burdock wine has a volume of 0.25L, mass of 0.25kg, and 7 charges, so a stack of 7 will have volume of 0.25 and mass of 1.75kg.
3. Burdock wine is almost as heavy as steel -- about 7g/cm3, with steel being 8.

### Expected behavior

Items should have densities that are no greater than that suggested by their materials, and generally well under that -- sheet metal, for instance, has a density of 6g/cm3, suggesting that even items in a favorable shape for storage often aren't very efficiently stored (though there are some that I'd say are justified being equal, like liquids and things like the 800L plastic cube)

### Screenshots

_No response_

### Versions and configuration

- OS: Windows
- OS Version: 10.0 2009
- Game Version: 2ed119b [64-bit]
- Graphics Version: Tiles
- Game Language: System language []
- Mods loaded: [
Dark Days Ahead [dda],
Disable NPC Needs [no_npc_food],
No Fungal Growth [no_fungal_growth],
Bionic Professions [package_bionic_professions],
Aftershock [aftershock],
Blaze Industries [blazeindustries],
Crazy Cataclysm [crazy_cataclysm]
]

### Additional context

[bad-item-density.txt](https://github.com/CleverRaven/Cataclysm-DDA/files/7943730/bad-item-density.txt)

This first file has all of the items listed. ~~I am working on a second file which has only the very obviously incorrect items and none that may warrant changes to the test or the base material density.~~ Second list is done, I removed about 100 items which I think should be resolved later instead:
[low-hanging-fruit.txt](https://github.com/CleverRaven/Cataclysm-DDA/files/7952784/low-hanging-fruit.txt)

Some pointers for people fixing items on this list:

- You should probably leave things made of organic matter alone until most of the rest have been whittled down.
- A number of items have densities that COULD make sense if the percentage composition of each material was altered, which is a new feature. My testing suite takes that into account. One example is the batteries that are at the top of the file. If an item can be fixed by altering material ratios without touching mass or volume, do that.
- Pay close attention to item charges! The bug I mentioned with burdock wine is responsible for a LOT of the worst offenders.
- Let it be emphasized that the vast majority of items are not in a perfectly efficient shape for storage, and therefore should not be exactly equal to material density. Don't just multiply the item's existing mass by density and call it a day.
- The list is subject to change, off the top of my head I should be able to test rigid containers more thoroughly by subtracting interior volume, and tweaking density values for materials will also change things, I'll update the list here if I change anything of that nature.

Common material densities used from my test (you can refer to my updated materials.json here: https://github.com/CleverRaven/Cataclysm-DDA/pull/54747/files ):
- Elemental substances like copper or silver, or those with well-defined chemical compositions, are just the density for that element or substance
- Bronze is 8.8
- Plastic is 1.0
- Kevlar is 1.4 (all forms)
- Iron and all Steels are 8.0
- Most organic matter including leather is 1.1 -- might be subject to change later. Bones are 1.4.
- Glass is 2.5
- Ceramic is 4.5
- Chitin is 1.45
- Superalloy is 1.8 but I might change it
- Stone is 2.8
- Clay is 1.6

(also tagging PR #54747)

Contributor guide

Open the contributing guide

Research direction

Start with low-hanging-fruit.txt, then compare the listed items with the relevant material densities in materials.json and account for charges and material ratios. Use the density test suite described in the issue to verify corrections, ensuring the listed high-priority items are resolved while leaving organic-material cases for later.

Written by the indexing model from the issue text.

Assessment

Tech stack
json
Domain
game-dev, testing-qa
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.