#Explosion line of sight
1 messages · Page 1 of 1 (latest)
Usually, games like this have the explosions be done trough a flood fill (i recommend looking it up, i always do when implementing it because it is annoying and time consuming to get right).
You identify the central cell to the explosion, then extend it to neighboring tiles, with each tile traveled reducing the power of the explosion, and with solid tiles reducing it even further or completely.
If the explosion reaches a cell and runs out of power with that jump, that cell cannot spread the explosion anymore and it ends there.
That's an interesting algorithm. It seems to be BFS like traversal checking the valid tiles and reducing it's strength.
My main concern is that it seems like it's not a line of sight algorithm, it can go around corners
I'm creating a splatoon like game so I want my explosions to be able to identify and paint tiles around it. My current raycasting implementation works but does affect performance when there's many explosions
there's a series of algorithms that are called "shadowcasting" which you might find relevant. https://www.redblobgames.com/articles/visibility/
In general this is similar to lines of sight in a roguelike, so adapting one of their algorithms will help. The central idea is that you are flood filling (as Nancok suggests) carrying not just distance information but allowable angle information. Encountering obstacles narrows the range of acceptable angles thereafter.