City Infinite Dev Log #1 (procedural terrain)

posted in City Infinite
Published February 23, 2022
Advertisement

Procedural Terrain

Terrain generation

City Infinite is a game idea that I got a month ago. City Infinite is going to be a survival game with infinite procedurally generated terrain and cities where there will be bosses to defeat. I used all that I had learnt in the past 4 months of me using Unity to make an FPS Controller and procedurally generated terrain after watching a tutorial series from Sebastian Lague.

I did face problems like:

colour issues, where the project was not displaying the right colour, bugs, bugs, bugs, glitches, bugs and bugs.

But in the end it all worked out and I managed to generate some procedural terrain that is of the size : 240 x 240 and I added a blue translucent mesh of the same size to create water.

The screenshot above is a random terrain that was procedurally generated. The randomly generated terrain comes with a 6 digit seed which you can copy and use later to generate the same terrain again.

Developer Info:

The seed is not the same as the noise offset, meaning that each and every seed is completely different and not related like how the noise offset would be. For example seed 123457 is not 123456 but with a the noise offset it would just be the perlin noise effect but scrolled a bit.

Terrain Colour and lighting

After that, I spent hours and hours changing the colour of the terrain so that it would actually look like some good terrain. I had followed Sebastian Lague’s tutorial to implement colours. to my terrain.

The screen shot above is the terrain from before but with colour. I used some code to generate a texture that will then be stored as a material and be used for the terrain. Unfortunately I could no blend the colours properly. After that I realised that the colours that I put in the Unity editor don't appear properly, instead they look darker and of a slightly different shade from the original colour. I then realise after an eternity of looking through the editor that the material has to have a default metallic alpha that will allow the colours to be shown as seen in the editor. After another eternity of tuning the metallic alpha, I made a Day and Night Cycle in which one day is 10 minutes and one night is 10 minutes. The main directional light changes intensity throughout the day making it look like day or night.

Developer Info:

For the colour I looped through every vertex of the mesh and assigned it all colours but that wold create harsh lines around the transition from colour to colour. so instead of assigning colours in point mode in code i changed it to trilinear which distorted the squared edges a bit and make it look like it was blended but squares can still be seen slightly if you look closely at some spots while playing. Thus in the future I will come up with a better solution to this problem.

Underwater scenes

The picture above shows the player submerged in water. To achieve this I use a local post processing volume where you can place a collider as a trigger for the post processing effect. I put a cuboid covering the whole map like how the water did but under water so that when the player gets submerged under water their view would be tinted blue.

And that's it for this Dev Log!

If you liked this Dev Log give it a like and follow this blog to get updated when I post my next Dev Log

1 likes 3 comments

Comments

TwitchGFX

helpful ?

February 23, 2022 12:17 PM
Vensah

@TwitchGFX if you do find it helpful, consider giving it a heart and follow this blog for more Dev Logs like this.

February 23, 2022 11:15 PM
Vensah

Thank you!

February 23, 2022 11:16 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement