backspaces / agentscript

An Agent Based Modeling system (ABM)
http://backspaces.github.io/agentscript/
GNU General Public License v3.0
107 stars 14 forks source link

flock model wiggle regression #41

Closed bennlich closed 3 years ago

bennlich commented 3 years ago

Here's a pebble showing the boid wiggle behavior that I think is a regression:

FlockModel 2021-04-24T18_39_13 124Z

You should be able to download that image, then drag it over to https://gentleplants.com/as/editor/ (testing this pebble mechanism at the same time :-P)

If you watch a single boid, you'll see that instead of flying smoothly, it has a very small oscillation back and forth around its heading.

stephenguerin commented 3 years ago

the "wiggle" is coming from the align, cohere and separate impulse forces with nearby boids. Here's a pebble with just one boid that shows no wiggle.

FlockModel_oneBoid-2021-04-26T09_55_31 725Z

And here's a second pebble with 40 boids but choosing flockmates based on inCone instead of inRadius. I added a visionAngle and set it to 90 degrees. Note the "leaders" don't wiggle but the "followers" do FlockModel 2021-04-26T10_03_32 407Z

backspaces commented 3 years ago

Love the ide & pebbles! I gotta see how the drag/drop works.

Re: wobbling regression to flock: I just committed and published flock as a mvc.

https://agentscript.org/mvc/flock.html

To check for wobble:

I think the wobbling is “normal” .. i.e. adjustments to create flocking. It is more obvious due to larger turtles? Lower population and fps? But the turtles that are solo don’t wobble.

What do you think? We could grab an earlier version and hand edit it to see if it is steadier.

BTW: I'm thinking of changing the FlockModel default to be 100 population rather than 1000 .. it shows flock clusters so nicely.

stephenguerin commented 3 years ago

Yes, I agree wiggle is coming from the flocking behavior. The two pebbles I posted above show no wiggle (as you mention with solo turtles) when reducing the population to 1 and the second pebble is changing from in-radius to in-cone for finding flockmates. There you see the "leader" doesn't wiggle because it doesn't have any flockmates.

Owen, drag the pebbles into https://gentleplants.com/as/editor if you haven't already. I think it's awesome!!!

BTW, emergent wiggle isn't necessarily bad.

bennlich commented 3 years ago

Here's a pebble that uses AS 0.8.3 (pulled in via skypack):

FlockModel 0 8 3 2021-04-26T17_19_27 145Z

I added the version tag to the imports at the top to get an earlier version, and adjusted the model code to match what was in the repo.

The motion is definitely a little different. There's still wiggle, but it's different wiggle. Less anxious :-P

I'm not sure it matters enough to chase it down. Going to close this for now. Thanks y'all.

stephenguerin commented 3 years ago

Thanks, Benny, for testing with a previous version. It's so convenient to run these pebbles! And I like that you were able to bring in the old version of AS (which could be a pebble reference in the future). Let's keep this issue open as I think there's more clumping happening in the newer AS version (Owen, can you add me as a collaborator so I can do things like re-opening issues)

image

stephenguerin commented 3 years ago

I suspect it's somewhere in the cohere and the methods it's calling....

backspaces commented 3 years ago

Is this still an issue? I'm closing for now, feel free to reopen if I'm mistaken.