Log In  

Cart #boids8_19-0 | 2022-01-12 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
4


A simple boids simulation. You can open it in the editor to tweak the settings even further

there are no controls in this cart, but you might want to turn off carts in the menu

P#104897 2022-01-12 16:18

2

Hi! Neat idea, I love these kinds of toy systems. A couple of observations:

  • The boids don't really seem to be flocking - have you found parameter settings that make them do this?

  • There are a lot of degree-scaled angles here, which makes me suspicious. For example: atan2 will never return a value over 180.

  • That sqrt is probably unnecessary, and since it's happening for every pair of boids it's taking a lot of time. Maybe do squared distance comparisons instead?

  • More minor optimization notes: use ipairs to get indices for each boid so you can skip drawing unnecessary lines (from lower to higher only, or vice versa). Could also re-use a pair's distance computation the second time you see it, or just accumulate into both members of a pair at once. Don't build up lists of things to average later, when you can just keep a running total and a count in the loop. Declare variables as local when possible.
P#104904 2022-01-12 17:38 ( Edited 2022-01-12 18:25)
1

It's like possessed Christmas Lights. Really beautiful and mesmerizing to watch. You have my star. It is your first surely to be of many.

P#104909 2022-01-12 18:59 ( Edited 2022-01-12 18:59)

pog. just pog.

P#106601 2022-02-09 15:21

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-03-28 19:00:44 | 0.013s | Q:22