Gravicles (SIM)
Posted: Sun Apr 12, 2020 1:06 am
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:
Copying and pasting:
__________________________________________________________________________________________
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.
More gifs (also some with artifacts):
https://love2d.org/imgmirrur/d0LfEgF.html
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|
__________________________________________________________________________________________
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.
More gifs (also some with artifacts):
https://love2d.org/imgmirrur/d0LfEgF.html