HOME | DD

wonderwhy-ER — Collision study 5 by-nc

Published: 2010-01-24 22:56:57 +0000 UTC; Views: 39746; Favourites: 178; Downloads: 392
Redirect to original
Description How to use
All you can do in this version is to change amount of balls (first stepper), change partitioning algorithm step(second stepper, do not recommend as it seems to perform well with that),
forces dumping (third stepper, can lead to pretty different results).

And finally you can pick some presets I made using combobox.

Have fun.

Background story
So after making Collision Study 4 and checking it's bottleneck I started to think on how to fix it (Sweep And Prune algorithm was used there). Well did not come up with ways of improving Sweep And Prune.
Ended up checking this book [link] which I recommend to anyone who wants to write alike stuff.
Well it turned out I already knew all types of broad phase collision detection techniques probably except for k-d/bsd trees which are kind of expensive in some ways. Good to store static level but probably not that good with moving stuff.

Anyways in the end come up with idea of kind merging some parts of uniform grid partitioning and Sweep And Prune loosing some benefits of SAP but in same time hopefully fixing big SAP weakness. It was tricky and code is little bit messy. But in the end it almost doubled performance with right tuning I think there still is room for optimization + making it more stable but it is already very good


Further plans

Well this work mostly serves as algorithm performance test but after playing with presets I am thinking on making something like little sandbox thing where you could create/share/reuse presets yourself using range of small easy tools Still thinking.
Related content
Comments: 147

SonicTheHedgeTrimmer [2016-01-25 01:40:43 +0000 UTC]

Lol didn't last long on 9001 pixels

👍: 0 ⏩: 1

lolmakerofdoomlol In reply to SonicTheHedgeTrimmer [2016-07-27 20:41:56 +0000 UTC]

my computer didnt crash once 9001 pixels  

👍: 0 ⏩: 1

raikouiscool In reply to lolmakerofdoomlol [2017-06-22 16:22:38 +0000 UTC]

 waaaaaaaaaaaaaaaaaaaaaaat? mine not crash at all this game is Kinda boring tho 

👍: 0 ⏩: 1

lolmakerofdoomlol In reply to raikouiscool [2017-09-11 00:44:30 +0000 UTC]

well at least i played it

👍: 0 ⏩: 0

laurenisabae [2015-08-16 19:25:05 +0000 UTC]

Tetro is my favorite :3 This is me, when clicked on tetro:  

👍: 0 ⏩: 0

DJ-derpyhelmet [2014-10-12 03:31:09 +0000 UTC]

i crashed

👍: 0 ⏩: 0

tawnypeltwarrior [2014-08-14 11:06:52 +0000 UTC]

I made my shockwave crash ;u;

👍: 0 ⏩: 0

Zoiexx [2014-01-28 04:00:32 +0000 UTC]

The tetro makes me feel like I'm falling.

 I like it.

👍: 0 ⏩: 1

wonderwhy-ER In reply to Zoiexx [2014-01-28 08:14:14 +0000 UTC]

)

👍: 0 ⏩: 0

LeSpiritKitten565 [2013-05-31 19:31:03 +0000 UTC]

Tetro = Expanding circle, then fills in the universe C:

👍: 0 ⏩: 2

SweetflameofMC In reply to LeSpiritKitten565 [2015-09-11 10:48:29 +0000 UTC]

that's my exact feeling when i see tetro

👍: 0 ⏩: 0

wonderwhy-ER In reply to LeSpiritKitten565 [2013-06-01 07:48:25 +0000 UTC]

Yeah this universe started from 4 blocks

👍: 0 ⏩: 0

Korwynze [2013-05-20 15:05:13 +0000 UTC]

omg the whole thing woz filled with balls lol

👍: 0 ⏩: 1

wonderwhy-ER In reply to Korwynze [2013-05-20 16:01:00 +0000 UTC]

)

👍: 0 ⏩: 0

alphawolf1212 [2013-01-04 22:55:58 +0000 UTC]

this is AWESOME!!!

👍: 0 ⏩: 0

NocturnisWildcraft [2012-02-13 22:54:21 +0000 UTC]

WWWWOOOOOOOOOOOOOOOOAHHHHHHHH THAT TETFRO ONE IS WILD

👍: 0 ⏩: 1

wonderwhy-ER In reply to NocturnisWildcraft [2012-02-14 18:48:11 +0000 UTC]

Hehe, yeah like it too Could be used as interactive logo for physics engine or something

👍: 0 ⏩: 1

NocturnisWildcraft In reply to wonderwhy-ER [2012-02-14 21:11:56 +0000 UTC]

yea ikr

👍: 0 ⏩: 0

dynamicability [2011-04-19 07:44:24 +0000 UTC]

sci-fi!!!

👍: 0 ⏩: 1

wonderwhy-ER In reply to dynamicability [2011-04-19 07:58:19 +0000 UTC]

Not anymore, its reality now

👍: 0 ⏩: 1

dynamicability In reply to wonderwhy-ER [2011-04-19 08:02:48 +0000 UTC]

that is so great because it's kinda fun

👍: 0 ⏩: 1

wonderwhy-ER In reply to dynamicability [2011-04-19 10:07:50 +0000 UTC]

Heh, I have potentially more fun thing based on that. Here [link]
You can collide images with it

👍: 0 ⏩: 0

CypherWraith [2011-01-05 01:58:12 +0000 UTC]

Damn, dude. This makes my attempts at flash feel stupid. Excellent job!

👍: 0 ⏩: 1

wonderwhy-ER In reply to CypherWraith [2011-01-05 06:53:56 +0000 UTC]

Heh, well I was starting somewhere too

👍: 0 ⏩: 0

HeliacWolf [2010-12-31 15:10:27 +0000 UTC]

Шикарно) Мне особенно нравится Тетро)) Завораживает)

👍: 0 ⏩: 1

wonderwhy-ER In reply to HeliacWolf [2010-12-31 15:16:32 +0000 UTC]

Ага Тетро прикольный, подходит как логотип движка или что то

👍: 0 ⏩: 1

HeliacWolf In reply to wonderwhy-ER [2010-12-31 15:51:10 +0000 UTC]

Ага))

👍: 0 ⏩: 0

iluvcats123 [2010-12-24 21:16:24 +0000 UTC]

you and shock-value r gods!^-^

👍: 0 ⏩: 1

wonderwhy-ER In reply to iluvcats123 [2010-12-24 22:07:43 +0000 UTC]

Ahaha that's new and exaggerated I guess But thanks.
Hmm on other hand on which criteria do you judge us like that? I mean for example this work here needs some understanding of what is possible and not with Flash to truly make a comment like that. Makes me curious if you do or just like how it looks

👍: 0 ⏩: 0

Night976 [2010-11-26 20:28:27 +0000 UTC]

how do u control the particles?

👍: 0 ⏩: 1

wonderwhy-ER In reply to Night976 [2010-11-26 20:56:59 +0000 UTC]

What do you mean?

👍: 0 ⏩: 0

qrs22 [2010-09-19 14:23:45 +0000 UTC]

Cool.

👍: 0 ⏩: 1

wonderwhy-ER In reply to qrs22 [2010-09-19 14:32:28 +0000 UTC]

Thanks

👍: 0 ⏩: 1

qrs22 In reply to wonderwhy-ER [2010-09-19 16:05:00 +0000 UTC]

No problem, although a level designer would be nice.

👍: 0 ⏩: 1

wonderwhy-ER In reply to qrs22 [2010-09-19 16:10:11 +0000 UTC]

Will do something with time I guess, checking out various collision resolution schemes now. Check my newer works to see. Also check this [link] I guess you will like that

👍: 0 ⏩: 0

SONICRULES1 [2010-08-31 04:11:10 +0000 UTC]

LAWL i got it to max amount of ballz: 50000 (dont do it cus its a giant LAG

👍: 0 ⏩: 1

wonderwhy-ER In reply to SONICRULES1 [2010-08-31 05:42:06 +0000 UTC]

Hehe, well yeah it is dangerous

👍: 0 ⏩: 0

sukomi [2010-07-08 01:45:47 +0000 UTC]

Epicness!

👍: 0 ⏩: 1

wonderwhy-ER In reply to sukomi [2010-07-08 06:20:51 +0000 UTC]

Thanks

👍: 0 ⏩: 0

paranoio [2010-05-27 04:03:07 +0000 UTC]

very nice performance and thanks for the book link i was looking for something like that
So you use a grid ? i was thinking in create a grid class but with the option to be recursive hope that make sense to use with some experiments of motion detection, would like to hear more of your method.

👍: 0 ⏩: 1

wonderwhy-ER In reply to paranoio [2010-05-27 07:05:09 +0000 UTC]

Well that books covers (may be not very deeply) all broad phase algorithms I know. Various trees, grids, sorting etc. Good for checking what techniques are used and why. Though as I said it gives kind of superficial(if that's the right word) overview so it may not be enough if you don't have some prior or other sources of information on the subject.

An yeah I use uniform grid here. As for recursive I think you mean breaking regions of grid to subgrids depending on how many balls fall in it. I tired it before and it does seem to have a bonus of not needing to specify grid size as it does that itself based on situation. But there is a problem with it... You need to rebuild it each time(other algorithms may not need that) and also looping trough it becomes not trivial. By that I mean that in any grid based variation of such clustering there will be objects who span over many cells. So for them you need to loop trough such cells. And for such nonuniform grid that process may be less trivial. I don't imply that this approach is slower, it just that it highly depends on many details of realization and for that case it is very hard to get them right... May be some day I will try. Though I am not shore I need to at the moment. This thing works very fast already for 2D stuff + I have ideas for probably speeding it up even more.

👍: 0 ⏩: 1

paranoio In reply to wonderwhy-ER [2010-05-27 19:31:44 +0000 UTC]

yea the use of a subgrid was just an idea i had when working in a project but as you said its dynamic wich sometimes makes the movie become slow .

wish flash someday has the power to do this : [link]

Anyway im starting to read the book , thanks again.

👍: 0 ⏩: 1

wonderwhy-ER In reply to paranoio [2010-05-27 20:14:59 +0000 UTC]

Welcome
As for link. Well I think major problem is 3D graphics there. Having 3K physical objects I think is possible or is very close to being possible. Problem is that rendering happens in CPU, with effective offloading to GPU I think we could win some 50% of power + C++ is still some 20x faster and I think with better compilers and some improvements to language in strict mode flash should be able to get some 10x speed up (check how much Haxe or Joa Ebert apparat can squeeze out of existing player) or how Adobe managed to insanely optimize Flash for Android I also heard that a team of developers was formed inside Adobe to build next generation Flash compiler so we can wait hopefully some amazing improvements in that direction after 1-2 years(seems to be usual Adobe development cycle wtih CS3 being out in 2007 CS4 in 2008 and CS5 now in 2010) I guess we can await it next spring/summer

I am also very curious about Unity3D and JS optimizations Google and others do + WebGL combo... Though demos I saw of WebGL was not impressive so far... Eat CPU at Flash 3D level

👍: 0 ⏩: 0

Harm-Less [2010-05-10 22:37:47 +0000 UTC]

O..M..G, amazing dude, you're so good with math based things

And hi btw, long time no speak. I've been busy with a lot of things, I'm sure you know how that goes
How are you doing?

Ontopic: Funny coincidence, I was browsing the web for "collision/check if in range" algorithms when I stumbled upon this new study of yours (I've haven't been on DA much too, sorry ). So far I was really impressed by this: [link] but it seems yours is even faster and even with actual collisions. I'd love to see how you did it

👍: 0 ⏩: 1

wonderwhy-ER In reply to Harm-Less [2010-05-11 09:22:53 +0000 UTC]

Thanks tough everything is relative I am not really THAT good with a math but probably better then average.

Yeah especially in freelance it becomes pretty chaotic and busy What you are busy with?
As for me. Finished with freelance for now(well not really one damn project still haunts me? Already told them in January that I don't have much time for them).
Working in firm that writes games for social networks now. Can't say I am fully satisfied but it is a valuable experience.

I think that uniform grids and sweep and prune have more power if made right. Quad tree is too complex of a structure that is more expensive to reconstruct and depending on how you do it may be more expansive to loop trough.
Here I am actually experimenting with various ideas for combining Sweep And Prune and uniform grids. Sweep And Prune is powerful because it is simple and reuses sorting ideas well and it can be lopped trough efficiently. But when there are so much objects it starts to loose as it does not filter out collisions that are on same lines. So if you have 1000 objects on same line its efficiency falls considerably. While grids often are too complex to loop trough and they often use indexed arrays, are harder to rebuild etc etc. But it does not have flaws with lines which makes it potentially better.
Currently thinking of ways to combine strong parts of both eliminating weak parts of both This one actually is an early try. When will have time will try some more.

👍: 0 ⏩: 1

Harm-Less In reply to wonderwhy-ER [2010-05-13 10:12:13 +0000 UTC]

Well, I got into the freelance business again recently, but full-time this time. Hopefully it will work out
I'm working on a remake of my homepage and I'm working on an rts game which is a dream of mine, I'll show you soon. Really hard to balance the performance just right, that why I need a fast "check if in range to shoot" algorithm to name an example
And on the lookout for clients of course

But right now I'm planning to check every .5 or 1 second if and enemy is in range, it doesn't have to be every frame. I think that works just fine.

👍: 0 ⏩: 1

wonderwhy-ER In reply to Harm-Less [2010-05-13 10:16:36 +0000 UTC]

I see making game then How many enemies?

👍: 0 ⏩: 1

Harm-Less In reply to wonderwhy-ER [2010-05-14 09:16:54 +0000 UTC]

Ehm, well, I was hoping at least 500 units total, my team and the enemies. I don't think 1000 will be a good think to do, so I'll just limit the amount of units you can create in the final game.
So far it looks like it can be be done with tests I ran. I've done a lot of optimizing the performance already, I want this game to be as perfect as possible. I'll show you an example as soon as I can.

👍: 0 ⏩: 1

wonderwhy-ER In reply to Harm-Less [2010-05-14 09:53:26 +0000 UTC]

I see Well good luck

👍: 0 ⏩: 0

kichakicha [2010-04-01 12:35:54 +0000 UTC]

Love It ^^

Improve Your Skills, You Will Be Great

👍: 0 ⏩: 1


| Next =>