Before we export our level, we'll add some finishing touches, like adding a starting point, changing the time of day and maybe add a not so friendly fellow fisherman with a gun. These are the things we'll add to finish up our level:
Of course, a level won't work very well without a point at which you enter it, so we'll need Spawn Point.
In the Create Object -> Components -> Game. Double-click on SpawnPoint and move the cursor into the Viewport. Click to confirm its position. As with other objects, you can use the Move & rotate tools to position it around in the level. Let's put our SpawnPoint at the start of the road that leads to our fishing house.
You may have noticed by now that all the shadows are pitch black. This is especially noticeable inside the house. In real life, there will almost always be some indirect sunlight, so shadows will usually not be completely black. To create some indirect lighting in the shadowy parts of the level, we need to use an Environment Probe.
To add one, we'll go to Create Object -> Misc -> EnvironmentProbe.
Click this button and move your cursor into the Viewport. You'll see an axis gizmo appear. Click again to confirm that you want to place the probe. If you click something else now, the axis gizmo for the probe will disappear and it will be difficult to find it again. To be able to see and grab this probe more easily, it's a good idea to turn the Helpers on. We do this by clicking the Toggle Viewport Helpers button in the top right corner of the Viewport:
You'll now see an icon with a yellow box around it:
Because we want the lighting in the entire level to be affected by this probe, we'll have to set some values in its properties. Select the probe and open the Properties tool. The values we're interested in for now are BoxSizeX, BoxSizeY and BoxSizeZ (under Lua Properties) and Position (under the Transform heading).
Setting the Position
Because it needs to cover the entire level, we'll have to move our Environment Probe to the exact middle of the level. If we don't do this, areas outside of the box may not be affected by it and the shadows in those areas will remain pitch black instead of being affected by indirect sunlight.
We set the location of the probe by changing the Position in the Transform section of the Properties tool (while keeping the Environment Probe selected). Because we want it to be exactly in the middle of the level, we'll use half of the X, Y and Z values of the level dimensions, so 64x64x64. If we check the corners of the level now, we'll see that the box covers the level exactly.
Setting the Box Size
Since we'll want this probe to affect the entire level, we'll change the values to be the same as the dimensions of our level, so while the Environment Probe is selected, we'll go to the Properties Tool, scroll down to the Lua Properties section and change BoxSizeX, BoxSizeY and BoxSizeZ to 128.
If you zoom out to a point where you can see the entire level, you'll see that there's a huge yellow box around the level now.
Enabling the Probe
There are two things left to do to make it work properly. First, we scroll down in the Properties tool while the probe is selected and click Cubemap -> Generate -> Cubemap. The Resource Compiler will now process the texture. Now, we'll switch the probe on by ticking the box behind Active under Lua Properties. You'll instantly see a big difference in the shadows:
EnvironmentProbe not active vs. active
This effect can also be accomplished by turning on the Total Illumination option in the Level Settings (Tools -> Level Editor -> Level Settings) and adjusting its values. However, this is a more expensive option and may decrease framerate.
If you do want to use Total Illumination instead of Environment Probes, make sure you increase the Low Spec Mode value in Tools -> Level Editor -> Level Settings, which will simplify shaders and scale down internal render targets.
Light inside the House
Inside buildings, you usually find some lights that light the room and cast their own shadows inside the building. We'll add one of these in the main room of our fishing house to show what can be done with separate light entities.
This light can be found in the Create Object tool, under Entity -> Lights. We'll grab the one that's simply called Light, drag it into the viewport and attach it to the ceiling.
We'll drag the light down from the ceiling a little bit on its Z axis so it illuminates the ceiling a bit more. You'll notice that the light isn't actually creating shadows yet. To do this, we'll scroll down in the Properties tool until we see the Shadows heading under Lua Properties, and change the value from 0 to 1, ensuring that its shadows are always drawn. To make this light emit a bit more light, we'll increase the DiffuseMultiplier. You'll find this if you scroll up a bit in the Properties panel, under Color. You can enter any value you want to, or click and hold the value in the box so that a slider appears, and drag the cursor left and right until you find a value you like.
You can clearly see the difference inside the house without a light and with one:
House without vs. with light inside
In a First-Person Shooter, you'll usually encounter quite a few enemies that will force you into a kill-or-be-killed situation. Where you put them is up to you, but in the standard Woodlands level, there is only one enemy asset to choose from. Much in the same way we've added other objects, we'll go to Create Object -> Entity -> AI -> Characters and pick the Human. Drag him into the level to the spot where you want to place him.
This enemy will be static, but will still look around and shoot at you when he sees you. You can set all kinds of things up for enemies, like for example patrol routes or areas they won't move outside of, but that's more advanced stuff for another time. For now, we'll add an enemy to make the level a bit more exciting and interactive.
You can place him wherever you want. Remember that you can use the Move and Rotate tools on this enemy too.
Changing the Waves
You'll also notice that the water is quite rough, it looks very stormy. Not exactly what we expect from a tranquil fishing lake.
To change the intensity of the waves, we'll go to Tools -> Level Editor -> Level Settings. In this menu, we'll scroll down to the OceanAnimation header and change all the settings for WindDirection, WindSpeed, WavesSpeed, WavesAmount and WavesSize to 0.
Right now, there are still some bits of terrain that look strange; either they still look like squares of terrain that have just been put down there or the border between the layers looks blurry or unnatural. Unfortunately, we can't make this look perfect, but we can touch it up a little by choosing Paint in the Terrain Editor, choosing a layer, and setting the Min and Max height to the default values (either 0 or 1024). This way, we can paint these layers above or below the exact line we specified in the beginning.
Generating the Terrain Texture
Some areas where two terrain materials meet will have very hard lines and look like this:
Where the blending of multiple terrain materials takes place is defined by the underlying terrain mesh. It can only blend materials between the vertices of the terrain Heightmap. This can make some hard transitions between the 2 terrain layer materials, but a bit of care and fine-tuning while painting down the terrain layers will cover the majority of these hard transitions.
To make the transitions between the terrain materials more gradual and bake the materials into one big material texture, we'll go to the Terrain Editor and click File -> Generate Terrain Texture. Simply click OK and the terrain will look much better:
The hard lines have disappeared and the materials have blended into each other quite well.
Additionally, we'll hide these blend areas between the terrain layers by adding some vegetation on top, to break up the harsh outline:
Right now, the sky is still a bland blue color. To add a nicer-looking sky with clouds, we'll use a so-called Geom Entity. Once again, we'll find this in the Create Object tool. In this tool, choose Geom Entity, navigate to Objects -> Sky and choose forest_skydome.cgf. Drag this entity into your level.
All that's left now is to export our level so that it can be played outside of the Sandbox Editor.