Blokworld
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Block physics

4 posters

Go down

Block physics Empty Block physics

Post by noizex Mon Jun 27, 2011 10:22 am

Hello there,

I wanted to bring forward topic of physics in voxel-based engines like Blokworld. What Minecraft shows is no physics at all, blocks just hang in the air without having anything that would hold them etc. Do you plan to include some physics in your engine Slaihne, so its impossible to build bridges without any support or just remove all blocks around other block with that block still hanging in the air?

How would you implement it engine-wise? Having blocks stuck in pre-generated mesh (at least thats I think most common approach), until the world is changed is a bit of a drawback, because even if we have some way to determine which blocks lost support and should fall down we need to move them gradually downwards. How this can be achieved with pre-generated vertice lists per chunk? I have no idea right now how to implement simple "falling blocks" like Gravel in Minecraft, that always fall down if there is empty block below them, because I don't know how to make block moving out of the mesh hes in. Maybe once we figure out that blocks A, B, C are "falling" it should take them out of normal vertice list thats compiled per chunk and let them move freely on their own, being drawn in dynamic position until they fall down and can be incorporated into global mesh again?

Or do I get it completly wrong? Discuss. Smile

noizex

Posts : 2
Join date : 2011-06-21

Back to top Go down

Block physics Empty Re: Block physics

Post by Slaihne Mon Jun 27, 2011 12:30 pm

Hi noizex,

Physics for blocks is an interesting problem but unfortunately falling blocks don't work great in an infinite world.

The problem can be summarised as follows;

If a player builds a really long bridge without any supports, then it is feasible that only the middle section of the bridge could actually exist at a particular moment. That is, the 'ends' of the bridge are not within view distance and so only exist as files on the hard drive. If some sort of 'pass' of the blocks were carried out it would find the bridge unsupported and start to drop the blocks down, leading to the total collapse of the bridge.

Now, this may sound like a highly contrived example but consider a small rock overhang with the overhang being in one chunk and the bit where it actually joins onto the world being in another chunk. At some stage, the supporting chunk will not be in memory while the overhang is. Result; the overhang is unsupported so it collapses.

There is one way i can think of to make it could work, and that is to assume that if a block is at the 'view' horizon it is supported. Then when you do your pass of the blocks you only really start actual unsupported blocks to fall. This would mean though, that you could build a really long bridge and then remove it's supports at each end. Because the bridge would always have a bit of it touching the view horizon then it would never collapse.

In terms of getting the blocks to fall i would remove the block from the world and regenerate the mesh without it in. Then i would create an object in the world that looks exactly like the block. This object would be able to move freely since it is no longer a 'block'. Once it completes it's travels i would re-insert it into the blocks, regenerate the relevant meshes and remove the moveable object from the world.

As long as there weren't too many blocks falling at the same time it wouldn't be too difficult.

I have read that Minecraft has 'pistons' and these seem tougher to implement. But i think that they can only push 16 blocks in front of themselves. So, i would assume once a piston is placed then the 16 blocks in front of it are removed from the world and become moveable objects instead.

The problem i keep running into , thinking about this, is that it would wreak havoc with lighting since objects don't block light for me atm.
Slaihne
Slaihne

Posts : 264
Join date : 2011-03-17
Age : 56

Back to top Go down

Block physics Empty Re: Block physics

Post by noizex Mon Jun 27, 2011 1:00 pm

Slaihne wrote:Hi noizex,
If a player builds a really long bridge without any supports, then it is feasible that only the middle section of the bridge could actually exist at a particular moment. That is, the 'ends' of the bridge are not within view distance and so only exist as files on the hard drive. If some sort of 'pass' of the blocks were carried out it would find the bridge unsupported and start to drop the blocks down, leading to the total collapse of the bridge.

Now, this may sound like a highly contrived example but consider a small rock overhang with the overhang being in one chunk and the bit where it actually joins onto the world being in another chunk. At some stage, the supporting chunk will not be in memory while the overhang is. Result; the overhang is unsupported so it collapses.

Maybe then just check for support when player modifies the world? When its pregenerated we can assume everything is supported and as it should be, then whenever player removes the block we check if it didn't cause lack of support for other blocks. With long bridge - I think such thing should collapse very soon if player doesn't build proper support column every N blocks of bridge length. But yeah, having structures that are cross-chunk is hard for physics checks because it would require looking into other chunk's blocks too.

Putting chunk problem aside, I still wonder how to check whether some block or group of blocks has support, because there must be some limit how deep we look. Overhang that player hit with pickaxe few times may seem to be unsupported, but what if there is a connection with other side of chasm, but very far. We'd have to traverse a lot of blocks to find out we're in solid ground again, but when to decide its solid? (on the other side if that thing would be unsupported too it should collapse earlier Smile

Slaihne wrote:
In terms of getting the blocks to fall i would remove the block from the world and regenerate the mesh without it in. Then i would create an object in the world that looks exactly like the block. This object would be able to move freely since it is no longer a 'block'. Once it completes it's travels i would re-insert it into the blocks, regenerate the relevant meshes and remove the moveable object from the world.

As long as there weren't too many blocks falling at the same time it wouldn't be too difficult.
Hm, sounds like a good idea, I should implement such blocks anyway because there will be few moments when I want to move the block out of static mesh and do something with it.

Slaihne wrote:
I have read that Minecraft has 'pistons' and these seem tougher to implement. But i think that they can only push 16 blocks in front of themselves. So, i would assume once a piston is placed then the 16 blocks in front of it are removed from the world and become moveable objects instead.

The problem i keep running into , thinking about this, is that it would wreak havoc with lighting since objects don't block light for me atm.

I was wondering about piston implementation too. It seems that Minecraft uses follows some loose way of rendering things, because it seems to take moving blocks easier than it is for me with 1 vertex buffer per chunk recompiled on world change. If I was to recompile it every time block moves by 1 unit it would be pointless to have it in the first place ;( And I guess changing only few vertices in that buffer won't be wise too, because changing block position in world affects lighting that would require redoing too.



noizex

Posts : 2
Join date : 2011-06-21

Back to top Go down

Block physics Empty Re: Block physics

Post by S33m3 Mon Jun 27, 2011 1:43 pm

Just a tips concerning minecraft, they are using so called "Display list". In fact a display list in minecraft is a subset of a chunk.
The minecraft chunk are 16*16*128, a display list is 16*16*16.
When a change is done in a chunk only the vertices inside the display list are rebuild (Then the VB + IB are rebuild from the 8 display list of the chunks).

S33m3

Posts : 54
Join date : 2011-03-23

Back to top Go down

Block physics Empty Re: Block physics

Post by Kilkun Sat Jul 02, 2011 4:58 pm

Perhaps when he was talking, eh meant something along these: https://www.youtube.com/watch?v=eQMBGLMtdFE lines. It seems simple enough, if you implement a rigid body system to the engine.

Kilkun

Posts : 7
Join date : 2011-04-28

Back to top Go down

Block physics Empty Re: Block physics

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum