Skip to main content
gamedev.net
🔒 Locked

Blast wave?

Started by Waverider Jul 22, 2003 at 11:07 AM 9 replies 1.6k views
Original Post
Waverider
Waverider
I was wondering what you think is the most elegant way to program a blast wave of a ship exploding in outer space. I know how to handle the expanding radius and the reducing strength of the blast. What I''m having a little trouble with is handling the damage that the blast wave causes to the nearby ships. I was thinking I would just apply the damage once, at the instance that the wave strikes a ship. But that creates a problem of making sure I only damage each ship once with the blast. There may be two or three ticks, due to ships accelerating or moving quickly, that the blast crosses the ship more than once. I wouldn''t want a ship to take a ridiculous amount of damage due to CPU speed or unluckily accelerating at the wrong time, as other ships emerge seemingly unscathed. Or perhaps I apply damage as the blast expands, allowing ships to be damaged more than once? The more they allow themselves to be exposed to the blast, the more damage they take. This would cause nearby capital ships to take a lot of surface damage. I would also have to consider the blast being disrupted by a capital ship, so that fighters behind it are shielded. A fighter speeding away from the blast might ride the wave, taking a little bit of damage each tick, but the bombardment is much less than on a ship that barrels straight through it, taking a lot of sudden damage. How would you imagine blast waves should be handled?
It's not what you're taught, it's what you learn.
Stonicus
Stonicus
Probably treat the damage as a field effect. So a player can take damage each tick they remain, but the damage lessens as they get farther from the center. By putting lower ranges than you would from just a single damage call to the player, they would just continuously take damage as long as they are in the wave, and it is still in their best interest to flay away, at least to minimize damage taken.
Stonicus
Stonicus
How to handle a ship blocking the wave another is a harder problem. First solution is easiest, just say that never happens. Second, you could cast some lines from the blast source to the edges of the capital ship''s bounding box/sphere/whatever. Then, when you know the intersection of that, cast out another arc wave that dose negative damage in same magnitude as blast wave. Kludgy though, cuz a ship doesn''t really take 0 damage, but 10 and -10 at same time.

Or, instead of a giant wave, you could propagate out small spheres of damage that can overlap. As they hit the capital ship, just destroy them and they do not continue to the ships behind it. This can lead to alot of objects created per blast and slow performance. However, I am a student of the school of ''Get it working, then get it working well'' so any solution that gets ya in the right direction can always be tweaked or optimized.
y2kiah
y2kiah
Stonicus, why would the blast wave stop with a ship in the first place? The wave should pass right through and do damage to anything behind the ship as well.
Stonicus
Stonicus
I agree, but if you had read the original post, he specifically asked how to handle that situation.
y2kiah
y2kiah
I realize that and I''m saying it''s a problem that doesn''t need to be fixed, because it is not a problem at all. The capital ship should not shield the blast for a fighter or anything else IMO.
Waverider
Waverider
Isn't the blast wave made of physical force? Like standing behind a brick wall to evade a large explosion?

By your logic, every person inside the capital ship would be killed. No singular person could survive a close blast without being shielded from it.

Perhaps if you are some distance behind the capital ship, then the blast wave reacquires its form after a time and you still get damaged by it. But if you are immediately behind the capital ship, it stands to reason that you will be mostly shielded from the blast.


[edited by - Waverider on July 22, 2003 2:00:34 PM]
It's not what you're taught, it's what you learn.
y2kiah
y2kiah
This is not a shockwave since there are no molecules in a vacuum to carry the wave... so there is no hiding behind a brick wall to avoid it.

It would have to be an electromagnetic wave, so the fact that it is even created when something explodes seems very hollywood, but still it''s a game and you gotta have explosions

Lets say this wave is actually scattering debris from the thing that exploded... this could cause physical damage and the debris would be blocked by a ship or anything. To simulate this you could use a particle system or set up an occlusion frustum around the bbox of the ship projected from the source of the explosion. Just be creative!
Nypyren
Nypyren
I would break apart the pieces of the exploding ship, have those fly apart and cause collision damage to stuff... as well as a bunch of high-energy particles from the ship's antimatter reactor that explode at the same time (but move faster and do a significant amount of damage per particle)

I'd definately do it particle-system style rather than wavefront equation-style.

[edited by - Nypyren on July 22, 2003 2:14:09 PM]
y2kiah
y2kiah
I think that would work for a 2d game alright, but in 3d we''ll run into some problems with particles. If the blast is spherical then equal distribution of the particles is not guaranteed unless you so some pre calculating, and even then the spacing of particles gets higher as the explosion moves outward, which means that many ships might get bypassed and not actually take damage. If you up the number of particles to a rediculous level you can almost guarantee that every ship will take at least a few particles, but then you kill framerate because of all the updating and collision detection you need to do.

I think a better solution would be using volumes. 2 spheres would be created of different radii defining the damage zone between them. As the explosion moves outward an object will take damage as long as it is within the damage zone. You can''t go frame by frame to assess damage however because different framerates will kill the accuracy of the damage. So you expand the wave based on time and calculate the amount of time that the ship is within the damage zone.

Or an even easier way is to just calculate the distance of the ship from the explosion source at explosion time and assess damage right away. You can still simulate the "riding" effect by taking into account relative velocity of the ship to the explosion source. The animation and damage calc would therefore be completely separate.

Just some ideas, personally I''d do it the last way I mentioned.
Waverider
Waverider
There might be a way to calculate degrading damage between sphere zones as a time equation such that the effect is the same no matter the frame rate.

And if I used sphere zones, I would have to add null damage regions for capital ships that disrupt the explosion as was mentioned previously.

Well, at least it looks like I won't be using the "pass once, damage immediately" method. The damage over time method, even if it is for a very brief amount of time, seems the way to go.



[edited by - Waverider on July 22, 2003 2:36:36 PM]
It's not what you're taught, it's what you learn.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.