Sampling without replacement. #956
Replies: 1 comment
-
Oh I love this! Honestly I think this should just be completely separated from the current random line implementation to keep things simple. But otherwise, I would love to see this merged (and I'll probably steal it anyway!) In terms of direction, I could also see this doing some interesting things if we gave it its own priority system of some sort where each option had a ranked priority and lines are randomly selected in order of priority. (Eg: all highest priority lines are randomly selected from until exhausted, then 2nd highest, etc...). This could be super powerful if priorities could be assigned via mutation as well, allowing for more dynamic narratives. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I want my NPCs to randomly say things when the player interacts with them, like so:
But there's a chance that the player could just randomly get "Hello!" several times in a row instead of seeing all of the different messages.
I wanted to implement sampling without replacement (not picking the same line twice until all lines have been picked) and it seems the most straightforward way to do so is by modifying the dialog manager code itself instead of handling this outside of the plugin. My implementation was simple enough (only 12 lines changed) but before making a PR for this, I'd want to know (a) if this is something that would be useful to other developers and (b) what the cleanest syntax/implementation for this would be.
Right now my implementation uses negative weights for this, so the above now looks like:
But this may not be the most straightforward syntax, and my implementation may not handle edge cases (i.e. what happens if the writer mixes negative weights and positive weighted/unweighted lines?).
If this is something anyone else is interested in, please let me know your thoughts!
Beta Was this translation helpful? Give feedback.
All reactions