OpenXcom Forum
OpenXcom => Open Feedback => Topic started by: Zharik1999 on May 14, 2012, 05:45:29 pm
-
Can anyone give me a good explanation about how 3d explosions work? (spread of damage, calculations, that kind of stuff) They seems to be rather unpredictable for me now.
-
Now that's something I would like to know too.
IIRC, Daiky implemented 3D explosions.
-
real explosions aren't always predictable either :p
ok, for 3D explosions, I did not look at how original xcom does explosions, I just made something that I could easely code and understand.
I use raycasting from the center of the explosion outwards, like a point light. Each ray has a starting power, the power reduces by distance and it can be dramatically reduced or even blocked by objects (depending on their HE block value)
When a ray crosses a tile, the objects (and unit) on that tile are affected by the power the ray has at that time. It keeps track of which tiles already have been affected, so they can be skipped if another ray crosses the same tile.
The method is similar for smoke and incendiary explosions.
There are probably things that still can be optimised, but it works and we didn't have any complaints about explosions being slow or unrealistic.
-
Thank you that looks rather logic.
-
Wow, this looks really cool! So the damage is not limited to a single hight level as in X-COM?
-
Yes, and it plays good too :D
-
while it looks and plays rather well, I have noticed one thing: if the explosion happens on the outside of a wall (that is, by firing explosive ammo at a wall) above ground level, the explosion only radiates outward-and-down, but not straight down. the squares directly below the center point are completely untouched, as if the explosion actually happened "within" the wall and couldn't go straight down.
is that consistent with your mechanics? is the center point for the raycasting within the wall (that is, between the tiles)? if so, it would probably be best to move it slightly outward, to avoid strange effects like the one described above.
-
Hello Moriarty!
I have to ask, are you the same Moriarty as the one at the SotS forums? :)
-
SotS? no, I don't think so.
I'm guessing you mean this: www.swordofthestars.com/
an not this: www.sots.ac.uk/
but anyway, the answer would be no in both cases :P
-
I meant Sword of the Stars forum, yes. There is also a member with the same nick.
Ah well, sorry for bothering.
-
no problem. that looks like an interesting game, though, thank you for pointing me to it... :)