Combining Lego like bricks with Minecraft mechanics

  • View media
  • View media
  • View media
  • View media
  • View media
  • View media
Post article RSS Articles

We pick up where we left off: The construction system constantly detects collisions with the ground.

(Red is that it does not allow building, white is that it does).

As I indicated, there can be 2 types of collisions, vertical that are "expected" (since the brick collides with the studs of another brick) and horizontal, which are real collisions since they occur when the models are crossed.
In order to fix something like this we should check all the intersection points between the 2 objects and discard the vertical ones. But we are trying to fix a problem derived from another problem.
The real problem is that to generate the collider of each chunk, I am using the shown mesh. That means Unity takes brick studs into account, making it a hell of a costly operation as well as an unwanted one.

As painful to generate as it sounds.
If you remember, the GridStuds of our bricks are square colliders:

(the green)
At no time we do take into account the shape of the studs, we don't care. And with the terrain we should do the same.
How are we going to do it? Creating a new model that is a simple cube. We grab the brick and remove the studs and the bottom. So it has the same measurements, but it is a cube.

And we have to edit the generation of chunks, so that 2 meshes are created, 1 that takes into account the studs and another that does not.

Almost everything is copy & paste of what i have already done, we just have to remove the uvs and colors part since we do not care.
I tried generating and the terrain and... Damn, what a difference with the loading speed. It is not as painful as before.

With this play we have achieved several things:
- Reduce loading times by simplifying the mesh used to generate colliders
- Not have vertical collisions.
- Improve "walking". When the studs had collisions, it seemed that you were walking through mountains, with mini-mountains all the time. Now despite being shaped, the terrain is flat when walking.
Now that we don't have vertical collisions, the collision detection system should work without requiring any editing.

If you notice, in the last part of the video I can't place bricks between the ground and other bricks.

This is because of something that I have avoided talking at all times: The bricks on the map are placed at a different height than those placed by the player.
There is always a small space between the player's bricks, which in my opinion gives it a more "Lego" touch:

If I put them like on the map, I think some of the essence / grace would be lost:

Much to my regret, I'm afraid I have no alternative, because I could put that space when all the faces of the model are rendered. On the terrain we don't do that, so if I put the space it would literally look transparent / the map inside.

I'm celebrating it too early because of something I have not shown it in the video: the bricks that you connect from the ass of another brick still have the wrong height. I will see if I can fix it easily too.

Devblog 11 - Marrying the building system with the terrain - Part 1

Devblog 11 - Marrying the building system with the terrain - Part 1


In minecraft the construction system is very simple, since any face of a block works. In our case it is not like that.If you remember, to generate the...

Devblog 10 - Building a terrain based on bricks - Chapter 2

Devblog 10 - Building a terrain based on bricks - Chapter 2


I left in that the model was too detailed for a game.Like I said, I have no idea about modeling (nor i want) so I went the easy way -> Sketchup.Sketchup...

Devblog 9 - Generating a terrain based on bricks - Chapter 1

Devblog 9 - Generating a terrain based on bricks - Chapter 1

News 2 comments

Let's see, something that I would like this game to have is terrain to explore like Minecraft, with its caves, mountains, seas, etc.As I had already told...

Devblog 8 - Crafting system

Devblog 8 - Crafting system

News 1 comment

Another important part of this type of game is being able to combine multiple items to create new ones and Brickcraft will not be less. Unfortunately...

ulyssesP - - 1 comments

looks promising, will download when available

Reply Good karma Bad karma+2 votes
Post a comment
Sign in or join with:

Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.