#13 Enhancing Scenery & Buildings

 

SECRET

DigiMastered Works LLC

Office of Development

DMW107IB1013

Date 08/03/2022 12:02 PM

THIS IS FINALIZED INTELLIGENCE

 

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.

A visualization of depth being added to the water's edge.

Map Generation - Water Edge Depth Visualization

A visualization of depth being added to the water's edge.

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:

CountryMapSceneManager.cs

// 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
  •  
    Due to location triggers being added to work with the fog particle system, our existing triggers were not working with agents entering/exiting locations. This has been fixed.
  •  
    The game camera now has a zoom in/out VFX. You might have seen it in some of the videos in today's article.
  •  
    Global lighting has been enhanced for the day/night cycle.
  •  
    Location data is now updated on the fly into the database via the save manager. The only other previous objects were agents but most if not all objects are expected to be added to the save manager.
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:

  •  
    2022 Q3 - Development of core mechanics and game story
  •  
    2022 Q4 - Internal testing of core mechanics and Alpha testing
  •  
    2023 Q1 - Internal testing continued with review of core engine and mechanics
  •  
    2023 Q2 - Expansion of core features and Beta Testing
  •  
    2023 Q3 - Add enhancements from Beta Testing
  •  
    2023 Q4 - TBA

Milestones Completed:

  •  
    2021 Q1 - Initial designs and planning
  •  
    2021 Q2 - Initial designs and planning
  •  
    2021 Q3 - Initial designs and planning
  •  
    2021 Q4 - Development of core engine
  •  
    2022 Q1 - Development of core mechanics and game story
  •  
    2022 Q2 - Development of core mechanics and game story

SECRET

Approved for release: 07/31/22 ID: IB1013

1