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

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
6

Comments 0

No comments yet. Be the first!