OpenXcom Forum
OpenXcom => Suggestions => Topic started by: redv on February 18, 2013, 03:24:43 pm
-
The basic data.
In vanilla Xcom explosions was flat. Xcom is not designed for 3D explosions.
Basic formula for calculate the average power of explosion:
Power = PowerMax – 10 * L
where: L – range from epicenter in tiles.
https://www.ufopaedia.org/index.php?title=Explosions (https://www.ufopaedia.org/index.php?title=Explosions)
In OpenXcom explosions is 3D.
Game field is limited in height by 4 tiles.
The problem.
Tiles is not cubic, but rectangular 16x16x24 voxels. 3D explosion stretched in height.
For the correct convert between real angles and in-game angles need use processor expensive formulas (for example: tg(real fi) = tg(in-game fi) * 16 / 24).
The suggestion.
Easy to use formula for calculate the average power of 3D explosion must be:
Power = PowerMax – 10 * L – 10 * H
where: L – range from epicenter in tiles. Same as L in previous formula (no projection on axis X, Y).
H – height in tiles; projection on axis Z.
Formula is the compromise between vanilla Xcom and OpenXcom.
Result of the explosion would be more realistic.
Sample of calculations is attached.
-
options.cfg, explosionHeight
0=flat (original)
1=-30 damage units per level (additinal to -10 per tile)
2=-10 damage units per level
3=-5 damage units per level
Commit incoming.
-
OK
Thank you.
-
Nice work Volutar :)
-
Volutar, small mistake in formula.
if (origin->getPosition().z != tileZ) power_ -= vertdec; https://3d explosion factor
https://github.com/SupSuper/OpenXcom/blob/master/src/Battlescape/TileEngine.cpp#L875 (https://github.com/SupSuper/OpenXcom/blob/master/src/Battlescape/TileEngine.cpp#L875)
if (origin->getPosition().z != tileZ) then "vertdec" will be subtracted every step by "l", even if tileZ not change.
Correct code is:
power_ -= abs((int)(vertdec * sin_fi)); https://3d explosion factor
-
redv, no mistakes. it traces step by step, and "origin" changes every time. and z is changed only with vertical switch.
-
Yes, you're right.
-
Recently Daiky discovered inproper explosion values.
(https://oi42.tinypic.com/1z512mt.jpg)
So I must shed some light on these things arised.
1. So called "Double destruction" commented in this commit (https://github.com/SupSuper/OpenXcom/commit/9183df88d4af8ba8d393cf4a78aabcd82ee64940) is not what code needed.
2. Power/2 here (https://github.com/SupSuper/OpenXcom/blob/master/src/Battlescape/TileEngine.cpp#L1162) only confuses thus better to be processed inside of "detonate", because it's tile ARMOR which is multiplied, than explosion strength which is weaken.
3. Damaging process is iterative, it decreases current DAMAGE value by armor, unless it become less than value affecting on tile damage (which is armor*2). Commented with "double damage" is just emulation of that process. If damage was for instance 200, and tile armor*2 is 80, it should be destroyed. But then damage value of 120 should applied to this tile (which become death_tile at this point), and ot should be destroyed too!.. So final damage value will be 40, and damage process applied to tile TWICE.
4. Smoke density value depends on LOFT height (it determined by checking loft values != 0).
Formula is: smoke_density = random(LoftHeight/2+2) + LoftHeight/2+1;
5. Tiles inflamation is also somewhat screwed. Ignition process should happen when damage value is greater than than "fire proof"*2 tile value (similar to armor for destruction). Fire lifetime is taken from MCD info. Fire density is calculated as 15-fire_proof/10, and must be capped to range 1..12.
-
Regarding to point 3: I don't get it why you want to multiply the armor of the original tile by two?
Example:
desert floortile armor: 5
damaged desert floortile armor: 20
grenade maximum damage power at center: 25
you did 5*2. 10 damage would destroy both the desert floortile and damaged desert floortile?
while in the original game you need more than 5+20 to destroy both the desert floortile and damaged desert floortile.
I don't know why you changed this... I thought the purpose was to get close to how the original works?
ok, I get it, the power/2 is confusing, I guess I'll fix that bit then. Commit incoming.