[Mod] simple block physics [block_physics][WIP][2.2]

Swablu
Member
Posts: 18
Joined: Sun Dec 18, 2016 18:44
GitHub: LHolten
In-game: hytak

[Mod] simple block physics [block_physics][WIP][2.2]

by Swablu » Post

Simple Block Physics
Info
This mod adds very very simple block physics to minetest.
Some inspiration came from this post: viewtopic.php?id=3032 credits to Fiberous
The mod only affects humanmade blocks that don't use there param2.
It uses the param2 variable of the affected blocks to store the weight they can hold.

Gifs
+ Spoiler
Long explenation about the physics
The affected blocks are all cobble blocks, all brick blocks and all full blocks (like diamond_block)
These blocks have four properties: shear strenght, tensile strenght, compressive strenght and weight.
When a block is updated (by punching, placing or digging or TNT)
This block will use its values for its strenghts to calculate the amount of support it has from the surrounding blocks.
Then its param2 value will be updated to be the amount of mass that the block can still hold.
This update will spread throught the neightbouring blocks and all unsupported blocks will fall down.

Also there is the param1 value for the amount of overhang. I should really documentate this somewhere :P
+ Spoiler
Why would i use this?
It's an extra challenge while you build a house!
The different materials have different properties, this makes for some more interesting building
Arches are stronger than 90 degree angles, thick pilars reach higher.

Why shouldn't i use this on an existing world?
This mod uses the param2 of all affected blocks.
Param2 defaults to 0 which means there is no support.
When you build your buildings with the mod enable, it will work as intended.

Build tips
  • If a node is connected from to opposite sides, it is considered stronger.
    More of these double connections make the node even stronger.
  • This means that building a bridge will propably require some kind of temporary scaffolding.
  • Different materials have different qualities.:
    You could use stone as a base and wood for higher walls and overhangs.
  • Arches are pretty good too.
  • Just experimentate!
Download
Use at an existing world at your own risk: all buildings will collapse!
The mod can be downloaded here: https://github.com/LHolten/block_physics
Depends: default? and stairs?
License: GNU GPLv3

API
+ Spoiler
Log/Done
  • fix hanging blocks
  • fixed blocks not falling in water, lava and fire
  • use something different from abm to get rid of the lag: minetest.after
  • fix diagonal falling blocks bug
  • add support for TNT back
Todo
  • fix attached node removal
  • add physics for natural nodes
  • falling node double check or something
  • add group for delay
Mmaybe somwhere in the future
  • add a more realistic destructive option
All suggestions are welkom
Last edited by Swablu on Thu Feb 02, 2017 16:47, edited 18 times in total.

User avatar
DS-minetest
Member
Posts: 1137
Joined: Thu Jun 19, 2014 19:49
GitHub: Desour
IRC: DS-minetest
In-game: DS
Location: I'm scared that if this is too exact, I will be unable to use my keyboard.

Re: [Mod] simple block physics [block_physics]

by DS-minetest » Post

the mod would be nice but it causes massive lags
Note that I've recently renamed myself on github and co. to "Desour". (I'm bad at naming things.)
Feel free to call me DS.

Swablu
Member
Posts: 18
Joined: Sun Dec 18, 2016 18:44
GitHub: LHolten
In-game: hytak

Re: [Mod] simple block physics [block_physics]

by Swablu » Post

Thanks for the response,
I know it causes lag, but it is still fun to play with.
If someone knows a way to fix this, please send me a message.

User avatar
Andrey01
Member
Posts: 2371
Joined: Wed Oct 19, 2016 15:18
GitHub: Andrey2470T
In-game: Andrey01
Location: Russia, Moscow

Re: [Mod] simple block physics [block_physics]

by Andrey01 » Post

Nice! It looks like really

Swablu
Member
Posts: 18
Joined: Sun Dec 18, 2016 18:44
GitHub: LHolten
In-game: hytak

Re: [Mod] simple block physics [block_physics][No Lag!]

by Swablu » Post

I updated the mod to only update blocks that are touched.
This should greatly reduce lag.

User avatar
Wuzzy
Member
Posts: 3938
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

Re: [Mod] simple block physics [block_physics][No Lag!]

by Wuzzy » Post

Do you care to actually explain the “simple block physics”? ;-)

It it only triggered by TNT as suggested by the GIFs? What are the rules?
My creations. I gladly accept bitcoins: 17fsUywHxeMHKG41UFfu34F1rAxZcrVoqH

Swablu
Member
Posts: 18
Joined: Sun Dec 18, 2016 18:44
GitHub: LHolten
In-game: hytak

Re: [Mod] simple block physics [block_physics][No Lag!]

by Swablu » Post

I have tried to explain the physics as well as i can,
Hope everyone understands it.

As of the last update the physics are only trigerred by building and digging and not by TNT. :)
Support for this is on my todo list

User avatar
mahmutelmas06
Member
Posts: 367
Joined: Mon Mar 02, 2015 13:10
GitHub: mahmutelmas06
IRC: mahmutelmas06
In-game: masum

Re: [Mod] simple block physics [block_physics][No Lag!]

by mahmutelmas06 » Post

I think nodes should collapse if there is no block connected touching to ground. Otherwise we cannot build a bridge :)
My Mods:

Beverage

User avatar
Wuzzy
Member
Posts: 3938
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

Re: [Mod] simple block physics [block_physics][No Lag!]

by Wuzzy » Post

Ohhhhhh! Now I understand this mod.
Wow! I am quite impressed by the idea alone. Very innovative. It completely turns the entire building aspect of Minetest on the head. This opens totally new possibilities for interesting new subgames.
Building is completely different and more challenging than the default. I definitely need to put this mod on my watch list. :-)

I still did not understand the meaning of the 4 values (tensile, weight, etc.). I do understand now that the blocks have to be attached in a special way. I know kinda how it works, but I am not sure about the exact physics.

I think the current blocks you modified for Minetest Game are not modified rigourously enough. Because there are many blocks which don't have physics at all, meaning they can freely float in air. For example, leaves. This means, if you have leaves, you can entirely circumvent the whole challenge of this mod because the physics rule doesn't apply to them, so you can use leaves to build any building, bridge, etc. with ease.
On the other hand, maybe Minetest Game is just not “ready” for a mod like this. ;-)

I think this mod can only be used most efficiently if an entire subgame follows the new paradigm of block physics and is balanced to it, not just for a few selected blocks. But I am pretty sure subgames will will go all the way of block physics could be very interesting to play. :-)

I think this mod should be generalized and definitely not hard-depend on Minetest Game. Because this is far too fundamental a game concept to be limited to Minetest Game only. Try to make that dependency optional. This will make integration into other subgames easier.

Introducing an API would be nice. Or is it all done with groups only? In that case, please specify the exact meaning of all groups and their ratings in some readme file. So that other mods can easily build upon this mod.

Then, I have a question: Could this mod maybe be used to prevent the infamous noob-poling (getting to high places quick just by stacking blocks vertically and jumping)? That would be awesome! If yes, how could it be done?

Another question: I noticed that there is often a delay after blocks lose their stability before they fall. Is it possible that this delay varies per block? This would be interesting. If e.g. a bridge collapses, depending on the block type, you might have more or less time to “escape” the complete collapse. :-) Would an instant collapse (like for falling_node) be also possible?

I think I found a bug. I noticed that blocks sometimes seem to “slide off” other blocks. I have not fully understood the physics of that. However, there is one oddidy: It appears that it is also possible for blocks to “slide off” if they should have logically been blocked from doing so. Do you see this hole?

Image
Below the desert cobblestone there is lots of air, which is of course concealed. If you place a desert cobblestone into that hole, it will glide off into that air, which seems physically impossible. It's as if the block has gone diagonally through the blocks.

Here's how it looks below the desert cobblestone (the pointed node is the same node as in the 1st screenshot):
Image

I hope you understood the bug. It is not easy to reproduce since I still don't fully understand the physics.
My creations. I gladly accept bitcoins: 17fsUywHxeMHKG41UFfu34F1rAxZcrVoqH

User avatar
TumeniNodes
Member
Posts: 2853
Joined: Fri Feb 26, 2016 19:49
GitHub: TumeniNodes
IRC: tumeninodes
In-game: TumeniNodes
Location: in the dark recesses of the mind
Contact:

Re: [Mod] simple block physics [block_physics][No Lag!]

by TumeniNodes » Post

I'm assuming steel can take the most strain from weight?
This is really nice, I had mentioned something like this once, which would cause players to have to build structures in the same way as real life. Load bearing materials/walls will be needed.... Bridges will take more thought with this ; )

I like it, it's very cool. This is also a nice mod for teachers who use Minetest to add...

By the way, for those who dislike float islands and often spend time going around blowing them up.... this will probably eliminate them naturally :P (I think...) Seems like you would only need to punch one block on one and the rest would simply drop?
Ich mag keine grünen Eier und Schinken, ich mag sie nicht Sam I Am

User avatar
TheReaperKing
Member
Posts: 531
Joined: Sun Nov 22, 2015 21:36
Contact:

Re: [Mod] simple block physics [block_physics][No Lag!]

by TheReaperKing » Post

Tumen funny you say that, I've been looking for something like this for my students for a while. Now it will make them think more when they create their buildings :) Thanks for making this Swablu!
Become A Real Life Superhero - http://SuperheroHill.com
Project Lead of the Doom 3 Mod Last Man Standing - http://Doom3Coop.com
Project Lead of Platinum Arts Sandbox Free 3D Game Maker - http://SandboxGameMaker.com
Youtube Channel - https://www.youtube.com/user/PlatinumArtsKids

User avatar
DS-minetest
Member
Posts: 1137
Joined: Thu Jun 19, 2014 19:49
GitHub: Desour
IRC: DS-minetest
In-game: DS
Location: I'm scared that if this is too exact, I will be unable to use my keyboard.

Re: [Mod] simple block physics [block_physics][No Lag!]

by DS-minetest » Post

ok, now the lag is much less (as long as you dont dig)

there was a minecraft mod like this, i forgot the name
Note that I've recently renamed myself on github and co. to "Desour". (I'm bad at naming things.)
Feel free to call me DS.

Swablu
Member
Posts: 18
Joined: Sun Dec 18, 2016 18:44
GitHub: LHolten
In-game: hytak

Re: [Mod] simple block physics [block_physics][No Lag!]

by Swablu » Post

mahmutelmas06 wrote:I think nodes should collapse if there is no block connected touching to ground. Otherwise we cannot build a bridge :)
I don't know what you mean? You are propably using a node without physics
Wuzzy wrote:Wow! I am quite impressed by the idea alone. Very innovative. It completely turns the entire building aspect of Minetest on the head. This opens totally new possibilities for interesting new subgames.
Building is completely different and more challenging than the default. I definitely need to put this mod on my watch list. :-)
I am glad you like it, i was inspired by this http://www.minecraftforum.net/forums/ma ... hysics-mod minecraft mod and the post by fiberous linked in the main post. He explains what the three values for strenght are for.
Wuzzy wrote:I think the current blocks you modified for Minetest Game are not modified rigourously enough. Because there are many blocks which don't have physics at all, meaning they can freely float in air. For example, leaves. This means, if you have leaves, you can entirely circumvent the whole challenge of this mod because the physics rule doesn't apply to them, so you can use leaves to build any building, bridge, etc. with ease.
On the other hand, maybe Minetest Game is just not “ready” for a mod like this. ;-)
I agree that the blocks may not be modiefied rigorusly enough, but i think the natural blocks should not be affected, because then the whole world could collapse and there would not be a base for the other blocks to build on :D.
For leaves, you could dissable the piece of code that makes placed leaves not decay.
I think logs are more of a problem, because i use them a lot and they already use there param2.
Wuzzy wrote:I think this mod can only be used most efficiently if an entire subgame follows the new paradigm of block physics and is balanced to it, not just for a few selected blocks. But I am pretty sure subgames will will go all the way of block physics could be very interesting to play. :-)

I think this mod should be generalized and definitely not hard-depend on Minetest Game. Because this is far too fundamental a game concept to be limited to Minetest Game only. Try to make that dependency optional. This will make integration into other subgames easier.
Agreed!
Wuzzy wrote:Introducing an API would be nice. Or is it all done with groups only? In that case, please specify the exact meaning of all groups and their ratings in some readme file. So that other mods can easily build upon this mod.
At the moment it is all done with groups, but i may need to at some api functions for the TNT to work correctly.
Wuzzy wrote:Then, I have a question: Could this mod maybe be used to prevent the infamous noob-poling (getting to high places quick just by stacking blocks vertically and jumping)? That would be awesome! If yes, how could it be done?
probably :-) idk
Another question: I noticed that there is often a delay after blocks lose their stability before they fall. Is it possible that this delay varies per block? This would be interesting. If e.g. a bridge collapses, depending on the block type, you might have more or less time to “escape” the complete collapse. :-) Would an instant collapse (like for falling_node) be also possible?
yes this delay can be varied, it would require an aditional group, but hey why not?
I think I found a bug
You did, i know why this happens just need to fix it :-P
I'm assuming steel can take the most strain from weight?
This is really nice, I had mentioned something like this once, which would cause players to have to build structures in the same way as real life. Load bearing materials/walls will be needed.... Bridges will take more thought with this ; )
Thats the idea!
Tumen funny you say that, I've been looking for something like this for my students for a while. Now it will make them think more when they create their buildings :) Thanks for making this Swablu!
Keep in mined that this mod is still WIP.
It is a learning experience for me to!
ok, now the lag is much less (as long as you dont dig)
there was a minecraft mod like this, i forgot the name
i can't get rid of the lag when you dig, but the mod you are refering to is http://www.minecraftforum.net/forums/ma ... hysics-mod

User avatar
Wuzzy
Member
Posts: 3938
Joined: Mon Sep 24, 2012 15:01
GitHub: Wuzzy2
IRC: Wuzzy
In-game: Wuzzy

Re: [Mod] simple block physics [block_physics][No Lag!]

by Wuzzy » Post

Wuzzy wrote:Introducing an API would be nice. Or is it all done with groups only? In that case, please specify the exact meaning of all groups and their ratings in some readme file. So that other mods can easily build upon this mod.
At the moment it is all done with groups, but i may need to at some api functions for the TNT to work correctly.
[/quote]
Hint: For explosions we have that semi-official on_blast function (see lua_api.txt).
My creations. I gladly accept bitcoins: 17fsUywHxeMHKG41UFfu34F1rAxZcrVoqH

Swablu
Member
Posts: 18
Joined: Sun Dec 18, 2016 18:44
GitHub: LHolten
In-game: hytak

Version 2.0

by Swablu » Post

Hi people,
I have made a new version (2.0)!

Changelog:
  • TNT affects blocks again
  • Moved all processing to a coroutine
effects:
  • It uses on_construct and after_destruct so it should be compatible with all destroying mods
  • There should be no lag because if the calculations take to long they are processed later
A known bug is that if a natural block is removed but not by the player, then the blocks around it dont get updated

User avatar
Diamond knight
Member
Posts: 475
Joined: Sun Apr 19, 2015 19:50
GitHub: Diamondknight
In-game: Ferrumprinceps
Location: Chilling in Constantinople
Contact:

Re: [Mod] simple block physics [block_physics][WIP][2.0]

by Diamond knight » Post

I think custom blocks for this mod would be nice: eg. Steel cables, steel frames, etc.
and support for all the default (and some mods) non natural blocks, and a setting for difficulty (easy, medium, hard, realistic) (will affect the supporting qualities of materials, and some way to make all default natural blocks work for physics (something special way for them to work)

User avatar
DS-minetest
Member
Posts: 1137
Joined: Thu Jun 19, 2014 19:49
GitHub: Desour
IRC: DS-minetest
In-game: DS
Location: I'm scared that if this is too exact, I will be unable to use my keyboard.

Re: [Mod] simple block physics [block_physics][WIP][2.0]

by DS-minetest » Post

nodes for building should be provided by another mod, not this one

theres a problem:
if the position is higher from ground the nodes are more likely to fall down, not only at straight 1² towers but also if you want to build a small bridge between 2 towers
Note that I've recently renamed myself on github and co. to "Desour". (I'm bad at naming things.)
Feel free to call me DS.

User avatar
ManElevation
Member
Posts: 896
Joined: Tue Aug 02, 2016 22:04
GitHub: ManElevation
IRC: ManElevation
In-game: ManElevation
Location: Madrid,Spain

Re: [Mod] simple block physics [block_physics][WIP][2.0]

by ManElevation » Post

it might cause a bit of lag if a lot of blocks start falling at the same time, but its a good mod
My Public Mods! Discord: Rottweiler Games#3368

Swablu
Member
Posts: 18
Joined: Sun Dec 18, 2016 18:44
GitHub: LHolten
In-game: hytak

Re: [Mod] simple block physics [block_physics][WIP][2.0]

by Swablu » Post

Diamond knight wrote:I think custom blocks for this mod would be nice: eg. Steel cables, steel frames, etc.
and support for all the default (and some mods) non natural blocks, and a setting for difficulty (easy, medium, hard, realistic) (will affect the supporting qualities of materials, and some way to make all default natural blocks work for physics (something special way for them to work)
A setting for difficulty would be nice indeed, but it would make sharing worlds more difficult because you would need to use the same setting for your buildings to stay upright.
I am planning to add some modes e.g. one that doesn't collapse your buildings, but only reports weak spots. i don't think the supporting qualities of materials should be affected.
Still not sure how to implement physics for all natural blocks, but suggestions are welkom.
DS-minetest wrote: theres a problem:
if the position is higher from ground the nodes are more likely to fall down, not only at straight 1² towers but also if you want to build a small bridge between 2 towers
I want to make overhangs on top of a tower less stable, but this should not prevent you from building a bridge.
Hopefully i will come up with a way to make thick connections more stable, and bridges more stable then overhangs

User avatar
Diamond knight
Member
Posts: 475
Joined: Sun Apr 19, 2015 19:50
GitHub: Diamondknight
In-game: Ferrumprinceps
Location: Chilling in Constantinople
Contact:

Re: [Mod] simple block physics [block_physics][WIP][2.0]

by Diamond knight » Post

I think that the attributes should be scaled by a factor or ten so that there can be more variance in weight (wood blocks are currently the lightest thing possible)
And you forgot some wood blocks in the code (I had to add in jungle wood planks myself :( to the code) it would be interesting to have slabs be lighter than planks and some support for all the non natural blocks and moreblocks slabs (they would be lighter but weaker the thinner the slab)

Swablu
Member
Posts: 18
Joined: Sun Dec 18, 2016 18:44
GitHub: LHolten
In-game: hytak

Re: [Mod] simple block physics [block_physics][WIP][2.0]

by Swablu » Post

I did a little update, pilars in a crossshape can be build higher than single block pilars.
Also added junglewood and pine_wood (thanks for pointing this out Diamond knight)
Diamond knight wrote:I think that the attributes should be scaled by a factor or ten so that there can be more variance in weight (wood blocks are currently the lightest thing possible)
And you forgot some wood blocks in the code (I had to add in jungle wood planks myself :( to the code) it would be interesting to have slabs be lighter than planks and some support for all the non natural blocks and moreblocks slabs (they would be lighter but weaker the thinner the slab)
Param1 and param2 can store integers from 0 to 255 these are used by the physics for the amound of overhang and a general force.
I want this mod to be able to handle big structures, weights of for example 20 would limit all buildings to a height of about 11 nodes.
This said, this update makes it possible to build unlimitedly high pilars, given a wide enough base..
Anyway, I still think weights should be as low as possible.

For the lighter nodes i will propably add a different "class" of nodes, all non opaque nodes etc.
These lighter "decoration nodes" would then only be able to be placed touching a real physics block, and will fall down when this block is removed.

I hope my english is clear :P

Swablu
Member
Posts: 18
Joined: Sun Dec 18, 2016 18:44
GitHub: LHolten
In-game: hytak

Re: [Mod] simple block physics [block_physics][WIP][2.0]

by Swablu » Post

Update 2.1
changelog:
  • Added wall and floor physics, strange to get used to (needs more improvemend)
  • Added physics for all stairs and slabs, optional dependency.
  • Added physics for glass and other default deco
  • Also Propably lots of bugs, so watch out
Try building an underwater house with this and viewtopic.php?f=9&t=16485=[dynamic_liquid]

User avatar
azekill_DIABLO
Member
Posts: 7494
Joined: Wed Oct 29, 2014 20:05
GitHub: azekillDIABLO
In-game: azekill_DIABLO
Location: OMICRON
Contact:

Re: [Mod] simple block physics [block_physics][WIP][2.0]

by azekill_DIABLO » Post

it's an awesome idea!

Swablu
Member
Posts: 18
Joined: Sun Dec 18, 2016 18:44
GitHub: LHolten
In-game: hytak

Re: [Mod] simple block physics [block_physics][WIP][2.2]

by Swablu » Post

Update 2.2
changelog:
  • replaced the floor wall code with a more generic aproach
  • balanced for fun gameplay
  • bugfixes
I think the physics are almost finished.
The only things that i have left on my list are:
  • fix attached node removal
  • add physics for natural nodes
  • falling node double check or something
  • add group for delay
If something is missng, i would like to know!

User avatar
sparky
Member
Posts: 140
Joined: Sun Oct 05, 2014 00:54
GitHub: Elkien3
IRC: ircSparky
In-game: sparky
Location: USA
Contact:

Re: [Mod] simple block physics [block_physics][WIP][2.2]

by sparky » Post

The mod doesn't seem to work anymore.
floating single blocks dont fall, and i also made a bridge similar to the on in the first GIF and blew it, but nothing happened.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest