Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

 
Advanced search

1403717 Posts in 68278 Topics- by 61944 Members - Latest Member: flaxseedplease

November 30, 2022, 09:59:14 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsCommunityDevLogsAaron's Particle Space - a physics sandbox based on particles
Pages: 1 2 3 [4]
Print
Author Topic: Aaron's Particle Space - a physics sandbox based on particles  (Read 11979 times)
AaronB
Level 2
**



View Profile WWW
« Reply #60 on: July 03, 2017, 04:18:12 PM »

Another test is the caterpillar tread:





And some challenges:







« Last Edit: June 09, 2018, 06:36:40 PM by AaronB » Logged

litHermit
Level 1
*


1


View Profile WWW
« Reply #61 on: July 04, 2017, 08:14:45 AM »

Really liking this, so have to follow. Bring on more particle porn  Beer!
Logged

Nordanvinden
Level 2
**

Indie game developer from Stockholm Sweden


View Profile WWW
« Reply #62 on: July 04, 2017, 11:41:19 PM »

Hey! Really cool progress since last time I checked out your game Smiley This looks sweet and like you could do a lot of fun things with:




Logged

AaronB
Level 2
**



View Profile WWW
« Reply #63 on: July 05, 2017, 04:48:46 AM »

Another test scenario - Newton's cradle:









Logged

AaronB
Level 2
**



View Profile WWW
« Reply #64 on: July 05, 2017, 05:04:04 AM »

Hey! Really cool progress since last time I checked out your game Smiley This looks sweet and like you could do a lot of fun things with:

Thanks for the comment Nordanvinden.  I'm currently adding support for local multiplayer which I think will also be a lot of fun.  Unfortunately non-local multiplayer is out of the question thanks to quantum physics  Shrug - unless Nvidia or ATI can come up with entangled GPU's Smiley
Logged

AaronB
Level 2
**



View Profile WWW
« Reply #65 on: July 19, 2017, 01:43:04 AM »

Rigid body integration can traverse from 1 to four particles away.  The further the integration distance the more rigid the body becomes.  The following example shows the different integration levels on a fully flexible body (rope).

integrating 1 and 2 links

integrating 3 and 4 links


« Last Edit: July 19, 2017, 01:48:13 AM by AaronB » Logged

Smerik
Level 1
*



View Profile
« Reply #66 on: July 19, 2017, 04:56:36 AM »

Man you must be wicked smart to make this stuff.
Can you do slicing of bodies? As in ability to cut bodies in half or body destruction? (like worms Smiley?)
Logged

AaronB
Level 2
**



View Profile WWW
« Reply #67 on: July 20, 2017, 12:57:41 AM »

Can you do slicing of bodies? As in ability to cut bodies in half or body destruction? (like worms Smiley?)

Everything is fully destructible.  In fact any rigid body can be split or joined through direct editing or by using particle reactions.

Worms on a hook:


Worms on a hook sliced by the mouse (editor mode):


Worms on a knife - in this reaction the rigid body is cut when the particle impact exceeds a defined threshold:


Sticky worms - rigid bodies are joined when the particle impact exceeds a defined threshold:


« Last Edit: July 20, 2017, 03:57:51 AM by AaronB » Logged

qMopey
Level 6
*


View Profile WWW
« Reply #68 on: July 20, 2017, 10:34:45 AM »

That last picture is particularly interesting! Imagine that the noodles are in a vacuum, so as pieces slap together and then subsequently pull apart, space between the noodles can freely open up. These little pockets of space, completely enclosed by noodles, would not so freely open up here on earth. Atmospheric pressure would push the noodles together in suction-like fashion, creating a very different effect.

So you've simulated sticky noodles in space, or something! Gentleman
Logged
AaronB
Level 2
**



View Profile WWW
« Reply #69 on: July 21, 2017, 04:33:01 AM »

That last picture is particularly interesting! Imagine that the noodles are in a vacuum, so as pieces slap together and then subsequently pull apart, space between the noodles can freely open up. These little pockets of space, completely enclosed by noodles, would not so freely open up here on earth. Atmospheric pressure would push the noodles together in suction-like fashion, creating a very different effect.

Excellent observation!

Since air pressure is simply air particle collisions, I figured why not simulate this in APC.  I created a light 'air' particle (mass and density properties) and applied the following reaction shader:

Code:
// The following variables are pre-defined:
//
// p            - reacting particle ID
// cp           - ID of colliding particle - may be same as p for 'always' reactions
// ri           - reaction index - access reaction properties via reactions[ri]
// mat          - material properties of reacting particle - materials[particles[p].material]

if (particles[p].velocity != vec2(0,0))
{
    if (length (particles[p].velocity) < 100) particles[p].velocity = normalize (particles[p].velocity) * 200;
}

This keeps the air particles moving to simulate pressure.

Initially I had the air particles colliding with each other but this created unexpected air currents:



So I set the air particles to collide only with non-air particles resulting in a uniform pressure.

Spaghetti falling off a hook when NOT in a vacuum (video compression makes a real mess of the air particles):



Logged

AaronB
Level 2
**



View Profile WWW
« Reply #70 on: July 21, 2017, 11:56:43 PM »

Exploring the air pressure concept a bit further...

In the following the rigid shapes contain no air particles (a vacuum).  This results in a net exterior force from the surrounding air particles.  The rigid shapes are also set to break when the tensile force exceeds a certain value.  In the first image the tensile break force is set to a low value and both objects implode.  In the second image a higher tensile break force is applied.  The interesting thing about the second image is that the tensile break force is identical for both shapes, however the circle resists implosion.  This is because a circle is a continuous arch which resolves much of the external force into compressive stress instead of tensile stress.

o



The same simulation but with the vacuum on the outside.  Here the circle does not gain the structural advantage of an arch and both rupture under the same conditions:

o

Logged

qMopey
Level 6
*


View Profile WWW
« Reply #71 on: July 22, 2017, 09:19:48 AM »

Very cool! I've never seen anyone simulate atmosphere like this before  Kiss

It looks like the atmosphere leaks into the shapes? Is there a lack of continuous collision detection?
Logged
AaronB
Level 2
**



View Profile WWW
« Reply #72 on: July 23, 2017, 03:35:23 AM »

It looks like the atmosphere leaks into the shapes? Is there a lack of continuous collision detection?

The simulation was with a world size of 740 x 400 units and it turns out the air particles were already moving at over 900 units per second (I repeatedly used the 'x' explode key to stir up the air particles).  To detect collisions between two high speed particles I need to place each particle into the collision quadtree at every quad along it's trajectory.  For efficiency and speed I limit the total number of particle entries per quad. There were nearly 6000 air particles moving at high speed in the previous simulation which overloaded the quadtree resulting in missed collisions.

In the following I limited the speed to 200 units per second and upped the air particle mass to compensate for pressure.  Of course upping the air particle mass also increased the air density - hence the rigid body fragments started to float:

« Last Edit: July 23, 2017, 03:54:26 AM by AaronB » Logged

AaronB
Level 2
**



View Profile WWW
« Reply #73 on: August 02, 2017, 11:48:48 PM »

Logged in this morning and noticed a considerable spike in downloads!  Turns out Rock Paper Shotgun did an entry on the TigSource Gifs of Games Being Worked On thread.  You can read all about it here: https://www.rockpapershotgun.com/2017/08/02/gifs-of-games-being-worked-on/

APC got a mention which is really awesome!  Thank you RPS  Toast Right

A while back I introduced a new fluid parameter which changes the collision behavior for particles. Instead of resolving with impulse forces, the fluid option resolves using pressure.  The technique is known as Smoothed-particle hydrodynamics

APC uses the following kernel function for pressure calculation:

Code:
float pressure (float fluidity_cof, float W) // W represents particle separation
{
    return 1.0 / (pow (PI, 1.5) * pow (fluidity_cof, 3.0)) * exp (pow (W, 2.0) / pow (fluidity_cof, 2.0));
}

The fluidity coefficient can be set to any value via the GUI and can result in some interesting particle reactions.  In the following the central 'gravity' particle is set to attract all particles with a force proportional to distance, and the smaller blue particles have been given a fluid coefficient that results an an explosive response under high pressure:

« Last Edit: June 09, 2018, 06:38:41 PM by AaronB » Logged

AaronB
Level 2
**



View Profile WWW
« Reply #74 on: September 17, 2017, 03:01:34 AM »

Finally convinced myself I must get an update out and not keep adding new features.  I'm pretty happy with the physics engine although a bit more work is still required for rigid body deformation and fusion.  The audio has had a big update - which can now track potentially tens of thousands of position based stereo sound sources/particles - I'll be doing a separate post on how I met that challenge.

Some of the example projects have already been referenced in this devlog and some of them have just evolved from playing around with the settings in APC and making sure things remain stable under duress - including myself Smiley

New features:

  • fluid simulation based on particle pressure
  • PNG image particle textures
  • particle signalling
  • reaction based call-out text
  • pivot tool for creating hinged connections
  • shrink tool for rigid bodies
  • select by particle type
  • reaction driven checkpoints (snapshot and restore)
  • porous rigid bodies
  • fast zoom
  • two new element shaders for play initialisation and per frame processing
  • sound management menu
  • positional audio

Enhancements:

  • improved particle / rigid body collision and static friction
  • new 'always' particle type for reactions
  • improved control settings for rotation, thrust and impulse movement
  • collide/react and apply force to particle groups
  • improved audio processing for thousands of particles

20 example projects:

  • angry_car - get past the obstacle and reach the finish is record time
  • ascii_fireworks - enhanced edition
  • bottle_flip  - land the bottle of water upright  in the shortest time
  • car_on_a_rope - get the car into the brown net
  • chaos_test_x4 - chaotic outcome each time
  • circles_within_circles - fly your rocket to the red particle
  • collision_test - ouch
  • fluid_explosion - fluid example
  • fluid_mixer_test - fluid example
  • frubbles – survive the foaming bubbles for as long as possible
  • lava_and_water - shader example
  • led_display - particle signaling example
  • light_fantastic - pretty lights
  • newtons_cradle - bash those balls
  • psycho_lava - ?!?
  • rigid_car_test - rigid body destruction
  • signal_lightning -  particle signaling example
  • the_big_bang – collide your particle rocket with the yellow star
  • the_bucket - follow the particle through 'the machine'
  • tractor_challenge - get the ball into the bucket

Under development:

  • 4 player multiplayer with separate objectives and scoring
  • rigid deformation via reactions
  • improved particle signalling
  • improve rigid body stability for dynamic joins / breaks
  • spawn particle structures
  • particle biology with dna blueprints
  • animated particle textures
  • icon based gui
  • controller support
  • Steam workshop / achievements

Planned:

  • The third dimension.

GUI alterations:

You now use Tab/Esc to enter/exit play mode and Shift-Tab to pause/resume edit mode.


DOWNLOAD ALPHA v0.20.00











« Last Edit: June 09, 2018, 06:27:32 PM by AaronB » Logged

AaronB
Level 2
**



View Profile WWW
« Reply #75 on: June 09, 2018, 05:35:42 PM »

A Galton board simulation (note flux capacitor):



« Last Edit: June 09, 2018, 05:43:07 PM by AaronB » Logged

AaronB
Level 2
**



View Profile WWW
« Reply #76 on: September 30, 2018, 04:02:53 AM »

Using the accumulation buffer to create particle trails.  The red particles have a strong attractive force to the smaller 'compression' particles.



Logged

Pages: 1 2 3 [4]
Print
Jump to:  

Theme orange-lt created by panic