So for the past 2-ish weeks I experimenting with some Minecraft like procedural world generation.
After a lot of tweaking I got it to work pretty well.
While it is not perfect and a bit slow, it show really well how powerful Godot can be.

To make it more sandbox-y I added the ability to place and break blocks.
Every chunk the player modifies will be saved, so those stone huts will be immortalized.

Mainly to experiment with gradients, I also added in a day/night cycle.
However this cycle last only like less than a minute.
While it's not shown well in this video, the grass also has some gradient to it.
I made it so that the grass colour is determined by the temperature.
Which will make the grass in some regions look vibrant green and in other reddish.

[

It's not a very good system, but my game can now also generate trees and plants.
Next challenge will be making structures.

RAMupgrade
Looks like a fun little game.
If you expand on it, you can make a cool survival island game.

After days of headaches, I finally have a natural generated structure.

Yay, structure generation.
Also I did some improvements with the performance.

[

I think I want to make this project very dense with buildings. I need to make some very tall buildings, hopefully it won't tank the performance.


I already knew how to change grass colour, so I thought it would be nice to be able to change colours of other blocks.
This will definitely help me out to make interesting structures, without having to make new blocks.

Testing some cool lights.
Next will be different coloured lights.

[

8 months later

I spend the whole day trying to get this project working in Godot 4.
My plans for this project is fixing some of the world generation and make an easy system to add biomes.

  • z80 replied to this.

    SuperDoomKing
    I'm sorry for breaking in! You are working on a very interesting project! And it really looks awesome!

    May I ask you for a hint? I'm wondering how you create chunks of blocks without FPS drop. When I'm doing similar thing (instantiate a few scenes in a loop) my project stalls for a moment even if the number is like 10. I tried to do instantiation in a separate thread and add instances to the tree afterwards. But in that case the game crashes with some probability.

    Thank you!

      z80
      I just do the generation in a separate thread and some optimizations.
      Also, as part of the optimizations, these blocks aren't real blocks, they are mostly just planes only showing one or a few sides.
      When the player is not able to see something, there is no need to render it.
      I don't know your issue, but it could just be bad optimization.

      • z80 replied to this.

        SuperDoomKing
        Hello! Thanks for the explanation!
        All I do is something like:

        for i in range(10):
            var inst: Spatial = AssetScene.instantiate()
            self.add_child( inst )
            inst.transform = transforms[i]

        I thought that may be there is a trick how to instantiate objects so that it doesn't cause a game to stall.

          z80 so that it doesn't cause a game to stall.

          Your scene may be too "big" I guess. Instantiating scene can be very fast especially if there is not much to do on init & ready functions.
          I wonder if there is not also some physics involved which may increase the work needed on addition.

          z80
          Assuming that's for loading in chunks, it's similar to what I did.
          Meaning your issue probably lies in the chunks themselves.
          How much geometry do you make?
          How big are your chunks?
          It may be easier for us to know what your issue is if you provide some pictures.

          • z80 replied to this.

            SuperDoomKing It may be easier for us to know what your issue is if you provide some pictures.

            Sure, sorry for the ambiguity! Here is the video below demonstrating the problem.

            Basic setup is, I guess, similar to yours. The vicinity of the camera is split into 3x3x3 cubic blocks. As soon as camera leaves central block, the game deletes 9 blocks and creates new 9 blocks. I.e. makes the camera to be in the central block again. In the video because it is on the perfectly flat large sphere, only 3 blocks actually contain geometry. So it should be even faster.

            And I checked, it is the trees creation what slows it down. As soon as I remove trees creation but keeping all the computations, ex. like where to put the trees, I no longer have the stalling issue.


            • xyz replied to this.