I have been asked an excellent question – how do terrain tiles and objects work in NextGame?Â NextGame maps are still created from tiles, but those tiles have taken an extra dimension and I’ll try to explain what does that mean. (Pictures inside!)
Small introduction first: Like in most of the games, we start with a plane somewhere in 3D space. In our case that plane is rectangular and lays along X/Y axis. Z axis is directed up from it. The plane has a specified size and consists of thousands of small squares (traditionally we will call them tiles). Each tile is roughly a size of a in-game unit – let’s say that’s approximately 1×1 meters. For simplicity some of the examples in this post will be shown on a single tile, but you can easily imagine how they come together with other tiles and form a landscape.
Let’s start with a lonely flat grass tile – pretty much boring:
Tile X/Y size can’t be changed, for the world has to have a constant size and shape. However being in 3D that means we can easily alter the third axis – Z. We will call it height. Since we are in a tile world, where single smallest building block is a tile, we can not modify it itself, instead we have a few control points, and the rest is taken care of by the games engine. What that means is, that we can edit heights of the corners of the tiles, but we can’t edit any other points within the tile. So let’s see how a small hill looks in NextGame:
Terrain wires are turned “on” to help to see how it’s bent. Not very spectacular either, right? So let’s move on further and investigate what is that on the right side of that hill. Each corner of a tile has one more important property – a surface. That is a terrain type that corner has – e.g. grass, dirt, sand, snow, etc. Here’s a quick example of that:
Notice how terrains mix with each other through generic transitions and that 3 terrains can meet together without a glitch (and in theory – all four). Those transitions are generic, which means that they are not very spectacular to look at, but they have a benefit – they are working for any surfaces combinations “out of the box”. I have also added another another property – transitions width, but this property is not of a tiles corner and not of a tile itself – it is property of the tiles edge. Those edge can be thin or wide (see the pic again). One more element, which is not yet implemented, but already planned through – variations. Those are alternative variants of the transitions and tiles. So for example a long straight line between grass and sand won’t be repeating the same on each transition tile, they will differ slightly, making the edge look more natural. Plain surfaces will also have variants in them resulting in small speckles within tiles here and there.
Moving on, how are different terrain types are made. Lakes and mountains. Those can not be realistically “painted” on a flat surface with the methods presented above. They need a special receipt – volume:
The single tile on this image has 3 corners with grass surface and one corner with water surface. In fact we use waterbed surface here. Water will be added a minute later. Obviously waterbed corner needs to be lower that the grass surface. Notice how tile corners (upper white outline) are in touch with the volume of the transition tile and edges are not. That grants us that we can connect ANY tiles by corners – they will always match, but for edges we always need to connect compatible tiles (with the same profile). Map Editors engine takes care of that automatically, mapmaker only needs to paint surface types and the engine will pick the right transition from a library.
When we switch to NextGame terrain we can have the following setup – waterbed surface in a shape of a small pond, with its height slightly below surrounding grass plane. Now the magic thing happens – when there’s a waterbed there’s added a water surface plane, whose height can be tweaked separately, allowing to make our ponds depth different and shoreline more or less visible.
Taking a step further, we combine thin and wide transitions, waterbed and grass heights and tweak water surface level to create a nice looking shoreline around two small islands:
Mountains are made much the same, with steep and soft edges, but elevated into the opposite direction:
There are still some unsolved issues with water: Obviously water surface needs a nice shader, but that is a matter of time; More seriously though, I haven’t got a decent idea about how to make changes in water level, and flow direction. Think steep mountain rivers and small waterfalls. Mountains overall shape is a bit boring too, but I hope to resolve that with additional elements – decals and objects.
At this point we are done with the base terrain. Next article will be about stuff placed on top of it – objects, decals and roadworks!
P.S. As always – comments are very welcome 😉