hunar4321/particle-life

A random idea

Closed this issue ยท 11 comments

ker2x commented

Hi there,

I'm testing some idea in the C++ code. it appears to works.

instead of testing all points relative to all other points when computing distance & interaction, just pick a random sample of point. It look visually similar and show similar behavior. This allow to add much more point to the simulation.

I just add a simple if(random) between the outer loop and inner loop. even with 10% chance, it still not too bad.

some pseudo code :

	for (auto i = 0; i < group1size; i++) {
                // ...
                if(ofRandom() < 0.5) (
		        for (auto j = 0; j < group2size; j++) {
                                // ...
                        }
                 }
         }
ker2x commented

The main issue is that the "interesting models" aren't doing the same things they did before.

there might be a way to keep them interesting :

  • make randomness a parameter
  • if the parameter is missing in the model, assume it's 100% chance.
  • I didn't test this. the value is hardcoded for now. but if I put the chance at 100% then the interesting model behave as they did before.

I'll submit a PR when I'm done messing with multithreaded randomness (always has been a pain, always will)

Fun fact : at the usual "1000 points per color" my laptop with a GTX 1650 is at 100% GPU, it's running at up to 200FPS so the rendering routine will need to be optimized somehow. With 5000 points per color, it's CPU bound (as it should), running at 10FPS. (which isn't too bad)

ker2x commented

PR created after a lot of profiling

Nice idea ๐Ÿ˜ƒ
It will be great to share the screenshots or video snippets of the interesting patterns you find. Not everyone have GTX or high end PC to reproduce the results with many particles.

ker2x commented

good news, i published a video yesterday.
https://www.youtube.com/watch?v=bRaWvCTiRTw

I do not have a high end computer. i'm doing it all on a laptop with an old nvidia. (well i also have much power powerful computer but they're for works, i can't run this).

But i have a lot of compilation optimization flag that you may not use. (mainly, it seems that you compile without enabling openMP).

i'll write some documentation with the compilation option i use.

ker2x commented

ha yes, the video include feature i haven't pushed yet. i reworked the gui in order to write experimental feature. i'll do another PR.

ker2x commented

I'm working hard on optimizing and there still some headroom to speed up stuff.
I've started to explore quadtree. The problem is that the computation of interaction is so simple that optimization might only worth it when using a lot of points. And of course there is also the possibility to use the GPU.

I've started to work on graphic optimization too. Using a lot of point, the brute force way of drawing points is maxing out the GPU.

Great job. Love your video. Some background music would have made watching these creatures more fun.

Hi! Great work! Please publish the compiled version as well.
Will you want to add 4 more colours? There should also be the possibility to zoom in. Is it possible to zoom in?

Hi! Great work! Please publish the compiled version as well. Will you want to add 4 more colours? There should also be the possibility to zoom in. Is it possible to zoom in?

I recompiled the binary and made a new release: https://github.com/hunar4321/particle-life/releases/tag/v.0.3.0

Thank you! What about more colors and zoom?

ker2x commented

adding more color will need some refactoring. I'll add it to my todo list. Not sure about zooming.