Welcome back to another City Infinite dev log, let's jump right into it!
Infinite Terrain
Oh boy do I have a lot in this chapter…
Well, last dev log I said that I would try to post every week and this time you might be thinking that I had posted this dev log late but no. It's still Saturday in Mars, where I live, and as everyone knows Saturday is still the last day of the week. Thus, technically I did post this dev log on time.
Anyways back to how I made infinite terrain, to make the procedural terrain I previously had infinite I would firstly have to separate the terrain into chunks and spawn a few around the player. To do this I first spawn a 240 x 240 terrain chunk where the player spawns and then I spawn a few more terrain chunks of the same size around the first chunk. The chunks would have noise (referring to Perlin noise) that would be offset by the position of the previous chunk that was spawned. The number of chunks around the player would be determined by view distance and as chunks get further and further detail of those chunks get lower and lower in order for the infinite terrain to be more optimised. The terrain gets updated as the player moves more and more chunks that continuously spawns making the illusion that the terrain is infinite while in reality the terrain generated at that point of time is much much lesser than infinity. After that I was debugging the problem where my chunk’s textures were not lining up properly FOR 3 DAYS (AKA the reason the post was late this week).
The picture below shows the how the chunks spawn. The darker the squares are, the higher detail the chunk has.
After this I made mountains for the terrain as I felt that the terrain was kind of empty with just grass. If you think I could add anything else or do anything to improve the terrain generation.
The colour generation for terrain is basic and based on the height of the terrain. In the future I would change it based on how steep the parts of the terrain are. For the water of the infinite terrain I didn't spawn the water together with the terrain but instead decided to make a 2400 x 2400 water plane that follows the player on the X and Z axis but not on the Y so that its less expensive computationally.
Mountains
How I added mountains was by multiplying the height map to make the taller regions more steeper and coloured them a stone colour and snow on the tops of the mountain formations. Coincidentally, they look like how most
mountains are formed in real life, they start to become very tall gradually.
Yes, yes it’s not realistic but we’re are here to talk about how the shape of the mountains generate and not how garbage my mountain looks (spoiler: it’s garbage).
And that's it for this Dev Log!
and as always, if you liked this Dev Log give it a like and follow this blog to get updated when I post my next Dev Log, I try to post every week
Hey. I am new to Unity. Have read your dev logs with much interest. Could you make it a bit longer ???