More than a texture patch? (Part 7)Jul 31, 2022
This part is about a new feature of the Gothic Reloaded mod, which is still in development: The times of day and the weather.
One could also speak of atmosphere, ambience, mood, nature or environment, although I am not satisfied with any of these terms. I wanted the game experience to be more realistic, more varied and more immersive. I wanted the player to feel the sun during the day, lightning and thunder during storms, to see the fog roll in during the evening, the nights to be darker and to have moon phases. However, this was not feasible with the traditional means of Gothic modding - fortunately there is now Union.
The inspiration for this came from newer games, but also from the Atmospheric Mod by Sand47. This was first released for Gothic 2 and then for Gothic 1. While researching for the article, I found that this project seems to have been forgotten. I couldn't find a release thread, just this review. The download is apparently only available via the Web Archive. Well then.
Water textures are incredibly difficult to create. With the Atmospheric Mod, the structure, colouring and animation of the water are fantastic. You have the feeling that you are actually on an island. The sky technically consists of an upper and a lower layer. Gothic 2, however, only uses one of them and displays the white, almost comic-like clouds there. In the Atmospheric Mod, on the other hand, both levels are used so that the sky appears higher and wider. The clouds are also colour-matched.
The sky is equally convincing at night. Compared to Gothic 2, the stars are smaller and of different brightness. A special effect is that they glitter when the camera moves. This is an interesting effect, but it is due to the fact that the textures do not have mipmaps. But back to the Gothic Reloaded Mod.
Our conquest of the sky began with the dynamic generation of clouds. First I had to figure out how to change the textures at runtime. As a starting point, I chose the function zCTextureFileFormatInternal::LoadTexture(), which gets a file name, loads and returns the corresponding textures. I overwrote it and returned an empty, black texture for each call. The result was quite impressive.
Next I tried to grab the screen content. This worked and resulted in an entertaining picture-in-picture effect.
The clouds are based on random noise, which I got from the library FastNoise by Jordan Peck. To generate the clouds, sections of the noise are taken and blended on each other with different scaling and opacity.
If you choose the parameters accordingly, convincing clouds come out. The preview function of FastNoise was very helpful here. As I discovered shortly afterwards, the colours in-game were reversed and it was time to replace the texture of the ground with that of the sky instead.
However, as you can see on the left above the hero, the texture was not tileable. Tiling is when the texture repeats itself on a surface without being noticed. The solution was to use a different algorithm that produces a periodic noise. I was able to achieve the best results with fractal Perlin noise.
The result is not yet perfect, but it is convincing. The plug-in is intended to improve not only the depiction of the weather, but also its control. That's why I first taught Gothic to change the weather every second, switching between sunny and very cloudy weather and our dynamically generated sky.
The implementation of moon phases was not a big problem, as the technical hurdles had already been overcome. The most exciting part was the determination of the moon phases, which should correspond to the current day as a little gimmick. To do this, one has to calculate the time difference to a past full moon and can then use the moon's synodic orbital period of 29.53 days to determine where it currently stands in its cycle..
Another partially implemented feature is the representation of the sky as a dome in the style of Gothic 2. However, there are still some display errors, which I have not yet been able to solve. All in all, the plugin is still at the beginning of its development, we are still doing basic research, so to speak.