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

Added Separation behavior #40

Closed
wants to merge 2 commits into from

Conversation

Perumallpardhiv
Copy link

@Perumallpardhiv Perumallpardhiv commented Oct 13, 2022

Added seperation feature, check it!

Recording :

Radiance.sandbox.mp4

Thank you.

Closes #18

sandbox/lib/presets.dart Outdated Show resolved Hide resolved
sandbox/lib/presets.dart Outdated Show resolved Hide resolved
@st-pasha st-pasha changed the title Added Seperate #18 Added Separation behavior Oct 13, 2022
@st-pasha st-pasha marked this pull request as draft October 13, 2022 20:52
@st-pasha
Copy link
Collaborator

So, that's a good starting point, but now we need to actually implement the Separation behavior. This is a standard term in the literature, described in https://www.red3d.com/cwr/steer/gdc99/ as

Separation steering behavior gives a character the ability to maintain a certain separation distance from others nearby. This can be used to prevent characters from crowding together. To compute steering for separation, first a search is made to find other characters within the specified neighborhood. This might be an exhaustive search of all characters in the simulated world, or might use some sort of spatial partitioning or caching scheme to limit the search to local characters. For each nearby character, a repulsive force is computed by subtracting the positions of our character and the nearby character, normalizing, and then applying a 1/r weighting. (That is, the position offset vector is scaled by 1/r 2.) Note that 1/r is just a setting that has worked well, not a fundamental value. These repulsive forces for each nearby character are summed together to produce the overall steering force. See Figure 14:

separation behavior

So it doesn't mean you want to get away from other agents as far as possible (that would be Flee behavior), but rather avoid getting too much into other people's personal space.

In the README of this project there are links to other game libraries which have implementations of those behaviors -- you can check those for inspiration!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Separation
3 participants