Adding some pseudo-random noise into roaming. #715
Closed
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.
The issue:
It is VERY easy to create situations where roaming figures will always choose the same turns and never visit other areas. But the code and all the forums tell it should be done randomly. But it is deterministic.
Every turn is determined by three things: location of the building, location of the figure and distance it made so far. As you may see, all these things are constant for every figure at every point in time. It may look that figure does change decisions, but in fact there's just 4 patterns that every figure repeats again and again. They are like Neo from matrix that is given a choice, not knowing the answer is predetermined.
Moreover, you may have a really lucky seed and all your roamers cover the city pretty well, but after a reload it will change and things may fall apart.
My proposal doesn't use real randoms, it is still a deterministic approach. But in this case the number of factors increase dramatically. Basically every other figure in the game contributes to turn decision. It's like a butterfly effect and should be a great boost for roamers' free will.
P.S. I'm not a C programmer, and assume my code may be wrong, especially I'm not sure about two things: