Deviant Login Shop  Join deviantART for FREE Take the Tour
×



Details

Submitted on
May 24, 2010
Image Size
8.1 KB
Resolution
800×600
Link
Thumb
Embed

Stats

Views
1,681
Favourites
23 (who?)
Comments
16
Downloads
24

License

Creative Commons License
Some rights reserved. This work is licensed under a
Creative Commons Attribution-Noncommercial-Share Alike 3.0 License.
×
I haven't posted anything for a while, so I thought "Why not post something old? It's still good, it's still good!" and now here I am!

So.. uh.. yeah, all the instructions should be in the swf itself.

Let me know if you are interested in more old stuff like this :)
Add a Comment:
 
:iconschweinskopfsuelze:
Schweinskopfsuelze Featured By Owner May 25, 2010
nice one
Reply
:iconsmilyorg:
SmilyOrg Featured By Owner May 25, 2010
Thanks (:
Reply
:iconjoeylol:
JOeYLOL Featured By Owner May 24, 2010
no collisions is cool :3
Reply
:iconsmilyorg:
SmilyOrg Featured By Owner May 25, 2010
rawr :3
Reply
:iconniallmeister:
Niallmeister Featured By Owner May 24, 2010
Ah, I saw this on your website a while ago, great stuff. I'm working on something very similar actually, which method are you using for broadphase checks?
Reply
:iconsmilyorg:
SmilyOrg Featured By Owner May 24, 2010
Thanks :dance:

I use a grid with each cell being a linked list (represented as Vector.<ListParticleItem>) containing the particles currently in that cell (at least partially), so that each particle can be in 4 cells at the most (grid cells are just slightly larger than particles). Then for each particle I just check the particles in the 4 cells it's in for collisions. Since this might bring some inconsistencies (not all collisions might be resolved, since particles move after the collision), I do it twice each frame.

That's what I assume would be the broadphase check. For individual collision checking I just check the bounding boxes first (should be cheaper to bail out early if any of the 4 conditions fail :P) and then do a real distance check :D
Reply
:iconwonderwhy-er:
wonderwhy-ER Featured By Owner May 24, 2010
Woah this actually is very impressive :) What kind of algorithms have you used?
Reply
:iconsmilyorg:
SmilyOrg Featured By Owner May 24, 2010
Thanks!
For collision detection I used a grid, where each cell is a linked list of particles in that cell (so it's represented by a Vector.<ListParticleItem> (it's 1D, so I don't get any potential overhead from managing lots of Vectors (parentheses are silly :dance:))). It's not the fastest thing in the world, but I don't like trees that much :D
For the actual physics of the particles I used Velocity Verlet integration, which I found to be quite stable (in contrast to my previous attempts :P).
Reply
:iconwonderwhy-er:
wonderwhy-ER Featured By Owner May 24, 2010
As for Varlet. I am using similar stuff and yeah stability is an issue. BTW with large numbers yours starts to become crazy too :D
I think next time I will be doing collision experiments I will try something like that(not varlet, just overall effect) as it is cool :)
Have you checked what adds to the lag the most? In my experiments collision detection stops to be a bottle neck, it starts to be hard to draw so many objects. In my last experiments it was 50/50 or close to it :)
Reply
:iconsmilyorg:
SmilyOrg Featured By Owner May 25, 2010
Verlet* ;)

As for the lag, it mostly depends on what display mode you are using, but it's easily 5x faster with no collisions. The display modes are roughly arranged from the fastest rendering, but not much to see (1) to the slowest rendering, but somewhat prettier (7).

You turn off / toggle collision detection by pressing space, so you can see how fast it's just rendering (I can hit 20000 particles and still be at 60fps if I switch to display mode 1).
You can also turn off rendering by pressing 8, 9 or 0.
If you turn off both rendering and collision detection, you can see how much overhead there is from other stuff and at display mode 1 it's actually mostly overhead taking up CPU time.

The particle radius is something to watch too, since it might be a lot slower to render with large radii if you use display modes > 2.

Also note that attracting particles with the mouse is not optimized at all, so that can take a lot of CPU at large numbers of particles.

If you want to render a lot of bitmaps really quickly, take a look at the bitmapData.copyPixels method, since it's really fast; I used it for display modes 4-7.

:D
Reply
Add a Comment: