Very simple block physics
I have been toying with the idea of a very simple physics system for block games like Minetest. Unfortunately I won't have much time to do anything with it, so I thought I would post it here in case anyone thinks its a good idea and wants to try it.
This physics system would allow for simple interactions between blocks based on forces in up to 6 directions (one for each block face). It would allow you to determine whether a block is under too much stress and should break or fall down. I think that it would end up being close enough to people's intuition about how heavy blocks should behave that it would be pretty fun building with the risk of everything collapsing. If it was incorporated into the game (some day) then it might serve as a good way to distinguish the game mechanics from that of other similar games (like Minecraft).
Each block would have four different properties: weight, compressive strength, tensile strength, and shear strength. If a block is completely unsupported then it would fall like sand currently does. Otherwise a block could be supported by other blocks sharing faces with it based on one or more of its strengths. Each strength applies to a force coming from a particular direction:
* Compressive strength would support a block if it has a connection in the direction with the force. For example: the blocks of a pillar would exert a downward force on the blocks at the base of the pillar. If their compressive strength is great enough for the weight of the pillar, then they will not break.
* Tensile strength would support a block if it has a connection in the direction opposite of the force. For example: a chandelier hanging from a ceiling would pull on the block it is hanging from. If the tensile strength of that block is great enough, then it will not break and fall.
* Shear strength would support a block if it has one or more connections in the directions perpendicular to the force. For example: a block in a beam supporting a tunnel ceiling would support the ceiling (downward force) by its horizontal connections to other beam blocks. If the compressive strength of that block is great enough then it will not cave in.
If a force exceeds the sum of all three strengths for a given block, then it will break. This could mean a couple of different things, so tinkering with it might be necessary to get the best results. A breaking block could just become a Minecraft-style dropped block, but this is kind of boring and so something more complex might be better. An alternative is for the block to move in the direction of the force if it is able, or fall downward if it is not, or move into an adjacent space if it is not able to do either of those.
Also, when a block moves from having exceeded its total strength, for the first instant that it moves to that area it would not be supported by anything unless other blocks moved with it at the same time due to the same force. This would prevent a falling structure from suddenly being supported by something it brushed up against while moving. A further improvement to structural collapse could be done by making breaking blocks give a small and sudden spike in force so that poorly supported blocks nearby (such as on the same structure) would also collapse.
If the block does not break, then the forces would be transferred to the blocks that are supporting it. This would allow, for example, a thick ceiling to cave in if you put too many heavy blocks on your roof. Of course, there would need to be some limits on force transfers, or it would lag. Forces could only be recalculated when a block is placed or removed. The forces could also be only calculated for an expanding Manhattan distance so that forces do not have looping transfers (I am not sure what effect this would have on the realism of the physics, though). Forces could also gradually diminish as distance increases, which would prevent forces from accumulating in your calculations. This would also prevent the entire world from falling down due to it not having an actual bottom supporting it. The number of blocks a force would act through could be tuned and even set on a server by server basis. I think that even if the force diminishes after just a couple blocks it would still add a cool level of realism to building.
Non-block entities (like players) could also have a weight, which would allow them to cause the collapse of unstable structures by walking on them. There could also be other sources of forces, like pistons and explosives and water and things like that, which could add an interesting layer of complexity to the game. You could even have special blocks that experience an upward force (like a negative weight), or even a sideways one. If you were building a structure out of blocks with a negative weight, you would have to support it in the opposite direction compared to normal blocks, leading to a sort of upside-down building style. If negative weight blocks were to collapse, it would have disastrous consequences, since your entire building would fall upward into the sky (up to some limit). You could probably base a lot of even weirder things on this sort of system if you wanted to.
This physics system would allow for simple interactions between blocks based on forces in up to 6 directions (one for each block face). It would allow you to determine whether a block is under too much stress and should break or fall down. I think that it would end up being close enough to people's intuition about how heavy blocks should behave that it would be pretty fun building with the risk of everything collapsing. If it was incorporated into the game (some day) then it might serve as a good way to distinguish the game mechanics from that of other similar games (like Minecraft).
Each block would have four different properties: weight, compressive strength, tensile strength, and shear strength. If a block is completely unsupported then it would fall like sand currently does. Otherwise a block could be supported by other blocks sharing faces with it based on one or more of its strengths. Each strength applies to a force coming from a particular direction:
* Compressive strength would support a block if it has a connection in the direction with the force. For example: the blocks of a pillar would exert a downward force on the blocks at the base of the pillar. If their compressive strength is great enough for the weight of the pillar, then they will not break.
* Tensile strength would support a block if it has a connection in the direction opposite of the force. For example: a chandelier hanging from a ceiling would pull on the block it is hanging from. If the tensile strength of that block is great enough, then it will not break and fall.
* Shear strength would support a block if it has one or more connections in the directions perpendicular to the force. For example: a block in a beam supporting a tunnel ceiling would support the ceiling (downward force) by its horizontal connections to other beam blocks. If the compressive strength of that block is great enough then it will not cave in.
If a force exceeds the sum of all three strengths for a given block, then it will break. This could mean a couple of different things, so tinkering with it might be necessary to get the best results. A breaking block could just become a Minecraft-style dropped block, but this is kind of boring and so something more complex might be better. An alternative is for the block to move in the direction of the force if it is able, or fall downward if it is not, or move into an adjacent space if it is not able to do either of those.
Also, when a block moves from having exceeded its total strength, for the first instant that it moves to that area it would not be supported by anything unless other blocks moved with it at the same time due to the same force. This would prevent a falling structure from suddenly being supported by something it brushed up against while moving. A further improvement to structural collapse could be done by making breaking blocks give a small and sudden spike in force so that poorly supported blocks nearby (such as on the same structure) would also collapse.
If the block does not break, then the forces would be transferred to the blocks that are supporting it. This would allow, for example, a thick ceiling to cave in if you put too many heavy blocks on your roof. Of course, there would need to be some limits on force transfers, or it would lag. Forces could only be recalculated when a block is placed or removed. The forces could also be only calculated for an expanding Manhattan distance so that forces do not have looping transfers (I am not sure what effect this would have on the realism of the physics, though). Forces could also gradually diminish as distance increases, which would prevent forces from accumulating in your calculations. This would also prevent the entire world from falling down due to it not having an actual bottom supporting it. The number of blocks a force would act through could be tuned and even set on a server by server basis. I think that even if the force diminishes after just a couple blocks it would still add a cool level of realism to building.
Non-block entities (like players) could also have a weight, which would allow them to cause the collapse of unstable structures by walking on them. There could also be other sources of forces, like pistons and explosives and water and things like that, which could add an interesting layer of complexity to the game. You could even have special blocks that experience an upward force (like a negative weight), or even a sideways one. If you were building a structure out of blocks with a negative weight, you would have to support it in the opposite direction compared to normal blocks, leading to a sort of upside-down building style. If negative weight blocks were to collapse, it would have disastrous consequences, since your entire building would fall upward into the sky (up to some limit). You could probably base a lot of even weirder things on this sort of system if you wanted to.