Page 1 of 1

Gravicles (SIM)

Posted: Sun Apr 12, 2020 1:06 am
by SirRanjid
Wanted to make a little doodle where objects attract/repel each other based on their color. But then I wanted it to be interactive so middle mouse drags the objects, right click inverts their color and I added parts of my gui lirary to control the values in real time and more...

Basically you can watch those glowy balls form polarized clusters in an organic looking manner while playing around with the rules.
I'd say its more of a relaxing thing but also interesting to watch how small changes in some variables make them behave completely different.

__________________________________________________________________________________________
Update 3:
-made the balls appear seamless on the edges
-fixed window not really being resizable
-fixed gravicles bugging out of the simulation on resizing or when they get too fast
-added a slider that controls the attract/repel force multiplier for linked gravicles
-added a simple function to copy and paste the settings you have (just press ctrl+c to copy and ctrl+v to paste in the settings; it also gives a little effect on the gravicles as indicator)

On copying it will give text like this which is easily editable. Try pasting if you like:

Code: Select all

#gv#learn_rate:0.42|unlearn_rate:5|acceptance:-1|GC:-100|damp:10|connt:1|linkbias:-10|spdm:1|
#gv#learn_rate:0.42|unlearn_rate:5|acceptance:-1|GC:-60|damp:10|connt:3|linkbias:2|spdm:1|
#gv#learn_rate:0.4|unlearn_rate:5|acceptance:1|GC:30|damp:50|connt:0.1|linkbias:-1|spdm:1|
#gv#learn_rate:0.3|unlearn_rate:0.3|acceptance:-1.85|GC:21|damp:13|connt:0.3|linkbias:-1|spdm:1.65|
Copying and pasting:
Image
__________________________________________________________________________________________

This is what I came up with:
v22: https://love2d.org/imgmirrur/5zUIZRs.gif
old: https://love2d.org/imgmirrur/s5cYjDE.gif


Now they not only attract/repel each other. They change the color based on who they touch and light up more based on how many touching. On touching they link and stay linked for a set duration after they lost contact.

The color-values also dictate their physical properties:
Red: Restitution (more red = more bouncy)
Green: Mass (more green = more mass)
Blue: Friction (more blue = more friction)
(white would have all)

The values:
PhysSteps/Tick: How many physics updates per tick. (more = more accurate sim, slower)
Selection Radius: Interaction radius. (a ball has a raduis of 20)
Sim Speed: Multiplier except it doesn't affect the learn rate.
LinkAttractionX: Attract/Repel Multiplier for linked gravicles.
Remember: Link decay time. (affected by sim speed)

Drag: Drag force multiplier.
Gravity:
Attraction force multiplier. (positive = attract same color, negative = repel same color)

Tolerance:
1 means everyone attracts every other equally. Anything less makes them act on their color.

Forget Rate: How fast a ball returns to its original color. (indicated by the little dots on each ball)
Learn Rate: How fast the color adapts to linked balls.


Image
More gifs (also some with artifacts):
https://love2d.org/imgmirrur/d0LfEgF.html

Re: Gravicles (SIM)

Posted: Sun Apr 12, 2020 4:01 pm
by ReFreezed
Fun little toy.

Re: Gravicles (SIM)

Posted: Mon Apr 13, 2020 7:16 pm
by SirRanjid
Thanks! :)

I updated the visuals a bit and rebalanced the values to give a rather nice scene at startup.

https://love2d.org/imgmirrur/eqyQMNp.gif


update2:
Improved and optimized visuals, fixed bugs and more improvements.

[Edit: the attachments are all the same it just failed on me to remove old, and even display attached files so they are double]


Image

Re: Gravicles (SIM)

Posted: Tue May 19, 2020 10:36 pm
by SirRanjid
Update 3:
-made the balls appear seamless on the edges
-fixed window not really being resizable
-fixed gravicles bugging out of the simulation on resizing or when they get too fast
-added a slider that controls the attract/repel force multiplier for linked gravicles
-added a simple function to copy and paste the settings you have (just press ctrl+c to copy and ctrl+v to paste in the settings; it also gives a little effect on the gravicles as indicator)

On copying it will give text like this which is easily editable and sharable. Try pasting if you like:

Code: Select all

#gv#learn_rate:0.42|unlearn_rate:5|acceptance:-1|GC:-100|damp:10|connt:1|linkbias:-10|spdm:1|
#gv#learn_rate:0.42|unlearn_rate:5|acceptance:-1|GC:-60|damp:10|connt:3|linkbias:2|spdm:1|
#gv#learn_rate:0.4|unlearn_rate:5|acceptance:1|GC:30|damp:50|connt:0.1|linkbias:-1|spdm:1|
#gv#learn_rate:0.3|unlearn_rate:0.3|acceptance:-1.85|GC:21|damp:13|connt:0.3|linkbias:-1|spdm:1.65|
This way you can edit the values outside the bounds the simulation sets with the sliders. Maybe you get something interesting :nyu:


Copying and pasting:
Image