Jump to content

PotatoMcWhiskey

Members
  • Posts

    5
  • Joined

  • Last visited

Posts posted by PotatoMcWhiskey

  1. 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?

    Everytime a change occurs in the structure the stats are recalculated.

    So let us say A=4 B=3 C=1 D=0 E=0 again.

    In the previous example A shifts 2 strength to B so that we are left with.

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

    Then the strength is pushed through B into C etc leaving us with. A=2 B=3 C=2 D=1 E=0

    D and E collapse and the structure returns to stand by. When a piece of the building is damaged again, lets say only A is reduced by 1.

    A=3 B=3 C=1

    D and E are already gone. A can only push 1 strength through B into C but it is enough to save it all. Leaving us with A =2 B=3 C=2.

    Then the logic checks all these as "Stable" and wait until a tile in its group is changed or damaged.

    I will admit, its still very rough and it doesn't account for everything I want it to yet, but I can easily see how to expand it and allow for larger more complex buildings while retaining a believable structural integrity without it being too fragile or strong.

    The logic only decides to try and move strength around if a tile is considered unsupported. Then it tries to find the closest available strength to support it. If no strength is found under the rules then the tile collapse and the algorithm is run again until the building is stable. If everything is considered stable then the logic awaits damage to the structure to determine when to check if things are unsupported. Pre-emptively moving the strength around doesn't really make sense because theres no where for it to go. It only goes where it is needed. And it goes to the closest place it is needed.

    I'm a budding programmer, so I'm really enjoying thought crafting this idea before I try and see if I can actually build it.

    I have the idea almost fully structured in my head, communicating that idea is another thing altogether.

  2. 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.

×
×
  • Create New...