Chris

11-11-2011, 10:51

OK, so one of the things that will be in Xenonauts is collapsing buildings. It's more realistic, of course - no more floating upper levels of buildings after you've shot out the ground level! We want to implement it in the next month or two ideally.

The problem is, I'm struggling a little to find a method of doing this in formula terms. I need to find a formula that marks ground tiles as 'collapsed' and destroys them if they have insufficient support from the level below, but this is harder than it looks.

In game terms, floor tiles fill a full square and wall tiles fill the lines between different tiles. Generally a floor is strong enough to survive the wall directly below it being destroyed, provided it still has walls around it to support it. My basic assumption was that it a floor tile on the edge of a building had any wall tile in an adjacent tile on the level below, then it would remain standing.

The only problem with this is how to account for all the tiles in the centre of the room. Obviously the walls only run around the outside of the building in many cases, and we don't want a situation where a couple of outer wall sections are shot out and the entire floor collapses - but niether do we want a situation where shooting out 4-5 wall sections next to one another only causes a collapse of the tiles immediately next to them. Ideally it'd form a sort of V-shaped tapering wedge of collapse going into the centre of the floor.

But yeah, I'm a bit short of ideas here. If anyone's got some ideas for basic logic underpinning the tile / building collapsing, then post them here!

The problem is, I'm struggling a little to find a method of doing this in formula terms. I need to find a formula that marks ground tiles as 'collapsed' and destroys them if they have insufficient support from the level below, but this is harder than it looks.

In game terms, floor tiles fill a full square and wall tiles fill the lines between different tiles. Generally a floor is strong enough to survive the wall directly below it being destroyed, provided it still has walls around it to support it. My basic assumption was that it a floor tile on the edge of a building had any wall tile in an adjacent tile on the level below, then it would remain standing.

The only problem with this is how to account for all the tiles in the centre of the room. Obviously the walls only run around the outside of the building in many cases, and we don't want a situation where a couple of outer wall sections are shot out and the entire floor collapses - but niether do we want a situation where shooting out 4-5 wall sections next to one another only causes a collapse of the tiles immediately next to them. Ideally it'd form a sort of V-shaped tapering wedge of collapse going into the centre of the floor.

But yeah, I'm a bit short of ideas here. If anyone's got some ideas for basic logic underpinning the tile / building collapsing, then post them here!