HOME | DD

wonderwhy-ER — CDK Test 1

Published: 2009-07-26 22:52:11 +0000 UTC; Views: 3252; Favourites: 15; Downloads: 29
Redirect to original
Description Well not much interesting here probably.
So yeah. In my ToDo list lie many physics simulations + that process optimization studies. This probably will not be interesting for many tough.

What it is

Firstly it uses CDK (collision detection kit) which you can find here [link] I wrote about it some time ago. Basically it is sprite collision detection lib that makes per pixel collision checks. You can find some awesome demos in above link of it. Wanted to test it's performance and check how it is done for some time. Finally got to it.

Another thing that it features is my new performance tester. I actually posted an older version of it here [link] Made range of changes to it. No more FPS. Only separate tested blocks calculation tine in milliseconds. Plus changed way of how graphic i showed (calculation times are piled one on top of another).

How to use
Well just drag objects. When they intersect you will see blue circle in center of collision + collision angle.

Some thoughts on it

Dug down in to the lib. Idea is pretty simple actually. Just per pixels object scanning that in few places I can optimize. I think I will give it a try later.

On other hand it is anything with anything collision detection which is a bonus.

And it is pretty slow. Will not do if you have a lot of objects that intersect a lot. Tough may be I will have ideas on how to improve that. Need to run more tests first.
Related content
Comments: 24

eliskan [2009-12-06 03:09:28 +0000 UTC]

Yep this does get pretty laggy

Though I must say the collision detection is head on!

👍: 0 ⏩: 1

wonderwhy-ER In reply to eliskan [2009-12-06 10:39:01 +0000 UTC]

What do you mean by "head on"?

👍: 0 ⏩: 1

eliskan In reply to wonderwhy-ER [2009-12-06 21:46:47 +0000 UTC]

I mean the collision detection works very well, it's very accurate and probable better then the vector based hit-tests!

👍: 0 ⏩: 1

wonderwhy-ER In reply to eliskan [2009-12-06 22:02:40 +0000 UTC]

Mmm depends Collision detection is always about approximation your shapes with some kind of primitives for which you can determine collision and then checking those. Pixel based just approximates them with really a lot of small squires I have some ideas for algorithms that would approximate them with rectangles of arbitrary size but I am not really shore if it will make them any much faster... With pixels it is like "run trough an 2 arrays checking for places were they both are not 0" so mathematically check is pretty simple but there are a lot of those checks. If you approximate them with say circles operation become a lot more less trivial... So who knows... There is not simple answer to such questions...

👍: 0 ⏩: 1

eliskan In reply to wonderwhy-ER [2009-12-07 02:50:10 +0000 UTC]

You could use a similar algorithm for the vector-based collission checks as they do with the pixel-based checks. I imagine that if anyone can make collision more effective and less cost-intensive it's you!

Didn't you use pixel-based collision on [link] ? Or is that just an estimation

👍: 0 ⏩: 1

wonderwhy-ER In reply to eliskan [2009-12-07 07:31:27 +0000 UTC]

I haven't used collision there at all Was testing two my older ideas. One that I have mm kind of gradient function that shows density of landscape(kind of density and vector of it change towards less density, so kind of a vector out of it may be). Another thing I tried was that again particles instead of checking neighbors were writing they position and speeds to some discrete grid function and then again trying to calculate based on that how they should behave So no particle-particle interactions directly. But it resulted kind of weird... Need to play with idea more.

👍: 0 ⏩: 0

BlockJuice [2009-08-08 20:27:09 +0000 UTC]

Whole Lag: 98! FTW.

👍: 0 ⏩: 1

wonderwhy-ER In reply to BlockJuice [2009-08-08 20:38:47 +0000 UTC]

Well it is a stress testing for collision detection.

👍: 0 ⏩: 1

BlockJuice In reply to wonderwhy-ER [2009-08-08 23:33:23 +0000 UTC]



I'd hate to see you make a physics engine in flash. I'm running Vista on my laptop.

👍: 0 ⏩: 1

wonderwhy-ER In reply to BlockJuice [2009-08-09 09:50:57 +0000 UTC]

Ok

👍: 0 ⏩: 0

Kats-has-brownies [2009-07-27 20:59:50 +0000 UTC]

NNuuuu shapiess

👍: 0 ⏩: 1

wonderwhy-ER In reply to Kats-has-brownies [2009-07-27 23:10:47 +0000 UTC]

Shapiess?

👍: 0 ⏩: 1

Kats-has-brownies In reply to wonderwhy-ER [2009-07-28 01:08:00 +0000 UTC]

Yus. The cousins of Shapes.

👍: 0 ⏩: 1

wonderwhy-ER In reply to Kats-has-brownies [2009-07-28 08:52:37 +0000 UTC]

Ouh ok

👍: 0 ⏩: 0

YoungLink19 [2009-07-27 14:36:55 +0000 UTC]

Seeing how some Flash videogames don't even take much CPU usage, I must say this detection kit isn't too CPU-friendly. Per pixel scanning just isn't much desirable for large objects, not to mention multiple objects.

If anything, thanks for sharing this info. Maybe I'll try seeing what's going on in this kit...

👍: 0 ⏩: 1

wonderwhy-ER In reply to YoungLink19 [2009-07-27 14:47:21 +0000 UTC]

Yeah this one is pretty intensive on CPU. I must say even too intensive as this [link] can do some 1000+ pixel checks without problems. So I am thinking on looking in to it and may be finding ways to optimize it.

👍: 0 ⏩: 0

waltzy [2009-07-27 10:03:17 +0000 UTC]

once again, nic little app!

👍: 0 ⏩: 1

wonderwhy-ER In reply to waltzy [2009-07-27 10:13:18 +0000 UTC]

Thanks for

Mm. It is nothing special tough Just testing CDK and rewrote a little my performance tester.

👍: 0 ⏩: 1

waltzy In reply to wonderwhy-ER [2009-07-27 14:42:17 +0000 UTC]

aye, it looks usefull ^^

👍: 0 ⏩: 1

wonderwhy-ER In reply to waltzy [2009-07-27 14:49:09 +0000 UTC]

Too laggy tough.

👍: 0 ⏩: 0

JOeYLOL [2009-07-27 03:28:24 +0000 UTC]

i made something similar once..if made correctly something like this can be very useful

👍: 0 ⏩: 1

wonderwhy-ER In reply to JOeYLOL [2009-07-27 09:53:25 +0000 UTC]

Yes but it is very slow at the moment. I am thinking on trying to find what takes most time in it (probably per-pixel check) and I already see where I can optimize it.

👍: 0 ⏩: 0

secv [2009-07-27 00:40:06 +0000 UTC]

Cool stuff.

👍: 0 ⏩: 1

wonderwhy-ER In reply to secv [2009-07-27 09:53:50 +0000 UTC]

Thanks

👍: 0 ⏩: 0