Devlog #5


A lot have changed since Devlog #4! Mostly the implementation of new complex systems. They are still simple basic as of now but they work as intended:

1 - The world ticks:

This system was planned since the beginning. I wanted to allow the world to update and become dynamic as time passes. But after playing Rune Factory, a game where I can manage a farm and see crops grow, I got inspired I thought it was time to add this to the project!

Here is what I did:

Basically, this is a simulation of crops growing in 4 chunks. At first, the chunks are only soil (brown blocks). They then plant seeds (yellow blocks). As time passes, they slowly grow into their different states: orange then green. This is a basic simulation of how it would look in a game.

So it was time to implement the ticks into the project. But it had to be different since this time I was working in a 3D world with way more blocks at once. And I had a problem with my blocks: they are not instances. Which means that every block is not a new block, it's a copy. If I edit one block, all of the others are also changed. In this case, one crop growing would have made every other crop grow at the same time.

So, I spent a few hours trying to make instances out of the blocks, it allowed me to have way more freedom for everything I was going to implement next.

Once this was done, I was finally able to add the tick system! And here it is in action:

Every few ticks, the blocks change to another block, they are constantly updated and each of them is an instance instead of a copy.

From there, I was able to create a new block: Crops. They behave the same way as the simulation I did earlier but they were in 3D with a mesh and linked to the world ticks of the voxel world. And here is what they look like:

They are still very basic, it's just blocks changing with time and following rules which tells them what to do next. I added some randomness to it, this way they don't grow in a specific order but more naturally instead.

After adding back my old world generation code, here it was, stress-tested and working just fine:


2 - Complex collisions :

This one took some time, honestly... After the previous Devlog, I was met with a big issue. Let me explain:

Blocks are simple. They are either solid, or they aren't. You can walk through some blocks, but not through every block. And what about doors? They are solid, of course, but they need to allow the player to walk through when are rotated. And as of now, solid blocks are cubes, which means that doors, in any of their state, are still cubes to the game. Cubes with a door shape. Cubes rotating. No matter what the player does, opening or closing doors, they won't let them go through because they are solid. So what can I do?

I decided to implement a whole new collision system.

But instead of forcing collisions depending on the block and the shape, I implemented a very open collision type which allows players and modders to add their own collisions if they wish to do so. The only exceptions are the 3 basic collision types which are built-in: AABB, Sphere and Convex:

In my case, the doors will use the AABB collision type, which means that they are physically defined with an invisible box which will be used for the collision. They are no longer a 1x1x1 cube but a thin cube on one side only. This allow the player to collide with the door depending on the rotation and the state of it.

(This is quite complex and would require a whole Devlog to explain, but I'll definitely create a section for it when I'll work on documentation for modders)

Here it is when added to the game:

I am planning on improving this collision system, of course, but it will do for now.

Leave a comment

Log in with itch.io to leave a comment.