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

Simulating hair growth, part 2 (fixed for trait variants) #70671

Merged
merged 30 commits into from
Feb 22, 2024

Conversation

MNG-cataclysm
Copy link
Contributor

@MNG-cataclysm MNG-cataclysm commented Jan 5, 2024

Summary

Content "Simulate hair growth over time."

Purpose of change

Simulate hair growth for NPCs and players over long periods of time. Hair will slowly grow out until it becomes long and can then be cut back. I have now fixed this to work with trait variants. I have also made this dependent on the hidden health stat, so healthier survivors will grow their hair faster.

There's a few things that need to happen before this is ready to go:
This is ready to go, all tasks have been completed.

  • Add an EOC to advance hair between the various stages of growth, based on average growth rates.
  • Add conditionals to properly carry over hair color between growth cycles, rather than hair color randomly changing.
  • Integrate Make hair styles conform to using variants for colors #70017 properly with this system (might need to update my game or port relevant changes)
  • Add ultra-long hair growth traits that can be achieved via this system, down-to-the-waist type stuff.
  • Make sure cutting and cosmetic changes properly work with these traits.
  • Edit NPC starting traits to accommodate for trait changes.
  • Rinse and repeat with beards.
  • If no hair traits have been chosen, randomly assign some on game start.
  • Integrate colors into style variants, and make sure that the new system works.
  • Finish trait variant descriptions.

Describe the solution

Add supporting EOCs and mutations to simulate hair growth, allowing players to grow out their hair over time. This currently is only cosmetic in nature, but it provides good roleplaying opportunity and a way to passively change hair styles. This also adds color variants to the new hair styles, and finishes the descriptions of some trait variants which had placeholder descriptions.

This also includes a selectable starting trait that prevents all hair growth, for those who don't want their cosmetics to change. This can be toggled at Vanessa Toby once she can provide cosmetic services.

Describe alternatives you've considered

Not doing this.

Testing

Repeatedly tested during development cycle, everything works as expected.

Additional context

I have some bigger ideas for this, that might be added after the basic infrastructure is up and running:

  • Add a hair type, independent of style, such as wavy, curly, or straight. This should govern what style your hair grows in to, like becoming an afro instead of long hair, so on and so forth.
  • Add a preferred hair type that NPCs and players can have, gives a very small (+3-5) morale bonus for "looking stylish" if their hair looks like that. Probably shouldn't give a morale penalty for not having this style, that might be too micro-managey.
  • Add NPC logic for cutting hair if it gets too long. Could probably be automatic, or it might require a map item check for a stylists kit in a given radius.
  • Add unkempt versions of hair and beards, might give a very slight penalty to social checks. Alternatively, instead of a penalty, being well-groomed gives a slight social bonus.

This might also need #70086 to work properly. I don't know if there's a workaround for it, though.

I have also wondered if I should have the beard growth EOCs track if the character is male or female, and work off of that for facial hair growth, but that might violate the game's development policy of selecting gender instead of sex.

Unfortunately, with the changes relying on trait variants, I don't know of a way to carry over trait variants between activation changes, since we can't use u_has_trait to check for variants.

I've also changed this feature to work on an opt-in basis: Characters imported from previous saves won't begin having their hair grow unless the user toggles it. The trait for natural hair growth can also be selected at the start of the game, allowing new characters to use this system.

@github-actions github-actions bot added NPC / Factions NPCs, AI, Speech, Factions, Ownership [JSON] Changes (can be) made in JSON Mods Issues related to mods or modding Mutations / Traits / Professions/ Hobbies Mutations / Traits / Professions/ Hobbies [C++] Changes (can be) made in C++. Previously named `Code` Character / World Generation Issues and enhancements concerning stages of creating a character or a world Mods: Aftershock Anything to do with the Aftershock mod EOC: Effects On Condition Anything concerning Effects On Condition Mods: Xedra Evolved Anything to do with Xedra Evolved labels Jan 5, 2024
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto-requesting reviews from non-collaborators: @GuardianDll

@github-actions github-actions bot added json-styled JSON lint passed, label assigned by github actions astyled astyled PR, label is assigned by github actions labels Jan 5, 2024
src/newcharacter.cpp Outdated Show resolved Hide resolved
src/newcharacter.cpp Outdated Show resolved Hide resolved
@Fris0uman
Copy link
Contributor

I don't think forced change to cosmetics is an okay mechanic to add. This also apperas to do a lot of unnecessary change in the json for hair style traits.

@harakka
Copy link
Member

harakka commented Jan 9, 2024

No hair growth should be the default that all characters get, including coming from saves prior to this, and the opt-in is to have hair growth.

@MNG-cataclysm
Copy link
Contributor Author

MNG-cataclysm commented Jan 9, 2024

I've now made dynamic hair growth an opt-in feature for players, rather than one that they need to opt out of. This will prevent characters from previous saves from suddenly growing out their hair, thus keeping the style that they selected at the beginning of the game.

@Maleclypse
Copy link
Member

I like the idea of this as an option but I think we need to hear from tileset people that it doesn’t mess up tiling and that it meets Kevin’s requirements for inclusion that he gave in the previous reversion. I think it’s cool.

Copy link
Contributor

Spell checker encountered unrecognized words in the in-game text added in this pull request. See below for details.

Click to expand
  • Hair: afro
  • Hair: black, afro
  • Hair: black, long mohawk
  • Hair: blond, afro
  • Hair: blond, long mohawk
  • Hair: blue, afro
  • Hair: brown, afro
  • Hair: brown, long mohawk
  • Hair: gray, afro
  • Hair: green, afro
  • Hair: green, long mohawk
  • Hair: long mohawk
  • Hair: pink, afro
  • Hair: purple, afro
  • Hair: purple, long mohawk
  • Hair: red, afro
  • Hair: white, afro
  • Hair: white, long mohawk
  • I'd like it if my hair didn't grow out anymore. Can you help me with that?
  • You have a black mohawk, spiky in the middle and shaved on the sides. Rock on!
  • You have a blond mohawk, spiky in the middle and shaved on the sides. Rock on!
  • You have a brown mohawk, spiky in the middle and shaved on the sides. Rock on!
  • You have a bushy afro.
  • You have a bushy black afro.
  • You have a bushy blond afro.
  • You have a bushy blue afro.
  • You have a bushy brown afro.
  • You have a bushy gray afro.
  • You have a bushy green afro.
  • You have a bushy pink afro.
  • You have a bushy purple afro.
  • You have a bushy red afro.
  • You have a bushy white afro.
  • You have a green mohawk, spiky in the middle and shaved on the sides. Rock on!
  • You have a longer black mohawk, the sides have grown out into fuller hair, while the middle is drooping somewhat.
  • You have a longer blond mohawk, the sides have grown out into fuller hair, while the middle is drooping somewhat.
  • You have a longer blue mohawk, the sides have grown out into fuller hair, while the middle is drooping somewhat.
  • You have a longer brown mohawk, the sides have grown out into fuller hair, while the middle is drooping somewhat.
  • You have a longer gray mohawk, the sides have grown out into fuller hair, while the middle is drooping somewhat.
  • You have a longer green mohawk, the sides have grown out into fuller hair, while the middle is drooping somewhat.
  • You have a longer mohawk, the sides have grown out into fuller hair, while the middle is drooping somewhat.
  • You have a longer pink mohawk, the sides have grown out into fuller hair, while the middle is drooping somewhat.
  • You have a longer purple mohawk, the sides have grown out into fuller hair, while the middle is drooping somewhat.
  • You have a longer red mohawk, the sides have grown out into fuller hair, while the middle is drooping somewhat.
  • You have a longer white mohawk, the sides have grown out into fuller hair, while the middle is drooping somewhat.
  • You have a mohawk, spiky in the middle and shaved on the sides. Rock on!
  • You have a pink mohawk, spiky in the middle and shaved on the sides. Rock on!
  • You have a purple mohawk, spiky in the middle and shaved on the sides. Rock on!
  • You have a red mohawk, spiky in the middle and shaved on the sides. Rock on!
  • You have a white mohawk, spiky in the middle and shaved on the sides. Rock on!

This alert is automatically generated. You can simply disregard if this is inaccurate, or (optionally) you can also add the new words to tools/spell_checker/dictionary.txt so they will not trigger an alert next time.

@github-actions github-actions bot removed the BasicBuildPassed This PR builds correctly, label assigned by github actions label Feb 2, 2024
@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Feb 2, 2024
@kevingranade
Copy link
Member

My only strong stipulation is that it needs to be opt-in.

Please revert the hair style description changes, that's out of scope for adding changing styles. The first several I looked at have issues but I'm not getting into reviewing them in this PR.

One thing I'm not clear on, is this being applied to all npcs? They should also default to maintaining a style, even if it's chosen randomly, because otherwise they'll all converge on super long hair and all be the same. It looks like they aren't getting the trait assigned but I'd like a confirmation.

@MNG-cataclysm
Copy link
Contributor Author

MNG-cataclysm commented Feb 10, 2024

My only strong stipulation is that it needs to be opt-in.

I have made it an opt-in basis. Players will need to have the hair growth trait for their styles to naturally change, which can be selected at character creation, or toggled with the hairdresser NPC in the refugee center.

One thing I'm not clear on, is this being applied to all npcs? They should also default to maintaining a style, even if it's chosen randomly, because otherwise they'll all converge on super long hair and all be the same. It looks like they aren't getting the trait assigned but I'd like a confirmation.

The NPC do get the new hair style traits, but they don't receive the trait that allows their hair to grow over time; they will always have the same style they did upon spawn. I still need to add code that has the NPCs maintain a style on their own, but I figured that would make this PR too large, so I reserved it for a followup. Their hair won't grow on their own.

@esotericist
Copy link
Contributor

what is the point of shuffling around the contents of the hair style mutations? it's making it very difficult to actually see what did or didn't change.

@MNG-cataclysm
Copy link
Contributor Author

what is the point of shuffling around the contents of the hair style mutations? it's making it very difficult to actually see what did or didn't change.

I must've shuffled them in development for ease of remebering which growth order they went in. I'll see about undoing this.

@Maleclypse Maleclypse merged commit 736241d into CleverRaven:master Feb 22, 2024
26 checks passed
@MNG-cataclysm MNG-cataclysm deleted the simulating_hair_growth branch February 23, 2024 19:12
"//3": "For ease of calculation, all math will be done with centimeters for hair growth.",
"//4": "For reference starting point, a buzzcut is 0.32 centimeters long.",
"//5": "1 inch is 2.54 centimeters.",
"recurrence": { "math": [ "(648000000 - ((u_val('health') * 180000) ) )" ] },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you mixed up numbers here? even with 200 health, the result would be 612000000, which is 7083 days
i suspect you put two zeroes more than it should be (recurrence smallest value is 1 second, not 1 move)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I likely misplaced some zeroes, yes. I'll see about having that fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions [C++] Changes (can be) made in C++. Previously named `Code` Character / World Generation Issues and enhancements concerning stages of creating a character or a world EOC: Effects On Condition Anything concerning Effects On Condition [JSON] Changes (can be) made in JSON json-styled JSON lint passed, label assigned by github actions Mods: Aftershock Anything to do with the Aftershock mod Mods: Xedra Evolved Anything to do with Xedra Evolved Mods Issues related to mods or modding Mutations / Traits / Professions/ Hobbies Mutations / Traits / Professions/ Hobbies NPC / Factions NPCs, AI, Speech, Factions, Ownership
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants