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

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

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

by Swablu » Sun Dec 18, 2016 18:52

Simple Block Physics
Info
This mod adds very very simple block physics to minetest.
Some inspiration came from this post: https://forum.minetest.net/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

+ Data


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: 968
Joined: Thu Jun 19, 2014 19:49
Location: in front of my pc (which is at home)
GitHub: DS-Minetest
In-game: DS

Re: [Mod] simple block physics [block_physics]

by DS-minetest » Mon Dec 19, 2016 15:19

the mod would be nice but it causes massive lags
Do not call me -minetest.
Call me DS or DS-minetest.
I am German, so you don't have to pm me English if you are also German.
The background is a lie.
 

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

Re: [Mod] simple block physics [block_physics]

by Swablu » Mon Dec 19, 2016 15:53

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: 1672
Joined: Wed Oct 19, 2016 15:18
Location: Russia, Moscow
GitHub: Andrey2470T
In-game: Andrey01

Re: [Mod] simple block physics [block_physics]

by Andrey01 » Mon Dec 19, 2016 17:48

Nice! It looks like really
I like and i am learning to build nice and great houses, palaces, infrastructures and etc... in Minetest!
My Mods:
Unfinished:Medicine,Cube Nodes.

Old:Sweet Machine,Drink Machine

My Favourite Servers:
just test, Switchboard PvP made by yngwie123, VanessaE`s creative-building server, Parkour Owned by LoweGaming, Fractal Island and some other servers!
 

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

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

by Swablu » Mon Dec 19, 2016 18:56

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

User avatar
Wuzzy
Member
 
Posts: 2770
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 » Mon Dec 19, 2016 19:00

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?
I'm creating MineClone 2, a Minecraft clone for Minetest. I made the Help modpack, adding in-game help to Minetest.
 

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

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

by Swablu » Mon Dec 19, 2016 20:24

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 » Mon Dec 19, 2016 21:47

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: 2770
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 » Tue Dec 20, 2016 00:25

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.
I'm creating MineClone 2, a Minecraft clone for Minetest. I made the Help modpack, adding in-game help to Minetest.
 

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

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

by TumeniNodes » Tue Dec 20, 2016 02:09

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?
Malicious intent, is NOT covered by the Fair Use Act.
 

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

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

by TheReaperKing » Tue Dec 20, 2016 03:06

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!
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: 968
Joined: Thu Jun 19, 2014 19:49
Location: in front of my pc (which is at home)
GitHub: DS-Minetest
In-game: DS

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

by DS-minetest » Tue Dec 20, 2016 11:52

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

there was a minecraft mod like this, i forgot the name
Do not call me -minetest.
Call me DS or DS-minetest.
I am German, so you don't have to pm me English if you are also German.
The background is a lie.
 

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

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

by Swablu » Tue Dec 20, 2016 14:45

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/mapping-and-modding/minecraft-mods/1283267-blockphysics-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/mapping-and-modding/minecraft-mods/1283267-blockphysics-mod
 

User avatar
Wuzzy
Member
 
Posts: 2770
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 » Tue Dec 20, 2016 18:50

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).
I'm creating MineClone 2, a Minecraft clone for Minetest. I made the Help modpack, adding in-game help to Minetest.
 

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

Version 2.0

by Swablu » Sat Dec 31, 2016 16:11

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: 416
Joined: Sun Apr 19, 2015 19:50
Location: Sol 3 (aka earth for you science noobs)
In-game: Diamondknight or diamond_knight

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

by Diamond knight » Sat Dec 31, 2016 17:36

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)
Join The United Empire of Ferrum, a new virtual society gaming clan that uses real world military and financial tactics to achieve victory. We are currently looking for new politicians for the clan. [url]theunitedempireofferrum.weebly.com[/url]
 

User avatar
DS-minetest
Member
 
Posts: 968
Joined: Thu Jun 19, 2014 19:49
Location: in front of my pc (which is at home)
GitHub: DS-Minetest
In-game: DS

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

by DS-minetest » Sat Dec 31, 2016 18:42

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
Do not call me -minetest.
Call me DS or DS-minetest.
I am German, so you don't have to pm me English if you are also German.
The background is a lie.
 

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

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

by ManElevation » Sun Jan 01, 2017 12:16

it might cause a bit of lag if a lot of blocks start falling at the same time, but its a good mod
 

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

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

by Swablu » Sun Jan 01, 2017 13:22

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: 416
Joined: Sun Apr 19, 2015 19:50
Location: Sol 3 (aka earth for you science noobs)
In-game: Diamondknight or diamond_knight

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

by Diamond knight » Sat Jan 14, 2017 15:45

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)
Join The United Empire of Ferrum, a new virtual society gaming clan that uses real world military and financial tactics to achieve victory. We are currently looking for new politicians for the clan. [url]theunitedempireofferrum.weebly.com[/url]
 

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

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

by Swablu » Sat Jan 28, 2017 16:12

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: 16
Joined: Sun Dec 18, 2016 18:44
GitHub: LHolten
In-game: hytak

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

by Swablu » Sun Jan 29, 2017 17:54

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 https://forum.minetest.net/viewtopic.php?f=9&t=16485=[dynamic_liquid]
 

User avatar
azekill_DIABLO
Member
 
Posts: 6553
Joined: Wed Oct 29, 2014 20:05
Location: Inside the Box
GitHub: azekillDIABLO
In-game: azekill_DIABLO
 

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

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

by Swablu » Thu Feb 02, 2017 16:44

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!
 


Return to WIP Mods



Who is online

Users browsing this forum: Bing [Bot], ManElevation, Yahoo [Bot] and 7 guests