The World Generation
Hey everyone! 👋
We are here again today with something more interesting. As you may know already, from our short videos on socials, we are currently working on a multiplayer horror underwater survival game; DOME-7. While we are still working on the base structure of the game, there is not much to show, since it does not look pretty and is still in the buggy stages. That's why today here we will focus mostly on something that we have already shown in our short videos, but in more detail; "The world generation".
Now we just want to put here a small disclaimer. The content you'll see is from development and may not be (and probably won't be) the final version. This disclaimer also applies to any other information you may find here or from other sources. We just want to make sure that you don't have expectations for something that we may not do, but still want to be open with our community and listen to feedback. That said let's dive into how we design the deep seas of Lunaris.

The ocean floor 🌊
The base map for our underwater game is on the deep ocean floor of the Lunaris moon. Now we want to allow our players to explore the map and not be the same every time you go and start a new game. That's why it has to be generated.
It starts with a simple number. This number (a.k.a. the seed) is randomly generated when you create a new world and it sets how the world should generate. This number not only sets how the terrain generates but also how the flora and structures generate. Meaning if you have two worlds with this same number, the worlds will be (for the most part) identical.
With that number, the terrain generator gets to work. It takes that number and runs it through a noise algorithm. This algorithm creates a 2D plane of numbers between -1 and 1. Now if we kept it this way and ran it for the entire world, it would take ~12GB of your computer memory (RAM), which is not very efficient or desirable. That's why the world is split into smaller chunks that are generated only around each player using Chunk Manager. With the 2D plane split into chunks. We have to make the 2D plane into a 3D world that the player can walk on. This can be easily done by taking the numbers and applying them onto a mesh as height values.
Didn't get it? That's fine. Let's simplify this by having just one chunk. Let's say that the chunk size is 100 by 100. When you load the world, this junk only knows its position relative to the other chunks. When the Chunk Manager any player in the proximity, it tells the chunk to generate. When the chunk is generated for the first time, it generates with the height map as well. With the height map finished, the chunks start creating the 3D terrain. This is done by taking each point in the 100 by 100 area and looking at the height map. The lower the number is, the point in the 3D world is. We can also replicate this process for creating the collision and that's it, one chunk is completed!

All of this generation process runs in the background and can be limited in settings to generate only some number of chunks per second. Running these generation operations in the background should improve the performance and should cause only minimal stutters.
Now this world is completely randomly generated, but we want the player to explore more to the depths. But because the map is generated randomly, the player could just spawn in the lowest valley and there is nothing deeper for him to explore. Now yes, this could be fixed by spawning the player on the peaks and not the valleys. But we did it the other way, using masks. By putting a mask on the numbers before applying the 2D plane to the 3D mesh, we can change the shape of the world without much affecting its randomness. This way we can spawn the player on the same spot every time knowing that the map around him is random and also that there is some deeper water for him to explore.
Structures 🏚️
The structures in DOME-7, as already mentioned above, are spawned randomly in the world (Except for the main DOME-7 base). But there is a problem. When there is uneven terrain, the structures could spawn flying or buried under the ocean floor. That's why we have to make modifications to the world.
Each modification to the world has to be changed. Since we want to make this game somewhat flexible and have low hardware requirements, we can't just save the whole world in one file. That's why we have to be more creative with this. Instead of saving the whole height map with the modifications included, we are saving only the seed and the modifications them-self.
Currently, we can set two points on the map, search the chunks within this area, and modify their height values. This can also be done in real-time. This means that we can modify the terrain around the structure we want to spawn and make sure that the structure is positioned correctly on the terrain.
When placing a structure, there's an algorithm that checks for other structures and makes sure that it's still within the bounds of the world. Once the structure position is found, the structure creates its world modifications and checks the modified terrain height to place the structure properly on the surface.
Environment 💦
This deep under the ocean's surface there's almost no light coming from the sky. You'll be lucky if you manage to see 8 meters in front of you. That said, it's not only darkness that will follow you in the depths of Lunaris. We don't want to spoil too much and also want to think it through more before we share it with you all. We want to also add some biome systems later in development, but it's currently just an idea.
That's all folks
We are so happy to share all of this information with you, and the community. So far it has been a blast and we are excited to continue working on this project.