Gravicles (SIM)

Show off your games, demos and other (playable) creations.
Post Reply
User avatar
SirRanjid
Prole
Posts: 39
Joined: Sun Nov 19, 2017 1:44 pm
Contact:

Gravicles (SIM)

Post 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
Attachments
grav32.love
(636.89 KiB) Downloaded 267 times
grav31.love
(636.89 KiB) Downloaded 239 times
grav22.love
(636.19 KiB) Downloaded 257 times
Last edited by SirRanjid on Tue May 19, 2020 11:53 pm, edited 11 times in total.
User avatar
ReFreezed
Party member
Posts: 612
Joined: Sun Oct 25, 2015 11:32 pm
Location: Sweden
Contact:

Re: Gravicles (SIM)

Post by ReFreezed »

Fun little toy.
Tools: Hot Particles, LuaPreprocess, InputField, (more) Games: Momento Temporis
"If each mistake being made is a new one, then progress is being made."
User avatar
SirRanjid
Prole
Posts: 39
Joined: Sun Nov 19, 2017 1:44 pm
Contact:

Re: Gravicles (SIM)

Post 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
Attachments
grav22.love
(636.19 KiB) Downloaded 258 times
grav22.love
(636.19 KiB) Downloaded 248 times
User avatar
SirRanjid
Prole
Posts: 39
Joined: Sun Nov 19, 2017 1:44 pm
Contact:

Re: Gravicles (SIM)

Post 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
Attachments
grav32.love
(636.89 KiB) Downloaded 249 times
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 3 guests