Sonstiges: Developer Diary - The Creation of a 3DS/Switch Game
Michael Grönert, am 26.12.2016, Seite 11 von 20
Part 11: Day and weather change
This time we want to bring some change into the dreary digital everyday life on our overworld. There might be no strategic advantage to start with it so early in development, unlike most things that have been implemented so far, but a developer does not want to work with the same monotonous landscape when testing all the time. That's why I decided to spice the whole thing up a little by the changing of days and weather. This includes changes in the weather such as sunshine, rainy weather and snowstorms, appropriate lighting conditions and day and night changing.
You do not have to reinvent the wheel of time
As with the inventory system, I first researched whether there are already free offers for weather and time systems in the asset store of Unity. In fact, I've really found one and imported Time of Day & Weather System into my project. This contains exactly the desired elements noted earlier and something more. It mainly consists of two control objects - one for the weather and one for the daytime. Let us first consider the temporal aspects. The time controller has a timer that counts at a given speed from 0 to 24 o'clock and starts again from the beginning. This includes two light sources, which represent the moon and the sun. Both light sources are directional, so they generate light beams in a given direction and not in all directions as a "point source" would do. They both rotate with an offset of 180° to simulate the different light incident angles throughout the day, thereby illuminating objects from a different angle and throwing corresponding shadows. This, of course, is a highly simplified model of our day and night changing. In reality, the sun and the moon do not appear to be on a circular orbit, but are moving on a curved path thanks to the rotation of the earth. Also, the offset between the sun and the moon is not always the same. In real life, the sun and the moon are sometimes seen simultaneously and sometimes not. Likewise the distance of the sun, the seasons, are ignored here, as well as the light intensity from the moon, which is not always irradiated by the sun at the same amount. Our system already observes differences in the colors of our light sources, which vary according to the time of day. For example, the sunlight is slightly reddish during sunrise and sunset.
Because we would like to know how late it is in our game, I wanted to find something better than a simple display on the screen. After all, in reality, we do not know the exact time either just because the light changes. So I created two new items - an analogue and a digital clock. If you carry these in the inventory, you can read the time directly in the item slot. Of course, it would be useful if you don’t have to carry such a watch in the always visible "hotbar" in order to see the time. A possible solution would be to make it “equippable” allowing the time or the clock will be shown at the screen’s edge.
Two watches in the inventory at night
The imported weather system already offers the most important weather conditions: sun, rain, snow, thunderstorm and cloudy. In the case of rain and snow, there are particle systems that produce rain drops or snowflakes. Particles are very minimalistic objects that obey certain physical laws and have a limited life span. They should be as efficient as possible in large quantities without the need for too much computing power. Rain can, for example, be represented as two-dimensional short strokes in order to create the impression of fast falling drops. So you do not have to use 3D models and the rain can go through other objects, so no collision handling is needed since you could hardly see this detail anyway.
Gloom and rain - that drags the mood down
The snowflakes, on the other hand, are implemented as small white cuboids. Only a few of them have already tripped an old 3DS model in a test. Alternatively, 2D sprites as images instead of models might be conceivable as snowflakes.
The angular snowflakes lightly reflect the sunlight
Since there is no precipitation without clouds, the environment is automatically darkened in bad weather. So the weather system also influences the light sources, together with the time of the day. A thunderstorm expands the rainy weather with lightning. These are not directly realised by visible lightning drawings, but by a short and brightly lit screen.
Now the weather has only to be determined and changed at appropriate intervals. For this, our game time is used and a bit of randomness. For example, I can determine that a weather phase lasts for a certain time - a few hours to whole days. Then the next weather state is selected by chance and a duration is set again. This process could be highly optimized to reflect the reality as precisely as possible. Depending on the localization (system language etc. as a hint) of the game world, one could represent a low-precipitation desert to rainy subtropics. However, since we are in a virtual world which is not to be based on any particular real location at the moment, I have not invested any time and left it with a relatively arbitrary random algorithm.
A difference like night and day
Right now, the new time and weather system is just a beauty detail of our world and has no deeper meaning. It will remain like that for a while as other things have a higher priority but I would already like to address a few of the new possibilities. Weather and time can have a lot of influence on the game. In many games the night stands for danger - think of Minecraft or Don’t Starve. At night, there may be more or more dangerous monsters. Maybe you even have to retreat to a safe hideout or stay near a camp fire. For our case, I'm thinking of a comparison to Pokémon: Perhaps there are gloomy minigames which are nocturnal and others who only go out during the day. Or some games differ slightly depending on whether they are played by day or by night. They could adapt themselves graphically to the respective situation or be harder at night and give more experience. In addition, time-based events are also possible. Solar batteries which recharge after a certain time in the sun and plants that need a certain time to regrow. One could, for example, build battery bushes from which battery berries can be harvested. In such matters, however, the question arises whether these things should really depend on the time in the game or on the real system time. You could also grow plants while the game is not running, like the berry bushes in Pokémon or all plants at FarmVille. Or you really need to sit out the time in the game, as with Harvest Moon and Stardew Valley.
Weather can also have a direct influence. Again, comparable to Pokémon which only can be seen in the rain, minigames can have such a behavior. Weather and time affect the temperature, another important aspect which I have not taken into account. Temperatures could also influence the minigames. And last but not least, the world itself. Waters could dry up or freeze, thus opening up new paths. The player may have to protect himself against temperatures that are too high or too low so that he will not be damaged or weakened. A good sample of all these aspects is The Legend of Zelda: Breath of the Wild. Here one should prepare with appropriate food and clothing to the different temperatures, which can prevail in different places and at different times of the day.
This was my today’s contribution to the current state of development of Game Master. In the next part I go with a very comprehensive topic: Network games! Online multiplayer and local multiplayer games over WiFi are to be realized. Until next time - and do not be afraid of feedback, questions and suggestions!
Do you prefer to read this diary in the developer's mother tongue? Then click here to read this diary entry in the original German language!