Project name: WorldGen.
Project status: Alpha. v10004. Build 531.
Latest release: 22/11/2015.
[Download windows binary and source]
WorldGen is a command line tool which uses a diamond-square fractal algorithm to procedurally generate a map of a world, and exports it as a PNG. As the program is currently in alpha, do not expect it to be fully functional. I have provided a windows binary and source code. This package is released under public domain.
Here is some sample output of the program. I am quite satisfied with the landforms. There are continents, a handful of interesting looking islands, some inland lakes, peninsulas, capes, bays, channels, etc... The biomes need some work, but they are acceptable for gameplay purposes. The intention is for each pixel of this image to represent a 'tile' in the game. The biomes are as follows:
White - Snow/Tundra
Bright yellow - Desert
Dark yellow - Steppe/Plains
Dark grey - Mountainous
Bright green - Grassland
Middle green - Forest
Dark green - Jungle
Blue - Ocean/Lake
Light blue - Wetland/Swamp
Grey sprinkles - Hilly
The final product will allow for the user to specify their own biomes.
The primary purpose of this tool is to generate random worlds which can then be loaded into my own games. In this respect it could be called middleware. This world generator is the first stage of the process. The second stage of the process is WorldSim, which will basically play out a civ-like game on the map. The resulting output will be used to help me create a detailed and reasonably consistent fantasy world, around which my games can be developed.
The biomes are fractally generated, just like the landforms. There is no plan to model stuff like tectonics and climate. It's a fantasy world, alright? It don't need that crap. :P
This is island mode. It basically ensures that the borders of the world are ocean. It's a lazy man's way of ensuring that we can wrap the x-axis, or at least preventing the player from running into an invisible wall while exploring. Land wrapping is not currently implemented.
1 tile is equal to an area of 5km*5km, or 25 square kilometres. There are several considerations which made me settle on this scale.
The largest medieval city should fit comfortably within a single tile, though modern cities may take up multiple tiles. This is a good thing for gameplay purposes, as only a single battle will be required to capture a medieval city, but multiple battles may be required to capture a modern city.
The slowest unit must be able to move at least 1 tile per day over the most difficult terrain. A roman army could march about 30 kilometres in a day, so that translates to 6 tiles. I feel this is a reasonable speed to move units around the map.
A map should be able to represent an area equivalent to Earth's, whilst being displayed on the screen at a scale of 1 tile:1 pixel without being too small or overwhelmingly large. An earth-sized map can be represented in a map with dimensions of 4097*4097. I feel this is reasonable. The world generator is capable of generating such a map in a reasonable amount of time. The earth-sized map would be too big for most games, but it is nice to know that the option is there. I think a typical game will probably use the 1025*1025 size.
The above image represents an approximately Earth-sized map of 419,635,225km². The Earth itself has a surface area of 510,072,000 km². Click the image to view it at its correct size.
Almost any battle prior to the invention of gunpowder would take place within a 25km² area. More modern battles like Waterloo took place in an area slightly larger than the 5km² of a single tile, but for gameplay purposes, 5km² is ample space for early-gunpowder battles. As a result, an entire army may be represented by a single unit occupying a single tile. Modern battles are more complex, and can take place over hundreds of kilometers. This can be simulated by allowing a unit to represent a division or brigade, rather than an entire army. However, even modern military encampments can easily fit within an area of 5km².
Once the biomes are to my satisfaction, I will probably start working on a program to generate the local maps. The local map is a 5km² map which represents one of the tiles on the world map. Each tile will represent an area of 1.6m², and therefore the local map will be 3000 tiles along each side, with an area of 9,000,000 tiles. This scale is subject to change depending on what is feasible.
It is important to point out that local maps are to be generated on demand. It would take too much memory to generate all of the local maps. If a single tile holds an average of 64 bytes of data, then an entire local map will need about 500MB of memory. This alone is barely feasible. Only areas which are affected by gameplay will be held in memory... This means places with NPCs, or places where the player has been. Of primary concern will be cities and villages, and the player is expected to spend most of his time at these places. These are to be simulated to a degree which is realistic, but it will be unlikely that I can fully simulate cities that the player is not present at.
One possible solution to this is to make use of idle time between keypresses to simulate distant locations. With this technique it may be possible to develop something satisfactory.
Once all of WorldGen is complete, then I think it will be time to work on the WorldSim aspect. Initially this will take place solely on the world map, and things like city populations and battles will be a bunch of dice rolls. I think this alone will be good enough to make things interesting, but as time goes on I will add new features. The intention is for the projects to be in perpetual development.
Here are some screenshots from older versions of the program.