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

Better Difficulty Info #52877

Closed
wants to merge 20 commits into from
Closed

Conversation

dseguin
Copy link
Member

@dseguin dseguin commented Nov 18, 2021

Summary

None

Purpose of change

Reading through #37869, I liked the suggestion of showing how selected options on character creation affect gameplay difficulty in different ways. For example: Fast Learner may be a really good trait if you're focusing on crafting, but doesn't really help as much in combat.

Describe the solution

Here's a demonstration:

2021-11-20.02-07-52.mp4

This change adds information to the character creation screen to estimate different aspects of difficulty. I've added 5 areas of difficulty (based on Erk's comments in the issue and the comments below):

  • Combat (interacting with enemies)
  • Mobility (speed and dexterity)
  • Crafting (learning and applying skills)
  • Environment (how safe you are when starting out)
  • Social (interacting with NPCs)

These areas are defined in JSON using the "difficulty_impact" type:

{
  "type": "difficulty_impact",
  "//": "Difficulty impacting melee and ranged combat",
  "id": "combat",
  "name": "Combat"
  "weight": {
    "scenario": 0.2,
    "profession": 1.0,
    "hobby": 0.2,
    "mutation": 0.5,
    "skills": 0.8,
    "strength": 0.6,
    "dexterity": 0.2,
    "intelligence": 0.0,
    "perception": 0.0
  }
}

Each impact of difficulty is weighted differently depending on the source of the difficulty. Environmental difficulty is mostly based on the scenario, while combat difficulty is based more on profession and mutations.

The difficulty rating varies from Very Easy to Very Hard. These difficulty ratings are defined using in JSON using the "difficulty_opt" type:

{
  "type": "difficulty_opt",
  "id": "very_hard",
  "value": 5,
  "name": "Very Hard",
  "color": "light_red"
}

"value" represents the difficulty relative to other difficulty ratings (higher = harder). "color" is used to highlight the difficulty text in the character creation screen.

Difficulty can be defined for scenarios, professions, hobbies, and traits/mutations. Here's a sample definition from the "A Really Bad Day" scenario:

{
  "type": "scenario",
  "id": "bad_day",
  "name": "Challenge - Really Bad Day",
  "points": -8,
  "difficulty": [
    [ "combat", "very_hard" ],
    [ "mobility", "very_hard" ],
    [ "crafting", "normal" ],
    [ "environment", "very_hard" ],
    [ "social", "normal" ]
  ],
  ...
}

Each pair of strings in "difficulty" refers to a "difficulty_impact" and a "difficulty_opt" (respectively).

Difficulty can also scale with skills, by defining the "difficulty_scale" field:

{
  "type": "skill",
  "id": "firstaid",
  "name": { "str": "health care" },
  "difficulty_scale": [
    [ "crafting", 0.1 ],
    [ "environment", 0.4 ]
  ],
  ...
}

The difficulty info is displayed below the point pool information:

diff_info_large

It also looks okay on smaller screens, although the layout may need to change for really small screens (TERMX < 100):

diff_info_small

Describe alternatives you've considered

The layout might not be optimal. I'm terrible at design so I will defer to the experts.

Testing

For each screen in character creation, scroll through each list on each screen to verify that key elements match the defined difficulty values. See the recorded video above.

Additional context

(Holy cow, what a massive undertaking for such a seemingly simple feature: ~6000 lines of JSON and ~800 lines of cpp!)

TODO:

  • Create new JSON fields "difficulty_impact", "difficulty_opt", "difficulty", and "difficulty_scale"
  • Read new difficulty values into difficulty_impact and difficulty_opt objects
  • Allow scenarios, professions/hobbies, and traits/mutations to specify difficulty impact
  • Add difficulty details to existing elements:
    • Scenarios
    • Professions
    • Hobbies
    • Traits/Mutations
    • Stats
    • Skills
  • Documentation
  • Testing

@Amoebka
Copy link
Contributor

Amoebka commented Nov 18, 2021

I don't think separating combat into offense and defense is really warranted. Killing stuff quickly reduces incoming damage, compensating for weak defences, and strong armor/dodge/blocking compensates for weak offense by allowing to turtle and fish for crits.
Imo, a better way to split this is "combat" (how good you are when it comes to fighting stuff) and "mobility" (how much control you have in choosing which fights to take to begin with, includes both speed boosters and stealth).

@BrettDong BrettDong added Character / World Generation Issues and enhancements concerning stages of creating a character or a world Info / User Interface Game - player communication, menus, etc. [C++] Changes (can be) made in C++. Previously named `Code` labels Nov 18, 2021
@dseguin
Copy link
Member Author

dseguin commented Nov 19, 2021

Great news: I've jsonified the difficulty types and ratings, so anyone can modify how the difficulty is displayed by editing difficulty.json (details in PR description).

Also (based on your feedback), I've changed up the difficulty types to: "combat", "mobility", "crafting", "environment", and "social".

Also also, thank you for the feedback on scenario/profession/mutation/etc difficulty ratings. I have no sense of difficulty, so I'm relying on others to correct me.

@Termineitor244
Copy link
Contributor

What is your reasoning behind the "environment" differences in the professions? I see that a normal survivor has an "easy" environment but a chef or tailor have "normal", unless they spawn in different places (already covered in scenarios) or spawn naked/sick/etc. I don't see any reason for these to have a different environment level than a standard survivor.

@dseguin
Copy link
Member Author

dseguin commented Nov 19, 2021

What is your reasoning behind the "environment" differences in the professions? I see that a normal survivor has an "easy" environment but a chef or tailor have "normal", unless they spawn in different places (already covered in scenarios) or spawn naked/sick/etc. I don't see any reason for these to have a different environment level than a standard survivor.

It's pretty arbitrary at the moment. I don't have a good sense for difficulty, so feel free correct me if anything looks off. Suggestions are very welcome!

@Termineitor244
Copy link
Contributor

Then I will give it a good read! I will just finish correcting some msitakes from one of my PRs and then I will try to review these files.

Copy link
Contributor

@Termineitor244 Termineitor244 left a comment

Choose a reason for hiding this comment

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

I only could review the professions, I mainly suggested changes based on this:
Combat: Skills or a weapon are good, but only having 1 of the 2 makes it harder to do effective combat.
Mobility: Mainly vehicles and skates/parkour and driving skill.
Crafting: Fabrication, electronics, mechanics, science, food handling and tailoring (mainly), tools help a lot to improve the score here.
Environment: Health Care and Survival, as well as tools/medicines.
Social: The social skill.

I also considered the conditions of the scenarios that certain professions need you to choose to select them, and the effect in the environment (Winter, evolved monsters, migo tower) and yourself that these scenarios can generate.

data/json/professions.json Outdated Show resolved Hide resolved
data/json/professions.json Outdated Show resolved Hide resolved
data/json/professions.json Outdated Show resolved Hide resolved
data/json/professions.json Outdated Show resolved Hide resolved
data/json/professions.json Outdated Show resolved Hide resolved
data/json/professions.json Outdated Show resolved Hide resolved
data/json/professions.json Outdated Show resolved Hide resolved
data/json/professions.json Outdated Show resolved Hide resolved
data/json/professions.json Outdated Show resolved Hide resolved
data/json/professions.json Outdated Show resolved Hide resolved
@dseguin
Copy link
Member Author

dseguin commented Nov 19, 2021

Done. Thanks for the feedback!

Copy link
Contributor

@Termineitor244 Termineitor244 left a comment

Choose a reason for hiding this comment

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

I reviewed the scenarios and hobbies files, I'm not so sure of some of the suggestions to hobbies, but the scenarios do need some adjustments given the difficulty of several of them.

data/json/scenarios.json Outdated Show resolved Hide resolved
data/json/scenarios.json Outdated Show resolved Hide resolved
data/json/scenarios.json Outdated Show resolved Hide resolved
data/json/scenarios.json Outdated Show resolved Hide resolved
data/json/scenarios.json Outdated Show resolved Hide resolved
data/json/hobbies.json Outdated Show resolved Hide resolved
data/json/hobbies.json Outdated Show resolved Hide resolved
data/json/hobbies.json Outdated Show resolved Hide resolved
data/json/hobbies.json Outdated Show resolved Hide resolved
data/json/hobbies.json Outdated Show resolved Hide resolved
@dseguin dseguin marked this pull request as ready for review November 20, 2021 07:27
@dseguin dseguin requested a review from BrettDong as a code owner November 20, 2021 07:27
@dseguin
Copy link
Member Author

dseguin commented Nov 20, 2021

@Termineitor244 Thank you for the effort of going through each file. I really appreciate it!

I've also updated the PR description with a video showing the feature in action.

@Termineitor244
Copy link
Contributor

@Termineitor244 Thank you for the effort of going through each file. I really appreciate it!

I've also updated the PR description with a video showing the feature in action.

You're welcome! I can't help much with the c++, so the least I can do is help with JSON part.

And the video helps much! I have been wanting this feature since I read the original issue, so thanks for implementing it!

@github-actions github-actions bot added astyled astyled PR, label is assigned by github actions json-styled JSON lint passed, label assigned by github actions labels Nov 30, 2021
Copy link
Member

@BrettDong BrettDong left a comment

Choose a reason for hiding this comment

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

Python code formatting:

lang/string_extractor/parsers/difficulty_impact.py Outdated Show resolved Hide resolved
@dseguin dseguin force-pushed the eval_difficulty branch 2 times, most recently from b84db1d to 30438f9 Compare December 1, 2021 15:55
@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Dec 1, 2021
@dseguin dseguin force-pushed the eval_difficulty branch 2 times, most recently from 081d3e7 to b531a08 Compare December 8, 2021 00:10
@github-actions github-actions bot removed the BasicBuildPassed This PR builds correctly, label assigned by github actions label Dec 8, 2021
@Fris0uman
Copy link
Contributor

Damn that's awsome! But now ( not necessarily in this PR) We need some balance documention on how to estimate what is hard and is easy for people to be able to keep adding stuff and not break the system.

@I-am-Erk
Copy link
Member

AFAICT this could be merged if conflicts fixed, are there any outstanding objections?

dseguin and others added 20 commits December 9, 2021 23:03
Each impact of difficulty is weighted differently depending
on the source of the difficulty. Environmental difficulty is
mostly based on the scenario, while combat difficulty is based
more on profession and mutations.
@dseguin
Copy link
Member Author

dseguin commented Dec 10, 2021

I'm calling this one ready. It's possible that some tweaking will be needed in future PRs, but pretty much everything is defined in JSON (with documentation) so anyone can make changes.

Copy link
Member

@BrettDong BrettDong left a comment

Choose a reason for hiding this comment

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

i18n part looks good to me.

@kevingranade
Copy link
Member

I'm afraid this is taking difficulty evaluation in a direction I don't want it to go, so I'm not going to be merging it.

It suffers from two fatal flaws (that are shared by the existing system).

  1. It requires maintaining extensive and subjective annotations of how valuable different traits are. This is a pretty traditional approach, but has severe problems when applied to a sprawling freeform game like dda, because those values are constantly subject to change as the game evolves, and therefore must be constantly maintained.
  2. Simply adding the values together is reasonable as long as you insure that all selectable traits are completely distinct from each other, but that is not the case with dda either, we have both a number of traits that heavily synergise with each other such that it would be more accurate to multiply their impact rather than add it, and other traits that overlap such that selecting trait A and trait B is no better than the larger of the two impacts.

What I really want to see in this area is an evaluation of player stats resulting from the various traits, stats, and skill levels that are currently applied, so that we don't have to manually audit or maintain lists of difficulty evaluations.
For example for combat we could develop an evaluation of how many attacks it takes to kill various enemies, or how many attacks the player can sustain before being debilitated, and use that to drive a combat offence and defence score. Likewise for social ability we want to simply evaluate how persuasive the character is in aggregate.

@I-am-Erk
Copy link
Member

Since this represents a lot of work I want to throw in that I know Kevin spent a while strongly debating how to approach this PR, and this is definitely a highly wanted feature. I hope you won't feel discouraged and will keep working on this. Much of what you have is perhaps still usable, once the algorithms are worked out for dynamic calculation of difficulty.

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 Info / User Interface Game - player communication, menus, etc. json-styled JSON lint passed, label assigned by github actions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants