Okay, so I’ve already posted this once but Google Chrome crashed so I apologize if anything I type this time around seems a little abrasive.
I’ve been playing around with Unity, both with the Unity Editor and MonoDevlop for Scripting, and am testing out a proof-of-concept design for a Civilzation-style game.
Using a Mersenne Twister random number generator (RNG), I am programatically generated a mesh of interactable width and height, as well as allowing the size of the tiles to be changed too. I have also implemented a basic mouse-over system which tells the player what tile they are currently mousing over.
The issue that I now face is trying to make the world more organised. For the moment, as I said before, I am using a RNG which randomly choosing a tile from a predetermined list. The predetermined list is now problem; the problem is trying to group similar tiles together; i.e. having vast oceans with land masses scattered throughout the world.
I have a basic concept with regards to the generation process, but I am not entirely sure as to how I can achieve this inside of the game engine itself.
-
The first step in my world generation would be to iterate through all the tiles in the world and make them all deep ocean tiles. In essence, this means that we are starting with an empty world, simply populated with water. This would form the ‘base layer’.
-
Next, the world would be iterated through again and placeholder land masses (i.e. grouped tiles of land that are large enough to be inhabited). They wouldn’t be the actual land tiles yet, just enough for the ‘base layer’ to see where the land is situated.
-
Deep ocean tiles that are situated within a certain number of tiles (probably a random number so that the coastlines are uniformly bordered by shallow water) are converted into shallow ocean tiles, to allow players to board boats and traverse near to the land.
-
The previously generated land tiles are now iterated through and, dependent on a variety of factors, are converted into their appropriate tiles (sand, grass, mountain, etc.).
-
One final iteration of the world would clear out any silly generation (for example, an island of size 1x1 generates and is then determined to be a mountain, wherein the tile - i.e. the whole island - cannot be populated) by returning them to either flat land or water.
So, that’s the sort of proof-on-concept behind the terrain generation but I have had no luck finding any tips or tricks or suggestions on how to achieve this.
Does anybody know? I would be incredibly appreciative if somebody did.
Thanks again to anybody who can solve, help solve or point me in the direction of a post that can solve/help solve my problem.
Thanks.