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

If clothes fit character A, they fit character B in the same world #27293

Open Inglonias opened 5 years ago

Inglonias commented 5 years ago

Describe the bug
Clothing that fits one character will fit another character if they stumble on it in the same world. This can lead to exploits such as having several characters commit suicide in a known location so that characters afterwards can get their stuff. It also implies that every survivor has the same measurements, which is weird.

To Reproduce
Steps to reproduce the behavior:

  1. Make a character in a world that does not reset when that character dies.
  2. Kill that character
  3. If another one finds that character's body, the clothing will still fit if it did before.

Expected behavior
Clothing that fits one character may or may not fit another.

Versions and configuration(please complete the following information):

Additional context
I've been thinking about this issue for a long time. The simplest solution would be to reroll clothing if a new character comes across it, but I don't know how possible that is. Another more involved solution is to give characters a size stat randomly at char gen, between, say, 1 and 5, and give all clothing a random size stat as well. Clothing would fit if the sizes were equal, and would be poor fitting otherwise. This would be more in-depth, but hits some realism problems because while you can wear clothes that are too big without breaking them, trying to do the same with clothes that are too small would cause problems.

Alternatively, we can ignore this issue. It is, admittedly, not a major concern. I typically reset my worlds when my characters die anyhow, as having a character come across an existing base causes bigger issues than "clothes shouldn't all fit just the same way". Namely the fact that they have all of that prior character's clothes, guns, cars, weapons, and whatever else they leave behind.

Zireael07 commented 5 years ago

I believe we had an issue about the 'suicide and get stuff' exploit before, and the consensus was 'not the intended way to play so we won't do anything to fix'

For normal gameplay, having several size stats might be a lot of work for relatively little gain.

JacobKessler commented 5 years ago

Another side effect of this is that NPCs change in size with the character, so clothing that fits the player also fits all NPCs.

My current run is with the mouse mutation path, and it's sort of amusing that I need to resize all of my NPC's clothing to fit my tiny build. It also means that many otherwise-armored hostile NPCs are hilariously encumbered by their starting gear, and thus the only NPCs that can wear heavy armor are those saved by me and my tailor's kit / welder.

It looks like the issue is that items (when they are determining if they fit or not) determine if they fit without reference to who they fit. There are also a lot of hardcoded references to the global player, rather than a wearing character, in item.ccp. Coupled with "fits" being a flag, rather than something like a character that they fit, and the UI issues inherent in making clothing that fit some but not all people work nicely with NPCs, this seems like it's a difficult and involved fix.

kevingranade commented 5 years ago

The NPC aspect is a bigger problem than the successive player issue. I do think the best option is to add clothing and character sizing, possibly with a range of sizes a character can wear as ill-fitting, and possibly some restrictions on resizing.

Dansiman commented 5 years ago

As displayed, there seem to be 3 possible ways clothes can fit:

Suggestion: Make 3 different "body types", they can simply be called A, B, and C (these would be internal values and never displayed to the player). One of them is randomly assigned to the PC at chargen, and all items with VARSIZE roll for one of the three when they're created. If the clothing matches the player, then it "fits you well". If it's one of the other two, use a rock, paper, scissors rule to decide whether it's a "poor fit" or simply not a perfect fit. In this way, we can easily abstractify the sizing, without having to get into the details of which direction the fit is off. And by keeping the types abstract like this, we avoid giving an advantage to any one of them, e.g. making "small" characters better because they won't damage an article of clothing the way a "large" character could when wearing something "small".

So if an "A" character wears a "B" jacket, it fits ok, but not great. If they wear a "C" jacket, it is a poor fit and adds more encumbrance. A "B" character can wear that "C" jacket and be a little more comfortable in it then the "A" character was, but an "A" jacket would really be a poor fit for that "B" character.

GearheadLydia commented 4 years ago

Semi-formed idea I had while thinking about how I'd implement it while playing: "fit" could be abstracted to a semi-arbitrary one or two bytes, or some other similarly compact format. The character's data could then be checked against the value stored in a piece of clothing to see whether or not any given piece of clothing fits the character, and if it's off, by how much (how many bits or however we're doing this).

I'm not sure how the actual bit structure would have to look, but I can't imagine that there are more than about two or three measurements for any shirt or pair of pants; it's therefore not too much of a stretch to imagine that a very small value with mostly bitwise values could hold sizes for most sensible clothing.

If we really wanted to get fancy with it, we could have the character value longer than the actual clothing value, and the clothing value could be compared against only a section of the character value that's relevant to the areas of the body in question.

Admittedly, this may be the wrong approach, given that this is written more with compactness in mind than human-readability or future-proofing. Also, this was written from the perspective that corpses and zombies and such could have a single randomized body shape and have clothes automatically fit to them.

kevingranade commented 4 years ago

Starting from the point of view of saving bits is backwards, we have techniques for only storing values on clothing items that are subject to sizing, so trying to bit-pack the options from the start is probably not necessary, and as you note interferes with readability.

I'm far more concerned with how this is displayed to the player and how it impacts the game.

This is simplified by adopting some reasonably well-known standard and implementing it in a straightforward way. i.e. establish various classes of clothing sizes and adopt something resembling their real-world sizing systems. I say resembling because I'm not enough of a sadist to implement American women's clothing sizes, probably we'd do something far more rational like "inches at waist" for pants, "inches at chest" for shirts, etc, i.e. an idealized form of the measurement systems instead of the advertising and competition based nonsense that characterizes real-world clothing measurement systems.

GearheadLydia commented 4 years ago

Hm. If we're going deep-dive on this, I'm not a tailor, but I've done a few projects involving taking measurements like this. At this point we're probably going to want to work backwards from statistical measurements or something, especially those that have the most consequence. It'd be good if we could get our hands on something like the measurements they took of fighter pilots in the '50s for cockpit design; although those studies specifically are of course 7+ decades old and don't represent the current average, a data set like that would help demonstrate what the military looked at there.

(I'm also a bit concerned that we're going to end up with too much granularity that's going to lead to rounding / off-by-one errors, but again, that may be putting the implementation cart before the theory horse here.)

One aspect of the problem I'll single out for now: There are a lot of measurements that could possibly be taken that are relevant to clothes. Of those, only some of those will be relevant to each article of clothing; some will probably barely matter at all. Worsening this is that some measurements are presumably overlapping. This chart is the most exhaustive list I've found, but even ignoring that some measurements won't be relevant to some people, most of these would probably be overkill.

Most important ones that come to mind for our purposes, in descending order:

For each of these measurements, I think each piece of clothing should probably have an "ideal fit" measurement (variable per example of each item), a "good fit" deviation margin (outside which it gives a "poor fit" label and maybe gives a message when you wear it about it not fitting right), and a "fits at all" deviation margin (outside which you can't put the item of clothing on). I'm not sure how refitting would work, though of course adding material should be harder than trimming it out.

I say resembling because I'm not enough of a sadist to implement American women's clothing sizes [...] the advertising and competition based nonsense that characterizes real-world clothing measurement systems.

(Good. On that note, who thinks up that nonsense, anyway? Sometimes it seems optimized for intentional confusion. Also: pockets, please!)

Dansiman commented 4 years ago

The more detail we put into it, the less likely any found piece of clothing is to be a good fit for any given character. We'll want to make sure and consider the impact of this when determining how much tolerance to bake into the formulae.

Inglonias commented 4 years ago

Alright, so I was notified about this issue again and the game has advanced to the point where this can be made into a legit thing.

GearheadLydia commented 4 years ago

Weight, and maybe height insofar as height is implemented at all, would strike me as the best solution with very few values involved.

That said -- admittedly speaking strictly from a perspective of women's clothing -- when exactly do off-the-rack clothes fit without so much as minor annoyances, anyway?

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.