This project is my master's thesis - I have submission deadline on 5th of December. All features that are in scope of the thesis are already implemented, so for now I'm looking to thoroughly test the whole thing.
Features:
- Fully featured dynamic procedural scripting language - Supports most of the programming constructs you would expect from a programming language. Variables, functions, conditions, loops etc. are all in.
- Powerful standard library - Includes ~60 graphical functions, including noise generators, various graphical primitives, combination functions, filters etc.
- Cutouts and infinite maps - The generator can render arbitrary rectangular part of any map independently. This also brings the ability to render "infinite" maps, which can be rendered tile by tile (most maps that don't declare any "hardcoded" terrain features such as "this map has a lake in the center" end up being infinite). This of course allows for trivial multithreading.
- Scaled renders - Any map can be rendered at various scales ranging from 10x zoomed in to 10x zoomed out. This can be used to render accurate and efficient previews or for level-of-detail (eg. in a 3D game, distant terrain can be generated with reduced detail level and as you approach it, that region can be re-generated with gradually greater detail level).
One of the main goals was to make the scripts as readable and as terse as possible. Example of a simple script, which renders a random terrain with 10 peaks randomly scattered throughout:
- {l Code}: {l Select All Code}
metadata
{
// This map is finite (infinite maps are not allowed to refer to width and height of the map at all). Maps are infinite by default.
// If we wanted, we could restrict the map to a cerain range of allowed sizes, but that is not necessary for such simple script.
Width: Finite,
Height: Finite
}
// Create an empty height map with height 0. All the heights in GeoGen are in range <-1, 1>. 0 is a "base" level, often thought of as water level.
var map = HeightMap.Flat();
for (var i = 0; i < 10; i++)
{
// Random point within the map
var position = [Random(0, Parameters.MapWidth), Random(0, Parameters.MapHeight)];
// Creates a cone centered at the random position, with radius equal to one tenth of width of the map. Its height will be 0.5 at the peak and 0 at the rim.
var cone = HeightMap.RadialGradient(position, Parameters.MapWidth / 10, 0.6, 0);
// Each peak is blurred a bit, to prevent any unnatural hard edges from getting into the resulting height map.
cone.Blur(10);
map.Add(cone);
}
// Add some random noise to the map. Don't bother to customize the noise here, that's more advanced topic :)
var noise = HeightMap.Noise();
// The range of heights in the noise is full <-1, 1> by default, we need to reduce that a bit to make the peaks stand out.
noise.Multiply(0.5);
map.Add(noise);
// Pass the map to the API.
yield map;
And sample map generated by this script:
Not too impressive, but that's just several lines of code! See the gallery for more interesting images.
The download package includes interactive console application, scripting language reference and example scripts. For now, only Windows is supported (GCC support is one of the highest priority features that are outside of scope of the thesis).
Download (alternate mirror)
Scripting reference (also part of the download package)
Render gallery
Known issues
Source code (GPLv3, not looking for contributions right now)
I welcome any feedback - bug reports, typos in documentation, hard to understand documentation etc.