You are browsing as a guest. Sign up (or log in) to start making projects!

Particle Evolution

  • 5 Devlogs
  • 13 Total hours

An extension of the Particle Life simulation to add evolution and genetics

Open comments for this post

1h 36m 17s logged

Devlog 2.5 - Chaos

Really small update! I starting implementing the evolution, it’s very very simple right now but I just wanted to share this cause I think it looks cool. I won’t go into too much detail here but basically instead of a fixed species/color each particle has a genome. The genome is made of traits, and receptors (attraction/repulsion to certain traits). When particles get close to each other, they share a bit of DNA. I’ll probably change the evolution mechanism very soon because I don’t think this method is really viable but it’s a start :>

0
0
9
Open comments for this post

3h 32m 10s logged

Devlog 2 - Organisms

I finally got around to adding GPU integration. I can now comfortably run 20,000+ particles, before I was capped at around 1,500.

There’s no other additions so I’m gonna talk about the implementation for a bit. I used a really cool module called Taichi. It basically lets you put a little tag above functions to tell them to compile into GPU code. For it to work you have to convert whatever you’re doing to use different datatypes since the GPU doesn’t understand python types. Regular numbers are the same but I struggled a good but trying to understand Vectors and Fields. I think a field is like a space that contains data, in 1, 2, or 3 dimensions. A vector is roughly equivalent to a list in Python. The part that confused me was putting vectors in fields, and the difference between vector dimensions and field dimensions.

To actually implement Taichi I pretty much had to rewrite the whole backend, but thankfully the actual equations stayed mostly the same it was just the structure. Previously I had a big list of Particle objects with their own functions handling their own physics. Now particles are purely numerical, there’s just a big list of positions and a big list of colors used to render them.

It was pretty interesting learning how to use Taichi, I’ll probably integrate it into future projects. or experiment with the GPU in other languages. As for this project, I called it Particle Evolution but I still haven’t fully figured out how I want the evolution to function. Hopefully I’ll have something next devlog :>

30,000 particles!

0
0
6
Open comments for this post

1h 7m 12s logged

Devlog 1.5 - Life

Another small update. I still wasn’t completely happy with the physics after my last devlog so I looked at the code of another particle life simulation and realised I was doing some of the calculations wrong. It turns out I never fully fixed the strong repulsion equation, also I was applying the friction in the wrong order. Aside from bug fixes, I incorporated delta (the real time since the last frame) into all the calculations to account for framerate fluctuations.

I’m now pretty happy with the way the particles interact, and I think I can start translating the code to run on the GPU - hopefully I don’t need to rewrite too much of it

0
0
7
Open comments for this post

3h 21m 31s logged

Devlog 1 - Cells

Quick update to my Particle Life project. I did some work to stabilise the physics, there were a lot of small mistakes in the code that added up to very erratic behaviours. For example, the repulsion force that’s supposed to stop the particles from overlapping too much was partially inverted and actually made things worse. I’m starting to get better results now but it’ sstill not perfect.

I also added a little grid to visualise the relationships between different ‘species’. I’m still relatively new to Pygame so it was interesting trying to get the dragging and clicking working

The last change is less noticeable but I did some light optimization. I basically added an invisible grid, so instead of checking the distance to every particle every frame, each particle only looks at neighbouring cells. It’s an improvement, but there’s still a long way to go as far as optimization. Hopefully I can figure out how to get it to run on the GPU soon

0
0
9
Open comments for this post

3h 32m 31s logged

Devlog 0 - Primordial Soup

I started making my Particle Life simulation. I got the basic features working, but it’s very unoptimised. Every particle checks every other particle every frame, and it’s all done using the CPU. I’ll elaborate more on how I’m going to solve this in the future.

For anyone who doesn’t know, Particle Life works by simulating attraction and repulsion forces between different kinds of particles. For example, here you can see that blue is attracted to itself, causing it to form big clumps. You can also see that blue is attracted to green, but green repels blue, effectively making blue chase green around really fast.

What’s Next?

The two things I plan on doing next are optimisation, and customisation. I’m not sure which will come first, but hopefully by the time I finish I’ll know how I want to implement the evolution

0
0
8

Delete project?

Are you sure you want to permanently delete this project? This action cannot be undone.

All devlogs, followers, and associated data will be removed.

Followers

Loading…