This time we are going to show a video from the real game client. It demonstrates how the island terrain is generated and some atmospheric effects are applied to the scene:
Terrain generation in Cybernation Online starts with an OpenSimplex noise that produces terrain height matrix:
This matrix is then used for pathfinding purposes and, of course, for visualization on the client side. The matrix is compressed on the server by using an algorithm that splits contiguous areas of the same height into a set of rectangles, and then only coordinates of the rectangles are transmitted over the wire. Other attributes of the cells such as their passability are also added to the dataset in the same way. A 100x100 meter island (1 cell = 1 meter) is compressed to a few kilobytes of data, which is small enough to be loaded over poor connections almost instantly. This is important, because it directly affects location loading time.
When the client receives such a packet, it performs contour detection — traces all boundaries between different heights:
Then it connects the points in horizontal planes into polygons, triangulates the polygons, and paints them with a ground material:
Then points on the respective upper and lower contours are connected with vertical triangles, and they form the walls:
Finally a shader, specific to the type of terrain, is used, and the material gets a new look:
The atmosphere generation is the last step that defines the mood of the scene:
It's still work in progress, and the images will get much better in the end: the geometry will have more details (such as cliffs, slopes, minor defects of the surfaces), the materials and shaders will become more natural looking, the sky will get some texture (clouds, rainbows, stars, planets, whatever you can see on other planets).