So hey, about those explosions

I don’t know if I should spoiler this or not, especially considering that it could lead to some major !!FUN!! for those unprepared but…well !!FUN!! isn’t always fun if it’s because a dangerous mechanic changes between stable releases and not everyone follows the daily (sometimes more) changelogs…

Explosions. Damn. They are A LOT more explosive now. Much more epic. Those little turrets blowing up in the lab gave my first hints that something might have changed…very glad I closed the metal door between myself and that stick of dynamite I was using to breach the reinforced glass near a console I wanted.

So yeah, this is going to require some more testing (obviously, like do they not go through 90 degree angles, how big are the new blasts, etc), but hey, word of warning to anyone who hasn’t played with explosives in the experimentals yet, the blasts are much bigger.

The blast is around 7 tiles wide. Basically in labs you can stand outside the open door, shoot the turret, and the explosion will hit you. On the other hand, damage seems to be minimal - though granted I’m decently armored for it. Dragon skin vest, survivor trenchcoat for torso, etc.

I’m used to dynamite being a nice 3x3 blast, useful for surgical breaching. Far from what it is in reality if uncontained, it just came as a surprise to see it fill almost the entirety of a bunker.

Wonder if it’d be possible to make a construction option to make a hole in a wall and insert dynamite inside of it. More controlled, but capable of cracking apart concrete.

Fusion blaster explosions are also HUGE as well, and there are two of them in succession, the second one a bout half the size of the first.

Seriously, that first explosion has got to be at least 20 tiles in diameter, maybe more. For 4 bionic energy… um, wow. Yeah, something is a little bit busted…

How recent experimentals? 8 hours ago I exploded a modified mininuke (for my test on how broken hordes ). It was very loud, but not particularly explosive. I was a little worried that the maximum 24 tiles range would hurt me, but it didn’t even have a 12 tile radius!?

Does dynamite contain 3/4 of the explosive power of a mininuke now? >.>

[quote=“digitCruncher, post:5, topic:9972”]How recent experimentals? 8 hours ago I exploded a modified mininuke (for my test on how broken hordes ). It was very loud, but not particularly explosive. I was a little worried that the maximum 24 tiles range would hurt me, but it didn’t even have a 12 tile radius!?

Does dynamite contain 3/4 of the explosive power of a mininuke now? >.>[/quote]

3360 build, from a couple of days ago I think.

AFAI could tell the dynamite blast filled the width (at least 12 tiles) of a lab barracks and the length (at least 5) from the secondary inner door to the entrance door. It stopped at the entrance door because I had closed it. It didn’t even ding the secondary door but it did cook the reinforced glass in front of the console despite being 3 tiles away.

The edges of the explosions used to be very dangerous, but now they’re really weak. In ASCII mode they’re colored, IIRC the outermost white part isn’t particularly dangerous.

The balancing of explosions may be off, though to fix it I’d need some good data:
Where is it too weak? What are the expected ranges at given power? What should be the expected damage from power x at range y?

I mostly balanced it to “look good”, wreck the terrain properly and not have a cutoff like a stereotypical video game shotgun (deadly wrecker of everything at 4.9 meters, 0 damage at 5 meters).

Current scaling of damage is exponential, as far as I recall it is:

The physics of explosions are a little complicated. In all cases, they follow a ‘power’ curve, rather than an ‘exponential’ curve. In an unenclosed space, the damage is

When a roof is present, the damage is

When roof and narrow walls are present, the damage is

Note that this ignores friction, pressure absorbed by the roof and walls, and other things that make physics difficult. Also, assume that when distance = 0, remember to set distance = 1.

I am writing some pseudocode (similar in format in C#) that should tell you how much damage each tile should get, exactly, but I am not sure if you guys would want it, since I don’t actually know the cataclysm codebase at all…

I tried to get it to spread differently based on surroundings at first, but couldn’t get it to work correctly with both bashing and creature damage at the same time.

Forgot to add: the distance is actual distance traveled, not just rl_dist( start, end ).

Wow. You are right. That is a much more difficult problem that it appears… If you split the energy evenly four ways (N,E,S,W), and let the center tile take 432 damage, then the tile 2 tiles south takes 9 damage, but the tile 1 E of that (which HAS to be further away from the explosion) takes 12 damage

I had to use Excel (fastest thing available) to work out if splitting it eight ways would improve it. And it does, to a point. Let the center tile take 360 damage. The tile 2 tiles south and 2 tiles east takes 9 damage, but the tile 2 tiles south and 3 tiles east (or vice-versa) takes 9.8 damage, despite being further away.

As you head further south, the distribution just gets insane. After traveling 4 tiles south, and 5 tiles east, you take 1.281 damage. Travelling further east, and further away from the explosion you then take 2.042, 2.440, 3.294 … it just increases the further away you get from the explosion! After travelling 24 tiles east, damage decreases for the first time, from 5.474 to 5.471 .

That system won’t work. But maybe you could use the damage = damageatonetile * (distance ^ -0.5), and if distance is 0, then deal damageatonetile * 8 damage? This explosion formula is difficult >.> [Edit] And yes, use the actual distance travelled, as that would make it more accurate when it goes around corners)

Damage from explosions and force is interesting, because it comes from multiple forms. The blast of whatever is being hit, then smacking into the other objects, which in turn can be pushed back and then also sometimes hit other objects. If it’s a small piece like a bb/pellet it can go through flesh and back out, maybe bouncing off another object hard and come back etc.

Also anything that door air/fuel explosions in a small area suffocates people as it sucks up all available air, and often replaces it with smoke.

Tried going at it on melee with a turret. The explosion from standing next to the center of the blast barely did any damage, probably even none. It did shatter the windows, though.

I MADE A MISTAKE! The formula for explosions without a roof should be

damage = damageatonetile * (distance ^ -2)

Quadratic would be quite a lot different than the exponential we have now. Exponential damage deals most of the damage in the middle, while quadratic deals more damage at point-blank and very long range.

Playing around with the numbers, and I think having the center tile deal four times as much damage as it currently does, and having the adjacent tiles deal three times as much damage as they currently do makes the best damage spread.

The formula would become (setting base_damage to four times the current value)
damage = (distance == 0) ? base_damage : base_damage * 0.6 * distance ^ -2;

At point blank range it does 4 times the damage, adjacent tiles receive three times as much damage, and two tiles away, the damage is 94% of what the current implementation has. However, damage rapidly reduces the further away you go. At 5 tiles, a 100 damage explosive used to do 33 damage, but now the equivalent 400 damage explosive would do just 9.6 damage. 25 tiles away, and quadratic does more damage again (0.384 instead of 0.378), but since we are dealing almost no damage, it might not matter…

It is a right royal pain that we can’t calculate how much more focused the explosion would be in a closed room, or a hallway, because that is where explosives are much more useful. (My formula for a closed room in my previous comment is reasonably accurate)

Your exponential formula is exactly what you would expect for an explosion in a hallway.

So … I might try to work out a more accurate algorithm. I have an idea … but I also have a job I need to go to >.> [Edit] Actually, Coolthulhu suggested that even if I were to get an accurate algorithm for how much each damage each tile should get, it might not be possible to deal damage to both creatures and structures… is that the case?[/Edit]

Damage to structures has to be calculated during explosion expansion, unless you’ve got a good idea on how to implement that otherwise.
At first I tried to make the explosion tiles “share” the excess force between each other. This was quite complex and I couldn’t get it to work, though the concept seemed OK.
This is because explosions are supposed to blast through obstacles.

Damage to creatures is easier, because you can calculate and apply it after the explosion happens.

The exponential formula’s stronger middle was one of the reasons I picked it over quadratic. That way explosion is more efficient at the same power without having large “spikes” in the middle. This makes it way easier to balance - explosives can be useful without being abusable.
The faster falloff at the end is also useful: that way explosion expansion can be tied to the force left without dependency on force at start.

With quadratic formula, the proper usage of explosives is restricted to mines and “sniping” with grenades. A miss of one tile already lowers damage to half, by two tiles to negligible value. This kills the whole idea of grenades being AoE weapons and leaves that to fire and chain lightning.

Try something between linear and quadratic powerloss (damageatonetile * distance ^ -1.5 maybe) and test until you got the right amount.

I guess that has to do with the really poor effectiveness of concussive grenades. Even military concussive weaponry has a range of only about 3 meters, and the quadratic drop-off is precisely why they have such a small range. Grenades have a 2m radius where everything gets killed in the shockwave, but the vast majority of the usefulness of grenades is the shrapnel that can fly up to 200 meters away. So ‘sniping’ with grenades is probably the best solution for the concussive part, but incendiary, shrapnel-based, and flashbang grenades would have a much larger radius of their secondary effects (possibly even larger than a regular person can throw it, which would require the thrower to find cover immediately!)

I still think that explosives should use a quadratic explosive formula. I might make a suggestion in the suggestion forum with more specific suggestions. But to make explosive weapons semi-realistic would require quite a bit of work…

Yeah it seems explosions are actually very weak now, it’s completely possible to have a pack of dynamite explode in your inventory and survive.

Those require a cutoff that changes with initial power. Otherwise the explosion size gets giant even at small power. And cutoffs look quite weird.

While tiles don’t have a precisely defined size, that’s partially what I was going for: having a small area where the effect is more or less sufficient to kill things. Shrapnel is obviously more effective, because it doesn’t have significant drop in power at range.

The unreliability of shrapnel makes using explosive weapons against zombies unfeasible, though.

I may have gotten some numbers wrong. I focused more on balancing it vs armored characters and big explosions than realism.

I’d need some examples to balance it properly, though. Like, grenade in inventory = 100 damage to torso, but grenade at 5 tiles = 10 damage etc.

We can do something about that, for example instead of simulating individual projectiles, the shrapnel could just be an expanding cloud that falls off in “density” with distance from the explosion. It would be entirely reasonable to not draw shrapnel at all, IIUC you can’t see it at all IRL. In fact, since it’s completely LOS based, we could hijack the FoV calculations to determine where it hits and relative distances, then iterate over that to apply the effects.
Like Coolthulu though, I can implement a system, but I don’t know where to find the figures on effective ranges etc.