SECRET
DigiMastered Works LLC
Office of Development
DMW107IB1013
Date 08/03/2022 12:02 PM
To: The People
From: Tanner Fry
Subject: Enhancing Scenery & Buildings
Water Shading
For a while now I've been trying to tackle the issue of depth on the map. One area of concern was the map's terrain. Currently, the terrain is split into 9 regions. They are as follows: Water Deep, Water Shallow, Water Edge, Sand, Grass, Grass 2, Rock, Rock 2, and Snow. To give the terrain more depth the water edge now has a shadow below it. In the first image below you will see the depth visualized as red while the second image shows its true in-game color.
Map Generation - Water Edge Depth Visualization
Map Generation - True Color of Water Edge Depth
The added depth may work best around the entire water but I'm not sure as of yet. So, how's it made? In the past I've talked about the terrain and how it's generated. It's a noise height map, which is a 2D array, that is turned into colors based on the height. While generating the color map I check for a few conditions and then modify the map during generation based on those conditions.
When looping through the noise map the height of the current cell in the 2D array is compared to the map's regions. If the cell is within the Water Shallow region (0.2 < current height <= 0.3) then we check if the water is below (-y) land. If so, then insert a color representing the water shadow into the color map. Below is the code used for generating the color map from the noise map:
// Loop through noise map to get colors based on the height of the noise map
// NOTE: The relation of x/y to the texture is inversed. So x/y in a 2D plane starts at bottom left
// while the texture starts at top right.
colorMap = new Color[mapWidth * mapHeight];
for (int y = 0; y < mapHeight; y++) {
for (int x = 0; x < mapWidth; x++) {
float currentHeight = noiseMap[x, y];
for (int i = 0; i < regions.Length; i++) {
if (currentHeight <= regions[i].height) {
// Check if water tile has sand above it so we can add a darker water tile to show an edge
// which should give more depth.
if (currentHeight <= 0.3 && currentHeight > 0.2) {
bool waterIsAgainstLand = false;
foreach(TerrainType region in regions) {
if (region.name == "Water Edge" || region.name == "Sand") {
// Check if land is above water
try {
if ((noiseMap[x, y - 1] <= region.height && noiseMap[x, y - 1] > 0.3)
|| (noiseMap[x, y - 2] <= region.height && noiseMap[x, y - 2] > 0.3)) {
waterIsAgainstLand = true;
colorMap[y * mapWidth + x] = _colorWaterAgainstLand;
}
} catch (IndexOutOfRangeException ex) {
// noiseMap[x, y - 1] returned out of range when y == 0 and we subtract bringing
// the array selection of noiseMap[positive, negative] which causes out of range
OverseerManager.Instance.AddToConsole("Map Texture Error: " + ex.Message);
}
}
}
if (!waterIsAgainstLand) {
colorMap[y * mapWidth + x] = regions[i].color;
}
} else {
colorMap[y * mapWidth + x] = regions[i].color;
}
break;
}
}
}
}
Fog
Weather brings ambience and cohesion into the game. To improve the day/night cycle system and add onto it, fog is being implemented. Beyond fog, there will be rain, storms, snow, and other weather conditions. Later down the road, types of flooding and extreme weather events might even be added.
For now we'll talk about fog, how it works, and what it does for the game. We utilize a particle system within Unity in order to create fog particles across the world. With our weather manager, we can modify the direction as well as the speed of the fog particle system. With this, dynamic weather starts to become real. We still need to implement other types of weather such as rain and storms but this is a start.
Below you can see how fog works. Within the video, structures utilize a collider to remove any fog particles that come in contact with the building. Later on, we may make additional colliders for different areas such as higher regions like mountains or lower regions like water. We could even expand to allow dynamic fog around sea level and other regions.
Fog Particle System Showcase
The fog system looks chunky and there is more work to be done but this is a great start which gives good exposure to Unity's built in particle systems.
Factory Particle Effects
Along with the fog particle system, a proof of concept was made for smaller particle systems that could be used for the environment, buildings, explosions, and more. You have may noticed in the previous video relating to the fog particle system where there is a factory with smoke billowing out of its chimneys. Below is a video showcasing a factory's smoke.
Factory Particle System Showcase
We utilizes Unity's particle system to create a bunch of smoke particles. Through this system we can change the size of the smoke particles, their lifespan, and more. It's a nice touch and I will be looking for other use cases moving forward.
Location Triggers
Earlier we talked about how structures utilize colliders to remove fog particles. These colliders are what we consider location triggers. Locations can be buildings, areas, and other general concepts of a place but currently buildings are the only locations that have been implemented. We have started utilizing location triggers so that we can work with other asset colliders in the game. Currently, locations have two colliders. They have one that interacts with game objects and another to interact with the player's mouse.
Through location triggers, we unfortunately add more complexity. It adds the need to keep track of more than one collider while also decoupling one collider from the actual location. This decoupling is due to how we've setup the colliders. One is setup as a separate game object while the other is attached to the actual location. This is due to Unity's collider system only allowing 1 collider on a game object for them to work properly.
A benefit of this decoupling is the ability to implement more complex systems together. More may come for this topic.
Enhanced Weather
Weather has been enhanced with fog and wind direction. The wind direction and speed does manipulate the fog to the desired effects but it's still a work in progress with a couple of bugs. In the coming months, more systems should be implemented to allow for dynamic weather and with that, more videos will come to showcase those systems.
Also, the day/night cycle's sunrise/sunset have hue shifts now. During the sunrise, the landscape's color is more orange while the sunset provides the same hue shift but with a darker blue after sunset. Through this, we achieve more realism with the lighting and feel of the environment.
Minor Changes
Shoutout
I wanted to give a shoutout to a close friend of mine, Luka, who helped enhance my sound manager to be more robust and decoupled for future sounds. Feel free to check him out here.
That's all for July's development update. More content to come and if you have any suggestions on certain topics that you'd like to know more about, then head on over to our forums and let us know. You can also email our support at Support@digimasteredworks.com.
Roadmap
Milestones To Do:
Milestones Completed:
SECRET
Approved for release: 07/31/22 ID: IB1013
1