Many object scene. Which is CPU-faster: circles or polygons?

If you have problems installing or running Algodoo, have found a bug or need in-game help - this is it!

Many object scene. Which is CPU-faster: circles or polygons?

Postby sulloh » Mon Jan 13, 2014 4:34 pm

Hello all,

I am working on a gas simulation where I would like to get as many objects (particles) in as possible. Currently my gas is composed of about 2000 circles, with no friction and restitution = 1.0. The simulation works well and is accurate at moderate particle speeds. It is now at the limit where it just runs in real time at 60Hz, however, while running as fast as possible is nice, real-time performance is not a requirement in this case.
The question is about the internal math / collision detection / force calculations in the program. Are there more or less calculations involved in using circles than, say, squares?
I am thinking of substituting the circles for triangles (the simplest polygon) if this would allow for more particles to be stored in memory (is there an actual limit?) or to be calculated at an acceptable speed. With triangle particles, one also gets internal rotational energy into the simulation.

So, and this is a question mostly for the programmers, but maybe someone already played with this:
Will the gas simulation run faster is my particles are circles or if they are triangles / squares?
Also, since I am not using friction, can friction be turned off so as to speed up calculations, instead of just set to 0?
sulloh
 
Posts: 2
Joined: Mon Jan 13, 2014 3:41 pm

Re: Many object scene. Which is CPU-faster: circles or polygons?

Postby Kilinich » Tue Jan 14, 2014 5:06 am

Circles are much better.
Algodoo auto-add a lot of nodes to any simple polygon so it's very resource-heavy.
Squares is better but still worse than circles.
Dream of Algodoo as game development engine...
User avatar
Kilinich
[Best bug reporter 2010]
 
Posts: 2098
Joined: Mon Aug 31, 2009 8:27 pm
Location: South Russia

Re: Many object scene. Which is CPU-faster: circles or polygons?

Postby sulloh » Tue Oct 21, 2014 1:55 pm

I forgot my manners and to say thanks. Thanks for the quick response back then!
Indeed circles worked much better than triangles in a back to back comparison. I have been running simulations with up to about 5000 particles since, and the program can handle them OK, even if not in real time.
Now I am crashing with a limit in the number of particles. If I have more than 5000 particles often I cannot save the scene (some out of memory error that I cannot reproduce right now), and if I use more than 10000 normally the program crashes after a few seconds (runtime error without any more details).
Is there a way to increase these limits, like changing something in the .ini file, a larger swap file, etc?
sulloh
 
Posts: 2
Joined: Mon Jan 13, 2014 3:41 pm

Re: Many object scene. Which is CPU-faster: circles or polygons?

Postby electronicboy » Tue Oct 21, 2014 4:07 pm

Algodoo is a 32bit program, thus there is a memory limit of 2GB which can't really be gotten around without a 64bit application, however that does require a bit of work, especially as Algodoo depends on external libraries which may take a bit of work to completely update, and you may have noticed that Algoryx is currently taking a break upon Algodoo for alternative projects at the moment.

Saving the scene requires that the whole compressed file is created in ram, which can take a fair bit of data to store inside the RAM before it's stored to disk, you can try appending .phn to the filename which will force Algodoo to use the old file format, which should be lighter on RAM for saving, however any images (such as a thumbnail inside the file browser) won't be saved.
When asking for help, READ THE STICKIES!
electronicboy
 
Posts: 1694
Joined: Mon Aug 31, 2009 6:18 pm


Return to Help / Bug reports

Who is online

Users browsing this forum: No registered users and 2 guests