Tank

Hey i was wondering what code did you use for explosions ? I spent some time with box2das3 and i came up with this:
http://eduneuro.pl/test/PhysTest.swf
(Move with lef-right arrow up-down move the turret and space shoots)
however i need explosion code for the bullets 🙂
cool! getting a working turrent was going to be my next step.

The bombs work by tracking collisions, if the the force of the collision is over a certain threshold, it decreases a 'strength' value in a class assigned to m_userData in the shape, As the strength value decreases, the color changes, when if finally reaches 0, I add a large amount of angular velocity to the body the shape belongs too, and destroy it the body in the next time step. I'd be happy to share the code with you, just drop me an email or hop on the box2d IRC channel. [email hidden].

It's not a true bomb. For instance, nearby objects will often remain completely unaffected. My idea for a better bomb would be to define a circle that represents the bomb's shockwave radius. For every shape in the circle, apply a force outward from the circle, with the amount of force dropping off the further the shape is from the blast center. I'm not sure if this kind of area based collision testing is supported by the engine though.
I see, i think i could use aabb query to get objects nearby then check the distance from the center of the explosion and apply proper force to objects. However i would also want to check if bodies aren't hidden behind a static object like wall. However that might be more difficult
I spent another day working with box2d. I have rewritten all the code creating some simple base for future. So there's not a lot of new stuff however here's another demo : http://oek.nazwa.pl/t/PhysTest.swf
Turret is controlled with the mouse and left mouse button fires a bullet. It still has a lot of issues but i guess it could become a fun game someday. Is there anyone interested in working together on such a game ?
i certainly am! I think we're on the same page as far as the basic concept, and I have an excellent concept artist willing to work for free.

my email is in the opening post, drop me a line.
Hello.
Phervers, please give to us the source code. I very need it.
I should learn as to create explode and how to trace how much "health" loses object at impacts.
phervers and I have teamed up on this tank game. We aren't willing to release all the sourcode at this point, but we'd be happy to share tips and techniques.

Tracking health is a matter of tracking all the collisions each time the world updates itself. There's a method or property in the world object to get a collection of all the collisions. You can loop over that and apply the force of the collision to both objects in the collision, decreasing the health for each object.
You can post small code, which get a collection of all the collisions in b2world and forces of these collisions?
Yes, I agree. Let's start sharing some more code. It will benefit all.
I don't have a problem posting some code snippets, just not our entire source code.

That's actually why I suggested the Box2D wiki, so we have a more organized place to put code snippets, tips, techniques, etc.

I have yet to talk to phervers about how he feels about posting code snippets from our project. I doubt he'll have a problem with it,
but courtesy demands we discuss it first.

Original thread: https://box2d.org/forum/viewtopic.php?t=142