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

2D Examples. #4

Merged
merged 15 commits into from
Jan 31, 2016
Merged

Conversation

pjohalloran
Copy link

  • Moved existing examples into a 3D folder.
  • Added basic and intermediate 2D examples.
  • Added 2D version of the obstacle advanced example.

@pjohalloran
Copy link
Author

I am having a bit of trouble with the neighbour set of examples. I wonder @ricardojmendez if you have time, would you mind giving me some advice on how to improve the configuration of them to correctly demonstrate alignment, cohesion and seperation?

@ricardojmendez
Copy link
Owner

Hi @pjohalloran,

A couple notes after a quick review:

  • There's a 3D folder inside the 3D folder.
  • It looks like the obstacles on the 3D examples have changed. You probably replaced the prefab by mistake when doing the 2D example.
  • For 2D, you may want to have a boid that more obviously change direction - for instance, adding a red arrow on the sprite where the front is supposed to be. This will help with debugging.
  • It also look like the tether is too short, which is causing the clustering around the center.
  • Finally, they are missing a SteerForSeparation behavior, which is a fundamental part of the flocking behavior. That's why you're getting such tight groups.

Overall, I'd relax the values a bit. Give them a wider detection radius, play with the min/max values on neighbor groups, and relax the tether. Look at the 3D example for the some proportions to give you an idea.

@pjohalloran
Copy link
Author

Thank you for the review. I am a little busy in my job at the moment so will not be able to sort this out until next weekend. 👍

@ricardojmendez
Copy link
Owner

Sounds good, thanks for working on them. Cheers!

PJ added 8 commits January 23, 2016 13:08
# Conflicts:
#	Assets/Examples/3D/01 - Basic/Neighbor examples/Neighbors-Separation.prefab.meta
#	Assets/Examples/3D/01 - Basic/Neighbor examples/Neighbors-Separation.unity
#	Assets/Examples/3D/03 - Advanced/ObstacleAvoidance/Obstacle.prefab.meta
@pjohalloran
Copy link
Author

Hi @ricardojmendez. I think I have addressed the issues you raised above.

The main issue i was having with the Neighbor examples was that I had the Radar2D detection layer set to 'Nothing'. Fixed that, plus took on board your advice above.

Would you mind having another review? Maybe we are nearly at a point where this can be merged in? Thanks!

@ricardojmendez
Copy link
Owner

Thanks. Looking at the obstacle avoidance scene, the boids seem a big groggy and keep turning around - I'll take a look at it.

@ricardojmendez
Copy link
Owner

OK, this is a good example of how tweaking the values end up creating completely different behavior. There's several things that are contributing to this jittery way the vehicles are reacting to each other.

  • Spherical obstacle avoidance weight is too high - at 100, it'll override any other behavior when it kicks in. I'd say decrease to 4 or 6.
  • The DetectionRadius on the radar is too small. The agents are barely looking beyond their own radius. I'd say increase from 1 to 8.
  • MinRadius and MaxRadius on SteerForNeighborGroup are too tight. The MinRadius is just about the same as the vehicle's own Radius, meaning that for a vehicle to definitely be considered a neighbor, it'd have to be almost on top of the current one. The MaxRadius is just 2x the vehicle's own, meaning anything beyond their own diameter is excluded. Try 2/6.
  • You may also want to increase the angle to something like 90 degrees, to let them widen the list of vehicles they consider neighbors.
  • The RigidBody is not Kinematic. Is that intentional?
  • MinDistance on Cohesion should be larger than the boid's own radius - we don't want to apply cohesion otherwise.
  • There's still no SteerForSeparation. Try adding one with weight 2, Min/Max of 0/2, Comfort distance of 1, and a multiplier inside the comfort distance of 3.
  • Play with the acceleration/deceleration rates. I'd say they're too high, and 1/0.75 would be a good place to start.
  • Increase the MaxForce on the vehicle. Try 8.

When in doubt, click "Draw Neighbors" on SteerForNeighborGroup2D - that'll give you debug lines showing who each vehicle considers a neighbor.

I'm attaching a prefab with these new settings.

ObstacleAvoidanceBoid.prefab.zip

@pjohalloran
Copy link
Author

Thanks @ricardojmendez. Have updated pull request with your prefab.

Rigidbody should be kinematic, that was not intentional.

@pjohalloran
Copy link
Author

Do you think this is good to go now? Or would you like me to improve any other example?

@ricardojmendez
Copy link
Owner

Hi,

I think it's good to go, thanks! Will merge over the weekend when I'm back on my desk.

Cheers,

-- Ricardo

On 28 Jan 2016, at 04:27, PJ O Halloran notifications@github.com wrote:

Do you think this is good to go now? Or would you like me to improve any other example?


Reply to this email directly or view it on GitHub.

@pjohalloran
Copy link
Author

Fantastic! Thank you for great review.

ricardojmendez added a commit that referenced this pull request Jan 31, 2016
New 2D Examples, follows same structure as the 3D ones
@ricardojmendez ricardojmendez merged commit 91dac8b into ricardojmendez:master Jan 31, 2016
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.

None yet

2 participants