Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411274 Posts in 69638 Topics- by 58621 Members - Latest Member: hermo

November 14, 2024, 09:46:26 AM

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 14337 times)
AaronB
Level 2
**



View Profile WWW
« Reply #20 on: February 24, 2017, 06:53:51 PM »

OK - I really am getting close to the first alpha release (I wish I had a buck for every time say that).  Just tidying up the example mini games and other minor tweaks (perfectionism can be so debilitating).

What you will get in the alpha (in no particular order)

A GPU based physics engine that may or may not work on your graphics card
Save and load worlds (or selected particles as assets).
play with gravity strength and direction
create new element/particle types
set and display the world objective (fledgling game development)
select a language - thanks Google (probably all gobbly gook for non English speakers)
a short getting started guide
undo/redo (forward/rewind/single step) of simulation
two type of pause modes (normal and matrix - aka bullet time)
multiple particle layers
individual layer editing
select by particle/particle type/rigid body
copy and paste particles
move particles directly or via a force
weld / break / join / delete and change particles
pin particles to the background
draw particles freehand / line / square / rectangle / circle / oval
spray particles
follow an individual particle
world zoom
disintegrate / explode / freeze and melt particles
change simulation frame rate / speed
play with world viscosity and density
set world ambient temperature / lighting
heat / cool particles and have them react through temperature changes
wrap world horizontally and/or vertically
independently change the horizontal/vertical size of the world
visualize particle forces
display engine stats and individual particle velocity and forces
give each particle type a name and description
change particle mass / impulse / restitution / repulsion and friction
add a life force to particles
define reactions between particles based on impact / tensile forces and temperature
reactions can annihilate / transmute or create new particles
change body rigidity (both tensile and flexibility)
add control inputs to particle reactions via keyboard / mouse (controller coming soon)
combine existing particle types to create new particles
assign particles to a group
apply short and long range forces between particles
live coding of force equations (using glsl compute shaders)
live coding of particle reactions
live coding of particle and light geometry / fragment shaders
apply thrust / impulse / torque / drag and brake controls to particles
assign sounds to particle reactions and collisions
use particle properties to vary sound by volume and pitch
frame rate tests for 16k, 32k and 64k particles
big bang mini game
frubbles  mini game
car on a rope mini game
bottle flip mini game
fireworks

« Last Edit: January 30, 2018, 01:31:53 AM by AaronB » Logged

AaronB
Level 2
**



View Profile WWW
« Reply #21 on: March 06, 2017, 03:05:10 AM »

Going through some final tests with particle reactions and force interactions.

This example shows particles with a random 'life force' coalescing into a lichen like structure:



Logged

AaronB
Level 2
**



View Profile WWW
« Reply #22 on: March 12, 2017, 03:13:20 PM »

Went over to reddit to take a look at some of the latest oeCake posts and I realized I had not implemented drawing of solid objects.  So I got all enthusiastic and quickly coded up a 'solid' circle - completely forgetting that I also had to join the concentric rings. The result - a pretty cool onion simulator Smiley



Think I'll add this as one of the permanent drawing modes: outline, solid, onion.
Logged

AaronB
Level 2
**



View Profile WWW
« Reply #23 on: March 14, 2017, 12:47:27 AM »

In APC you can live code the particle appearance and it's lighting.  Up until now the blending has been hard coded.  However blending is such a powerful feature that I feel this should be a live option. In the following gif each particle emits light as a function of its own impact forces:

Logged

diegzumillo
Level 10
*****


This avatar is so old I still have a some hair


View Profile WWW
« Reply #24 on: March 14, 2017, 05:27:42 AM »

Beautiful stuff. Love that wave near the end.
Logged

Eyon
Level 3
***



View Profile WWW
« Reply #25 on: March 14, 2017, 06:19:37 AM »

So each object is a light ? How do you manage to get 60 FPS with that =D ?
Logged

Mobile strategy game in the browser: https://eyon.itch.io/agentsxmonsters
Twitter: https://twitter.com/Eyon_Patrick
AaronB
Level 2
**



View Profile WWW
« Reply #26 on: March 14, 2017, 04:12:12 PM »

So each object is a light ? How do you manage to get 60 FPS with that =D ?

Using OpenGL, there are two shader programs per particle – one for the particle appearance and one for the 'light'.

The lighting program renders to a separate frame buffer using the following shaders:

geometry shader
Code:
    coord = vec2(-1,-1);
    gl_Position = particle_position + coord * light_radius;
    EmitVertex();
   
    coord = vec2( 1,-1);
    gl_Position = particle_position + coord * light_radius;
    EmitVertex();
   
    coord = vec2(-1, 1);
    gl_Position = particle_position + coord * light_radius;
    EmitVertex();
   
    coord = vec2( 1, 1);
    gl_Position = particle_position + coord * light_radius;
    EmitVertex();

fragment shader
Code:
in vec2  coord;
in vec4  color;
in float specularity;

layout (location = 0) out vec4 FragColor;

void main()
{
    float i = length (coord);
    FragColor = color * (1/(1+(specularity-1.0) * i*i)-1/specularity);
}

The resulting light texture is then blended with the main scene as a single quad first using
glBlendFunc (GL_DST_COLOR, GL_SRC_COLOR)

and then again using
glBlendFunc (GL_SRC_ALPHA, GL_ONE)

The first blend intensifies or diminishes the particle colors, basically determining what part of the scene is 'lit' (i.e., visible).  The second blend adds the light halo effect.

It all works pretty fast for thousands of particles provided the light radius per particle doesn't get too big.

Generated light texture


Main scene


First blend - glBlendFunc (GL_DST_COLOR, GL_SRC_COLOR)


Second blend - glBlendFunc (GL_SRC_ALPHA, GL_ONE)
Logged

AaronB
Level 2
**



View Profile WWW
« Reply #27 on: March 14, 2017, 04:58:27 PM »

Beautiful stuff. Love that wave near the end.

Logged

Nordanvinden
Level 2
**

Indie game developer from Stockholm Sweden


View Profile WWW
« Reply #28 on: March 15, 2017, 11:18:43 AM »



This looks really beautiful! Im also very intrigued by what the alpha-game might end up being. Good job on coding this, gets me inspired to get back into lower level of graphics programming Smiley

Logged

AaronB
Level 2
**



View Profile WWW
« Reply #29 on: March 17, 2017, 04:10:57 AM »

This looks really beautiful! Im also very intrigued by what the alpha-game might end up being. Good job on coding this, gets me inspired to get back into lower level of graphics programming Smiley

Thank you.  I've always enjoyed this style of simulation.  My inspiration comes from other physics sandbox games such as Powder Toy, Crayon Physics and oeCake to name a few.

I always liked the idea of being able to draw something and have it come to life in a physically realistic way.  My first aim is to create a sandbox editor that can be used on several levels, from designing and creating your own particles to playing with pre-drawn assets made from those particles. Along with this I also want to implement a gaming mode that lets you manipulate drawn objects (or draw your own objects) to achieve an objective.

The alpha release will have a few simple mini-games that demonstrate the objective system:

Logged

Nordanvinden
Level 2
**

Indie game developer from Stockholm Sweden


View Profile WWW
« Reply #30 on: March 17, 2017, 08:24:38 AM »

This looks really beautiful! Im also very intrigued by what the alpha-game might end up being. Good job on coding this, gets me inspired to get back into lower level of graphics programming Smiley

Thank you.  I've always enjoyed this style of simulation.  My inspiration comes from other physics sandbox games such as Powder Toy, Crayon Physics and oeCake to name a few.

I always liked the idea of being able to draw something and have it come to life in a physically realistic way.  My first aim is to create a sandbox editor that can be used on several levels, from designing and creating your own particles to playing with pre-drawn assets made from those particles. Along with this I also want to implement a gaming mode that lets you manipulate drawn objects (or draw your own objects) to achieve an objective.

The alpha release will have a few simple mini-games that demonstrate the objective system:



I see. I remember cryon physics, made for some facinating puzzles. I can imagine a lot of fun game-modes utilizing this. Looking forward to be testing it out Smiley
Logged

AaronB
Level 2
**



View Profile WWW
« Reply #31 on: April 03, 2017, 02:51:57 PM »

Just had two weeks break up on the Queensland Gold Coast and managed to avoid the cyclone hot spots - but my sons still managed to drag me through several torture devices at the theme parks  Epileptic

But the main news is an alpha release of APC is now available at itch.io

So where to from here?

There is still plenty I want to do including but not limited to:

  • Add an alternate icon based GUI.
  • Add particle signalling - particles can pass information between each other.  This allows for things such as electrical circuits and quantum spooky action at a distance.
  • Add fixed particles - these are particles that sit in a predefined position for easy / fast collision detection. Fixed particles don't become an active part of the simulation until another non-fixed particle reacts with it.
  • Create a whole heap of pre-defined particle types.
  • Add more game creation / objective options.


DOWNLOAD ALPHA v0.14.01

« Last Edit: April 03, 2017, 06:55:12 PM by AaronB » Logged

AaronB
Level 2
**



View Profile WWW
« Reply #32 on: April 05, 2017, 02:12:19 AM »

Decided it would be a good idea to add video capture as well as screen shots.  I decided to use the Video For Windows API and it all came together rather quickly.



I was pleasantly surprised to see this approach didn't even impact the frame rate - a nice advantage of having your game run entirely on the GPU.

The following was recorded in-game:




« Last Edit: June 09, 2018, 06:48:28 PM by AaronB » Logged

Eyon
Level 3
***



View Profile WWW
« Reply #33 on: April 05, 2017, 04:51:31 AM »

Ha ha it's so gore at the end XD I wasn't expecting that!
Anyway to you control the little car with the keybord I presume right?
It's fun to watch good job =)
« Last Edit: April 05, 2017, 05:02:46 AM by Eyon » Logged

Mobile strategy game in the browser: https://eyon.itch.io/agentsxmonsters
Twitter: https://twitter.com/Eyon_Patrick
AaronB
Level 2
**



View Profile WWW
« Reply #34 on: April 05, 2017, 06:49:49 PM »

Anyway to you control the little car with the keybord I presume right?

You can assign controls to a particle type.  In this case the left/right controls rotate the 'wheel' particle.  Assigned controls allow you to create and interact with any type of contraption:



« Last Edit: June 09, 2018, 06:50:55 PM by AaronB » Logged

AaronB
Level 2
**



View Profile WWW
« Reply #35 on: April 08, 2017, 03:20:25 AM »

Testing a new particle parameter called "fluid".  When set particle overlap is resolved by force vectors only:



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

rj
Level 10
*****


bad, yells


View Profile WWW
« Reply #36 on: April 08, 2017, 03:55:57 AM »

following this. thassall.
Logged

AaronB
Level 2
**



View Profile WWW
« Reply #37 on: May 19, 2017, 02:22:46 AM »

APC now has a powerful signalling feature.  Particles can communicate with each other using two simple properties:






DOWNLOAD ALPHA v0.16.00

« Last Edit: June 09, 2018, 06:52:51 PM by AaronB » Logged

AaronB
Level 2
**



View Profile WWW
« Reply #38 on: May 31, 2017, 10:59:07 PM »

Testing high speed particle collisions
(not the Large Hadron variety)

Logged

AaronB
Level 2
**



View Profile WWW
« Reply #39 on: June 01, 2017, 01:22:28 AM »

Second tutorial on Particle Signalling and how to get past this:





Logged

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

Theme orange-lt created by panic