Boids tests

  • Yes, boids, they are used for simulating flocks of birds or movement of groups.

    Here is my reference:

    http://www.kfish.org/boids/pseudocode.html

    First attempt:

    I basically used the same format as the ref. I think I made a math typo in it somewhere, it's a bit unstable in spots.

    https://www.dropbox.com/s/lyolk1o1lzap0 ... .capx?dl=0

    2nd:

    This is a rewrite from scratch in a typical event fashion. Only eight events and I seem to have fixed the math so its a bit more stable.

    https://www.dropbox.com/s/oaybpue9w88yd ... .capx?dl=0

    3rd:

    This rewrite is based on the idea that it would be cool if vector math could be done directly and not have to do the formulas with the components of the vectors. The result was a lot of the math was hidden in a bunch of reusable vector functions. All the function.calls in the expression kind of counteracted the simplifying of expressions I was going for. Not to mention that it's a bit more tedious writing expressions with my system because errors are just ignored.

    https://www.dropbox.com/s/rpqmyaypsxo4u ... .capx?dl=0

  • thank you for this

    nice

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Nice! This is weird, I was wondering if it would be possible to implement the boids algorithm in C2 just this morning when I was feeding the fish. And here it is.

  • R0J0hound thanks I was looking for something like this. You are star Thanks again

  • looks super!

    3rd example is beyond me...

  • Someone wrote a plugin a while ago:

  • Boids are awesome.. wait those sample was started in 2012 ? Favor an update then

  • Hey guys.. Im new here. Can anybody help me to find those files? the links are down. Or the plugin of Boid. Sorry about my english :p

  • Links updated.

  • Wow, awesome R0J0hound I was looking for this for a long time until someone recommended me the Boids Flocking behaivor and just realize today that it will not work on C3 and the developer of that plugin it's been inactive for many years so I'm so glad that I found this, will be really helpful. Are you planning to make a plugin? will be awesome.

    The option two I see is the most simple to try to comprehend as my knowledge is not that good: I will study it see If I can understand it.

    I have two questions about the second option Capx:

    -How can I include the sizes of the objects into account? example, when I mixed up the instances with different sizes, the big ones overlaps all the small ones. seems like it works only if all the objects are in the same size.

    -How can I just stop them from overlapping only when they are near? example when I drag one object far from the group, it comes back to the group instantly like its lerp to them, can they not be freely moved and only avoid when they are near to the other objects?

    Thank you so much

  • I made this long ago so I don't really recall what I did.

    The number 32 in event 5 is the radius of the two balls added together. Maybe calculating that on the fly would do what you want.

    When dragging them you probably want to set the speed to 0.

  • I made this long ago so I don't really recall what I did.

    The number 32 in event 5 is the radius of the two balls added together. Maybe calculating that on the fly would do what you want.

    When dragging them you probably want to set the speed to 0.

    Cool thank you so much, I will try that

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)