This is the image of how it can works.
Calculation of "cave-in" starts from lower to higher z-levels.
It compares each 2 z-levels from down to top.
At the image:
green - just forget about them =)
gray - blocks which are allowed to stay at its placed (not to cave-in)
red - the calculation point of cave-in
yellow - falling tiles (cave-in)
For example: each third-end tile from upper level will fall if it hasn't a support on the lower level. So -
The blue tile will fall (cave-in)
The thing is: this system will automatically form pregenerated territory to prepare it to play & will remove cave-ins at start of the embark.
& will check every new changed tile to calculate cave-in.
Something like this. Will it cause lags? =/
I'm trying to understand what to do next but it's really hard for me =)
I'm thinking about: how to imagine (because I'm not a programmer, so...) an algorithm which will perform local calculation of cave-ins to make it not so laggy. To not to force all-tiles-calculation when state of one tile has been changed. & not to make it buggy with flying objects in global...