-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
NPC AI/ fleeing adjustments 2: Come back, little NPC #67870
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I will probably need a little help with this
github-actions
bot
added
<Enhancement / Feature>
New features, or enhancements on existing
NPC / Factions
NPCs, AI, Speech, Factions, Ownership
[JSON]
Changes (can be) made in JSON
[C++]
Changes (can be) made in C++. Previously named `Code`
astyled
astyled PR, label is assigned by github actions
json-styled
JSON lint passed, label assigned by github actions
labels
Aug 24, 2023
Now it won't kick in if the NPC is already close to you
* Expose NPC AI consts to options I will probably need a little help with this * Restore 'regroup on player' Now it won't kick in if the NPC is already close to you * Remove unnecessary messages
I-am-Erk
commented
Aug 24, 2023
This could be merged as is, but there are a few things I'd love to refine if someone with better code skills is around. |
Also tweaks balance settings
github-actions
bot
added
the
BasicBuildPassed
This PR builds correctly, label assigned by github actions
label
Aug 24, 2023
Qrox
reviewed
Aug 25, 2023
gadgetpatch
reviewed
Aug 25, 2023
Co-authored-by: Dana Holdampf <[email protected]>
github-actions
bot
removed
the
astyled
astyled PR, label is assigned by github actions
label
Aug 25, 2023
way more work than i anticipated
github-actions
bot
added
the
astyled
astyled PR, label is assigned by github actions
label
Aug 25, 2023
github-actions
bot
removed
the
BasicBuildPassed
This PR builds correctly, label assigned by github actions
label
Aug 25, 2023
github-actions
bot
added
the
BasicBuildPassed
This PR builds correctly, label assigned by github actions
label
Aug 25, 2023
I-am-Erk
changed the title
NPC AI/ fleeing adjustments 2: Adjust and expose NPC AI constants
NPC AI/ fleeing adjustments 2: Come back, little NPC
Aug 26, 2023
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`
<Enhancement / Feature>
New features, or enhancements on existing
[JSON]
Changes (can be) made in JSON
json-styled
JSON lint passed, label assigned by github actions
NPC / Factions
NPCs, AI, Speech, Factions, Ownership
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Features "Tweak NPC fleeing AI based on playtesting"
Purpose of change
This continues to work on NPC fleeing behaviour based on playtests from my prior PR, which mostly made NPCs more cowardly.
Describe the solution
3. The big part so far: expose several critical NPC AI settings to global_options.json, allowing them to be adjusted without compiling. I will need some help with this to ensure they only check at runtime and aren't being constantly referred to, as I believe that will be potentially slow AF.caching was more fuss than I was willing to tryNOTE: Currently the 'regroup' effect has them move to the same tile you are in, rather than near you. I'd love for them to move to 1 tile behind you relative to the assessed threat so that they don't get stuck telling you to get out of the way, but I don't understand position stuff nearly well enough for this.
end result: The effect I am hoping to get from combining the changes to fleeing behaviour with a higher "in formation" boost is that ally NPCs may choose the safest path to escape from a swarm of enemies, but then they will turn and rejoin you as they move too far away. Once they move to your side, the formation should buff their courage, so if you're staying and fighting they'll choose to as well. On the other hand, if you are running, they'll run with you. It seems to play this way in tests, but this kind of complex behaviour is heavily dependent on terrain and spread of enemies, so it's very tough to test short of just playing the game for several hours.
Describe alternatives you've considered
Infinite. I could be looking more into how NPCs evaluate danger instead of adding coarse adjustments. maybe I still will.
I plan to add some more tweaks to this or a follow up when I can.
Testing
Testing that player character proximity drops threat significantly:
However if you're far away the threats are still rated highly:
When they do run away, they check their rules. If you've told them to stay close, then they'll flee towards you rather than off into the distance.
There is a fair bit of jank here but I think I've got it working a lot better.
Things I need help on
- Currently the 'regroup' effect has them move to the same tile you are in, rather than near you. I'd love for them to move to 1 tile behind you relative to the assessed threat so that they don't get stuck telling you to get out of the way.Edit: Akrieger showed me how to expose constants to JSON properly but I'm going to save that for a follow up PR so that we can get this one in