Jump to content

Recommended Posts

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!

Link to comment
Share on other sites

Can you use a variartion of the logic used for civilians fleeing from us and the aliens?

I don't imagine it would be physics perfect, but floor tile distance from a wall calculation done only after an individual tile no longer has all of it's sides with an existing floor tile or wall.

So, if a floor tile is connected to an existing wall, 0% chance of failure. If it is in the center of the room with floor tiles all around it, 0% chance of failure. However, if a tile used to be next to a wall, wall is destroyed, it is no a loooong ways from the next wall and it colapses, then the next one. Or is that type or approach, one by one too sequential?

Link to comment
Share on other sites

A simple solution is to transform some of the walls into pillars.

like this:

xenopilars.th.jpg

Uploaded with ImageShack.us

Make them X times more HPs than normal walls. Once one of these collapses it will bring down upper sections down with it and imediatly destroying any normal walls/tiles in its vicinity.

xenopilarsdestroyed.th.jpg

Uploaded with ImageShack.us

Add a new solid cube tile to represent them.

Any unit caught below or on top of the "cave in" would take damage according with the amount of debris that has fallen on top of the unit + the hight it has fallen (someone at the roof would take falling damage instead of crushing damage, someone in the 2nd floor of a 5 story high building would take both)

To avoid the building looking as it has been cut clean as a cake, after X tiles further from the destroyed pillar the tiles would have "diminishing returns" on destruction, stronger as closer to the next good pillar, and that math would be done bottom up ALWAYS. The level where the pillar was destroyed would be calculated 1st, and only "surviving" tiles on that level would allow the math to continue on upper levels counterparts. ASA you have a good tile being calculated, ALL the next ones from there to the next good pillar will have 100% chance of being ok (at the same lv ofc)

If a tile is destroyed by the math on the level "where the pillar collapsed" theres a 100% chance that any tile on top of that is destroyed also.

If a tile on the level where the pillar was destroyed survives allows for the diminishing returns math to apply on the tile above it, and so on.

Lets see if i can represent what i mean:

I = Good pillar

*= Destroyed pillar

H = good wall

_ = Destroyed wall

IH______________* 5th floor

IHHH____________* 4th floor

IHHH____________* 3rd floor

IHHHH___________* 2nd floor

IHHHH___________* 1st floor

IHHHHH__________* (level where the pillar was destroyed)

That will create the "V" shape u are looking for i think.

Edited by Aelius
Link to comment
Share on other sites

Can you classify the floor-tilesections inside rooms as wall tiles without them being walls? I had to draw this to find the logic.

But its just like you said. The V shape comes up as the most logical tile collapse mechanic.

Seems the easiest way to logically make this to work is to say that each tile that is not next to a tile connected to a wall section should collapse. But the only problem is, there is a bunch of them in the middle of the room witch has no connecting wall next to them.

Rough sketch using symbols where X represents destroyed wall, and O a collapsed floor tile on a two story building seen from the sky:

._ XXXXX _ _

|##OOO###|

|###O####|

|########|

Hope my useless, uneducated attempt was any help :)

Edited by Lobster Man Commander
Link to comment
Share on other sites

I mostly want to avoid designating things as pillars if it can be avoided, as it's more work when each building is constructed and the resulting behaviour isn't always fully predictable. It'd be much better to have a formulae that can automatically calculate whether a floor tile should be destroyed based on whatever wall tiles below it have been destroyed.

I kinda know what behaviours I want, but I can't seem to put them into a working formula...

Link to comment
Share on other sites

I mostly want to avoid designating things as pillars if it can be avoided, as it's more work when each building is constructed and the resulting behaviour isn't always fully predictable. It'd be much better to have a formulae that can automatically calculate whether a floor tile should be destroyed based on whatever wall tiles below it have been destroyed.

I kinda know what behaviours I want, but I can't seem to put them into a working formula...

In that case you can add a pounds per square formula. Each wall is able to withstand X amounts of pounds. So just give a value in pounds to each tile.

When a wall is destroyed any tile pounds above it will be transfered to adjacent walls, up to the breaking point where everything above comes crumbling down until walls that are left are able to sustain the weight again.

oh and btw Chris, predictability is not always a good thing. When a building collapses is almost impossible to predict what will fall and what will remain standing. In a game unpredictability more often adds to gameplay than the other way around

Edited by Aelius
Link to comment
Share on other sites

But losing half your prise squad to randomly collapsing buildings isn't fun...

Chris, the only way I can see it working is in 2 stages.

Firstly all floor tiles are connected to their adjacent floor tiles. They will then fail when the adjacent one (or ones) in any direction have taken enough damage.

However this HAS to work in conjunction with the wall tiles, and that is the second part. So the floor tiles that come into contact with wall tiles take cues from the wall as well as adjacent floor tiles.

This allows walls to be shot, and when enough of that has happened, adjacent floor tiles will do the same. However just because one floor tile has failed does not mean they all will, as the other floor tiles surrounding the failed one all have more adjacent tiles etc. to hold them up.Now you just need to work out what the breaking point is for floor tiles, and how much damage carries over to adjacent floor tiles when the first fails...

Link to comment
Share on other sites

Do you want to have a chance to collapse the walls on the ground floor as well? I wasn't sure from your post.

A suggestion off the top of my head: I would have a recursive function calculating a chance for a floor tile to fall where at least 1 'support' is missing (support meaning either wall or other floor tile).

Pseudo code (Java):

floorCollapse(Tile t) { int collapseChance = Random value (%, so from 0-100); int collapsedSupports = number of collapsed supports; if(collapseChance <= (collapsedSupports*4)) {   collapse tile;   for each adjacent tile {     floorCollapse(Adjacent tile);   } }}

Hope that makes sense, it is not a final solution obviously, in its current form it has the potential to create a huge hole with a single wall destroyed (and one might have to fiddle with some details if you want a greater chance of creating a wedge rather than a hole that spreads evenly in all directions). Also, it isn't currently taking into account your basic assumption of "a floor tile on the edge of a building with any wall tile in an adjacent tile on the level below, would remain standing".

Of course, it might end up checking some tiles several times, but on the other hand if you only check a tile once and more tiles around it collapses, it needs to be checked again.

I also like Aelius' suggestion of having a weight that is distributed to the walls.

Link to comment
Share on other sites

A somewhat pointless question: Will building collapses leave heaps of rubble scattered about in their wake? Or will the Stuff That Edifices Are Made Of simply be annihilated and the tiles affected by the fallout be switched to their damaged or destroyed variants?

Edited by iamkyon
Enhanced comprehensibility.
Link to comment
Share on other sites

But losing half your prise squad to randomly collapsing buildings isn't fun...

This makes the game a bit more interesting IMO, now you can collape a building with aliens in it hoping to kill them. but this can spell death if the aliens to the same to your squad.

overall I love the idea!

Link to comment
Share on other sites

The simplest algorithm which may create the behavior you want is to have it have each tile calculate a resiliency value. If that value is below a certain point then the tile will collapse. Let the resiliency value be the count of adjacent tiles plus the number of walls which have a corner touching the tile times a certain value (let's say 2). If this sum is less than a certain value (lets say 6) then the tile would "collapse". You could play around with the relative values until you found something you liked. The nice thing about this approach would be that if the tiles and walls are object oriented than this could be a property of each tile which is updated as nearby tiles are damaged. If the tile has already been "damaged" by being shot up this could easily have some effect on the property which could lead to further collapsing. The same thing could be said for fire damage.

A similar mechanism could be used on the Z axis for walls that are stacked upon one another.

Link to comment
Share on other sites

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!

What should work:

Pass 1:

Check all wall tiles starting with ground floor +1.

If a wall tile has any undestroyed wall tile within 1-2 tiles on the floor below, it remains standing.

Whether 1 or 2 tiles work best there depends on how fragile you want your buildings.

If you somehow figure merely damaged wall tiles into this then you will have to deal with cases where wall tiles above an undestroyed but damaged section crumbles.

Pass 2:

Check each floor tile of a level.

If 4+ adjacent tiles are destroyed (either wall or floor), the tile crumbles.

Destroyed wall tiles count 2x for that.

Damaged (not destroyed) floor tiles count for 0,5.

Repeat Pass2 until no more floor tiles crumble.

That avoids long sticking out "bridges" of floor tiles remaining standing but leaves those intact that have a clean horizontal or diagonal connection.

Punching a few holes into an intact floor doesn't bring it down.

That the wall tiles count double in pass 2 forces some erosion of floor tiles close to walls.

To totally collapse a floor you need to work harder.

That damaged floor tiles count for 1/2 means that if you damage a large area of floor, the center tiles (surrounded by 8 damaged tiles) will fall down.

Slightly increase the 0,5 (to 0,6 or 0,7 tops) if you want to see that effect more often.

Yes, it is pretty simplistic but it's easy for every player to figure out why it happened.

Walls crumble in a pyramid shape,

floors crumble if they cannot "span" in a straight line between two intact walls.

It's a completely generic and predictable system, which doesn't require any fancy material properties.

Randomisation:

Below, some have posted their idea of introducing randomness.

I don't really like any of them because they are either complex, requiring wholly new material properties, or lead to hard to control sequences of destruction, which could all too easily turn runaway and destroy an entire floor for no visible reason.

My approach:

On creation of the level, flag a few wall + floor tiles (maybe 5 % ?) as "invisibly destroyed" - only for purposes of collapsing.

With an otherwise healthy building, this will not cause any damage all by itself.

Once a building takes damage, those "weak spots" will nudge the domino effect along but there is no chance that a few missing tiles will topple an entire floor.

I'm not convinced that this is entirely necessary but if you want randomness, this is a controllable way to to it. If there's something you absolutely don't want then this is entire buildings crashing down from the first hit due to some freak hit points / structural stability combination.

Visualisation:

You could even show the collapse.

The proposed system leads to a domino effect where the tile destruction / collapse can be animated in the exact order it is calculated in.

Walls come down, floor tiles break off and fall down, starting from the "weak spots", until only the stable tiles remain standing.

The best features are usually 90% show and 10% code. =P

Where's Gazz when you need him?

Actually, yesterday I was busy sweet-talking another developer into implementing a cool feature, close deadline or no. =P

Edited by Gazz
Link to comment
Share on other sites

You could even show the collapse.

The proposed system leads to a domino effect where the tile destruction / collapse can be animated in the exact order it is calculated in.

Walls come down, floor tiles break off and fall down, starting from the "weak spots", until only the stable tiles remain standing.

^^ Epic. Two thumbs up for that idea. ^^

I like where Gazz is going, although I want more possibilities for unpredictable behavior-- collapsing buildings are totally chaotic and with the right framework we can make it more intuitive and even more fun. So, some quick thoughts:

Remaining HP affects support strength:

It feels intuitive that causing additional damage should make structures more likely to collapse, even if no tiles are immediately destroyed.
Weight the floor-supporting value (Gazz's Pass 2) contributed by damaged tiles based on the % of tile HP remaining. Damaged tiles at full HP counting as 0.75 supporting tiles, linear reduction down to 0 support at 0 HP.

Randomize Collapse Patterns:

Obvious artificial patterns are distracting, the results will look a lot better if we add some noise.
Assign a random strength modifier for collapse purposes to each tile at map start that directly raises/lowers that tile's support requirements. +/- 20% is probably a good place to start tweaking.

Delayed collapses for unstable areas:

Randomized tile modifiers can also give a framework for delayed collapses in an intuitive way-- once the dust has settled, it's probably safe.
At the end of each turn, re-roll the random modifiers for all tiles that are within 2 tiles of dense smoke/dust or fire, apply fire damage, then run a collapse cycle. Boom! Delayed collapses!

Weight and Instability:

Heavy objects put more stress on damaged floors.
Tiles with objects sitting on them should receive a negative modifier for collapse purposes. Quick and dirty option: weighted modifier based on the cover value of the object.

People and vehicles:

People are heavy too.
Each time a unit steps onto a tile, run a check with an additional weight modifier to see if the floor is likely to collapse. Critical fail above a certain threshold = instant collapse cycle, normal fail plays a creaking noise, interrupts Player's movement, and pops a dust/smoke burst-- sets timer to collapse that tile and run a collapse cycle after triggering unit has moved X more tiles? Likely to be especially useful when large/heavy aliens are implemented.
Link to comment
Share on other sites

Here is a variation of the pounds per tile idea merged with the above poster's reduced strength for reduced HP method.

First of all each wall and floor would be assigned a weight (might vary for different tilesets). Load capacity would be equal to HP. If a soldier or a tank (hovertanks are excluded) is on top of the tileset it will add to the weight of the floor.

Collapsing would occur when the combined load limit of the adjacent tiles and adjacent lower walls can no longer support the weight of the object.

For the sake of illustration I'll start tossing out numbers.

Walls: 200HP and 250 weight

Floors: 100HP and 200 weight

If a tile is damaged or destroyed the game will check the walls and floors the 8 adjacent tiles to see if they have enough HP worth of supporting objects nearby to prevent collapse.

Link to comment
Share on other sites

Similar to the system Gazz suggested you could give each tile a percentage chance of falling depending on how many missing sections it has around it.

Walls below the tiles level could still count double to represent their importance.

That should make every collapse look more individual and a little less predictable.

Wall sections (level 1) that are destroyed could have around a 75% chance of the section directly above (level 2) coming down and if that one does then a 50% chance of the ones either side (level 2) also dropping.

Floor tiles that are adjacent to a destroyed wall would have a 50% chance of falling.

Missing floor tiles could give a 25% fall chance to any tile north, south east or west and around a 15% chance to ne, nw, se and sw tiles.

This would stack depending on how many were missing, more missing support, higher chance of falling.

That is enough to make sure a tile always falls when the four immediately supporting tiles are missing but may sometimes survive otherwise.

Tying a weight system in would just be a matter of adding percentages when something passed over.

No idea how much that would slow down the engine though if it needs to check that often.

All of those numbers are rough off the top of my head and could be changed either way.

Edited by Gauddlike
Link to comment
Share on other sites

Just a quick piccy to show what I was thinking about and the way it could propagate.

attachment.php?attachmentid=144&d=1321179542

This fall check can be done whenever a model moves onto a tile with anything above a 0% fall chance.

Heavier armour or larger aliens/vehicles can add their own fall chance to the check.

Not sure these sorts of ideas were what Chris was looking for as it doesn't actually provide him with a formula.

Edited by Gauddlike
Link to comment
Share on other sites

This makes the game a bit more interesting IMO, now you can collape a building with aliens in it hoping to kill them. but this can spell death if the aliens to the same to your squad.

overall I love the idea!

I like the idea of it, I dislike the idea of it being too random. Knowing that an explosion might bring down the room one man is in, that's fine. But that same explosion RANDOMLY bringing down the entire structure, including two other guys on the opposite side of the building, not cool.

All this talk about how buildings collapse being random. Why do people think this? I am sure there is a very good explanation for this with physics, and that it's not random at all...

Oh and I like Gazz' idea. Didn't actually read it through and through, but I've read enough of his in the past to know it'll be solid =]

Link to comment
Share on other sites

Gauddlike, I'm afraid your link is broken.

I'm of the same opinion as the last four-ish posters: introducing an element of randomness, however slight, to the formula could give rise to all manner of excitement and hilarity.

Edited by iamkyon
Make it four... ish.
Link to comment
Share on other sites

I'm not convinced that having a great deal of randomness in the process is such a good idea.

I feel that some of the proposed ideas would be very hard to control.

Didn't do the math, though. If you suggest an intricate feature, you do that and provide examples for the likely good/bad cases!

I added my own approach to my post above.

A way to include some randomness without the danger of it "going rogue" and entire buildings collapsing for no discernable reason.

Link to comment
Share on other sites

Actually shooting out a supporting wall is a pretty good reason for things to collapse.

Ok so small arms fire shouldn't bring down a farmhouse.

The problem is that if you start taking out walls with anything then sooner or later it is going to cause things to fall off.

The numbers I gave were probably a little high but as I said, just random rounded figures off the top of my head.

With that model there is definitely a small chance of a random shot taking a chunk out of the structure.

There is also a good chance of a rocket barely making a dent beyond the initially destroyed tiles.

Adding constraints to how much CAN collapse may well make sense.

The numbers should be tweaked but it is hard to do without actually seeing how the effect works in game.

*edit* Fixed the link in my previous post as well, cheers.

Link to comment
Share on other sites

  • 1 month later...
I like the idea of it, I dislike the idea of it being too random. Knowing that an explosion might bring down the room one man is in, that's fine. But that same explosion RANDOMLY bringing down the entire structure, including two other guys on the opposite side of the building, not cool.

All this talk about how buildings collapse being random. Why do people think this? I am sure there is a very good explanation for this with physics, and that it's not random at all...

Oh and I like Gazz' idea. Didn't actually read it through and through, but I've read enough of his in the past to know it'll be solid =]

Well, what you need is controlled randomness. Sure, one rocket won't bring down a whole warehouse, but it could just bust the walls it hits, or it could chain to 10 squares of wall and a few of floor or it could take out the entire room.

I guess the mathematical formula you want is basically including several rules.

1) A floor tile with no supports falls. I think for aesthetics, diagonals shouldn't count as support. It would be odd to have a square of floor hanging by a corner.

2) a floor tile with an intact wall does not fall.

3) a floor tile supported on 2 sides (not counting diagonals) does not fall.

Then you need some sort of probability map. The closer a floor tile is to a removed wall the higher the % chance of falling.

So, on level initialisation all floors have a 0% chance of falling.

Then, as soon as a wall is removed the chance of falling is set. That way you can set up a big building that has huge floors and no pillars, but if any wall is removed it instantly becomes fragile. Seems a bit unrealistic though, since you'd get a warehouse collapsing as soon as one wall tile was removed.

So... we need to calculate on a wall stretch e.g. the North Wall.

a) % of wall stretch removed - removing 2 wall segments does nothing, removing 50% does a lot

b) "quality" of the damage. Removing 10 tiles in one chunk does more than shooting out 10 tiles spaced evenly.

That then scales - destroying 3 chunks of a large building does nothing, but taking out the wall of a garden shed causes instant total collapse.

so

P(fall) = % of walls destroyed / (distance from destroyed segment * k) + (% supporting floors already fallen - 25%) + damage + load modifier + Rand(-20 to +20)

So, floor can fall if

1) Directly damaged

2) all four surrounding pieces destroyed

3) Nearby walls are destroyed - "nearby" defined by k, scale for buildings? k <1 causes greater chaining, k>1

4) Random 20% chance either way.

General gist is an undamaged tile will never fall, a damaged tile may fall especially if loaded and a nearby wall is taken out.

<edit 2>

Actually, better and simpler is

P(fall) = % of walls destroyed * straight line distance from intact wall* k * adjoing floors already fallen * damage * load * random(0.8-1.2)

Balance the variables right and you should get cool stuff like

WXX#

W###

WWXXX

(W = Wall, # = floor, X = collapse)

stays standing until a person tries to step on it, then it falls but absurd strucures like

WXXXXXXX#

WXXXXXXX#

WXXXXXXX#

W#######

WXXXXXXXX

never happen

Lots of multiplys, which can be costly in performance especially when we are looking at a large multifloor building.

You then need a second formula for upper wall segments I guess, simply:

P(wall fall) = 33% * # of below walls fallen. ie.

Side view:

####A####

###BBB####

Take out all 3 Bs and A will fall. Take out 1 and it might fall. Perhaps weight it some, so middle B gives 50% fall chance and edge B only 25%

<edit 3>

Theres also some possibilities on how this is applied. Obviously if every tile is checked every turn, its going to be slow and also one rocket will eventually take out every building piece by piece. So either it needs to be a one off check on a rocket explosion or perhaps after each explosion a building is unstable for 3 turns and after that will not collapse any more.

Edited by Phishfood
added a variable
Link to comment
Share on other sites

  • 3 weeks later...

So I spent a few hours working this out. My idea was to keep this as simple as possible while retaining the behaviour needed. That is simple rules that produce fairly realistic structural integrity.

So, the basics of the idea are that Walls are on the edges of tiles and provide support and that floor tiles require support to remain in position.

Heres the rules that i've come up with the produce the behaviour pretty well.

A wall has a Strength value of 1 and a range value of 2.

A floor tile requires 2 strength provided by walls to remain supported.

If a floor tile is surrounded by floor tiles with a combined strength value of 4 or more that tile is considered supported.

A floor tile can transfer excess strength up to one tile away. In essence a floor tile with a strength 4 and a nearby tile of strength 0 it will transfer that 2 strength to that tile. Strength can only be transfered once and the remaining strength cannot be less than 2. Transferred strength can "push" strength onto another tile in a linear direction no further than 3 tiles in any direction.

Imagine a Line of tiles named A, B, C, D, E with the strength value of 4,3,1,0,0 in a line.

A=4 B=3 C=1 D=0 E=0

Tile A Pushes 2 Str into B which pushes 2 Str into C which pushes 1 Str into D.

A=2 B=3 C=2 D=1 E=0

Since we're assuming D and E have no surrouding tiles providing support they have insuficient support to remain supported and collapse.

The Strength that was pushed through C returns to C.

We're left with. A=2 B=3 C=3 D=Collapsed E=Collapsed

I'll try to illustrate my concept in stages. It interacts kinda weird but produces the results I think you're looking for and is easily tweaked and adjusted. This is the rough concept that I will be refining when I can.

http://i.imgur.com/cKmzJ.png

This image depicts a three by three grid of floor tiles on Z level 1(floor 1), surrounded by walls on Z level 0(ground).

This explains the idea of range. Each wall can provide direct support for a tile floor above it extending two tiles.

Each wall connecting to a piece of floor adds 1 strength. Here is the best illustration of this using the previous example I could manage.

http://i.imgur.com/ESUxf.png

The red lines depict the range of each of the walls. The black squares and numbers depict the strength value of each floor tile.

Hopefully as I show you more examples it will become more clear.

http://i.imgur.com/rOt9M.png

Here is a 5x5 grid surrounded by walls. Since everything is supported or has a total surrounding value around it higher than 4, everything is considered stable and supported.

What happens when we remove an entire wall?

http://i.imgur.com/OVUxW.png

As you can see, the entire south wall has been removed. Thus the four tiles with exclamation points are in danger of falling as their strength is lower than 2 AND there is not a total value of 4 strength surrounding them. The logic detects this and attempts to even out the values if it can underneath the rules above.

The logic prefers the closest possible tile to take strength from. Strength cannot be transfered over a distance larger than 3 tiles. This helps prevent tile strength coming from extreme distances. And helps explain why strength is not taken from more distant parts of the building.

We end up with something like this. A tile has collapsed.

http://i.imgur.com/wrEEL.png

If we remove another wall the effect becomes even more pronounced. I'll do a series of images of pieces being removed.

http://i.imgur.com/LPnzL.png

More strength is moved around sadly the algorithm can't find a way to support the two bottom tiles, so they are destroyed.

http://i.imgur.com/u7H4f.png

What if the piece of wall two tiles up from the tile we just hit gets destroyed? Lets find out!

http://i.imgur.com/Zcauz.png

Nothing collapses, but the building is weakened. What if we pop the wall just above that?

http://i.imgur.com/slz9z.png

Uh oh, we got three tiles that can't get the support they need. They fall out.

http://i.imgur.com/l3wo7.png

Double Uh oh! Now that wall that was holding everything together has no way to get its support to the other tiles. A chain reaction occurs.

http://i.imgur.com/HPB3N.png

Hopefully that illustrates the basic idea. Complex behavior is emerging from relatively simple rules. I know I might have made a mistake here or there but this is a fairly rough draft and Its 1 A.M. and I've been working on this idea for about six hours. Making this post took about 2 trying to explain the basics and I know I left some out. Its semi untested on larger more complex less square buildings or buildings with inner walls. I can imagine it limits the size of buildings somewhat but the numbers and ranges can be adjusted. So far the idea works for what you need even in the very infantile state. It seems simple and straightforward to me.

Link to comment
Share on other sites

Imagine a Line of tiles named A, B, C, D, E with the strength value of 4,3,1,0,0 in a line.

A=4 B=3 C=1 D=0 E=0

Tile A Pushes 2 Str into B which pushes 2 Str into C which pushes 1 Str into D.

A=2 B=3 C=2 D=1 E=0

Since we're assuming D and E have no surrouding tiles providing support they have insuficient support to remain supported and collapse.

The Strength that was pushed through C returns to C.

We're left with. A=2 B=3 C=3 D=Collapsed E=Collapsed

If A loses 1 point of strenght does that one fall down then or retract it's strenght to keep itself supported? Will it then steal from C or from B?

Edit: also in your example you have forgotten to strenghten the second topmost middle tile that is very savable. the tile under that might ven be saved with a bit of strenght shunting around while its still only the bottom wall thats been damaged. that rearrangeing will unfortunately cause trouble when you remove the wall at the bottom left.

Edit: I realie i may have ignored the "adjacent tiles combined 4 strenght" rule. but still what is preventing the tiles at the top from shifting around integrity strenght and causing problems when they realigne due to new circumstances? If the algorith is going to be as intelligent as you want it to be, wouldnt it have to try to equalize the tiles strenght preemptivly?

Edited by Gorlom
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...