Files
llamamod/docs/manual/12-environment.md

14 KiB
Raw Permalink Blame History

Environment: zones, fog, music and light

This chapter covers everything that sets the mood of a level: fog and draw distance, sky and backdrop colours, music, teleports between areas, the lights that colour object models and the baked vertex colours that light the level geometry itself.

Most of it lives in the Environment panel (left dock, next to the Outliner) with its three tabs Zones, Lights and Lighting, plus four tools: Zones, Lights, Paint vertex colours and the region painter of the next chapter (Visibility regions).

The Environment panel with the zone list, the selected zone in the viewport and its Inspector section

How the game uses zones

The game stores a small list of environment zones in every level. Each zone holds a complete environment: fog mode and distances, fog/sky colour, the ambient colour for object models, a music track and a sky model. There are two kinds:

  • The start zone (exactly one per level). The level begins with its fog, colours and music. Its trigger cell is not used – the original levels park it outside the playfield at cell (3, y, 0).
  • Teleport / environment zones. Each one belongs to a trigger cell of the grid. When the player walks onto an exit floor (collision material 16) or into a door object (RubyIdolDoor, PressurePadDoor) in that cell, the game looks up the zone of the player's cell, moves the player to the zone's target facing the zone's direction, and switches to the zone's fog, colours and music. The house doors in the Village work this way: you enter a door and arrive inside the house, with the indoor fog and music.

A zone can also only switch the environment without moving the player: untick Move the player here in its Inspector section. That is how you make, for example, a cave entrance that turns the fog dark while the llama keeps walking.

Engine limit: the game switches zones only through these triggers. There is no "area" in which a zone is active – after a teleport the new environment stays until the next trigger.

The Zones tab

Level → Environment zones opens the Environment panel on this tab.

Fog preview

Option What it does
Live fog in the viewport Draws the game's fog in the 3D view: geometry fades to the fog colour and everything beyond the fog end disappears, just like in the game. Also View → Fog preview.
Zone Whose fog is shown: Camera (nearest zone area) guesses the zone from where the camera looks (nearest teleport target or the player start), Start zone, or Selected zone only. A selected zone is always previewed.
Detail The game's detail setting Minimum, Medium or Maximum: the fog distances are interpolated between the Min and Max pairs of the zone.

The line below shows which zone is previewed and its fog distances in cells. The distances are measured from the point the camera orbits around (the game camera follows the llama a few cells behind), so orbiting shows the "visible bubble" around that point. When you zoom far out for an overview, the preview pauses and says Zoom in to see the fog of ….

Fog in the game: the original zone (left) and the same spot with a red fog set in the editor (right)

Zone list

The list shows the start zone first (Start zone (level default)), then every other zone with a swatch of its fog colour, its trigger → target, the fog end distance and the music track. Clicking selects the zone (also in the viewport and the Inspector), double-clicking frames it.

Button What it does
+ Teleport Starts the Zones tool: click the trigger cell, then the arrival point.
+ Environment Adds a zone that only switches fog, colours and music, at the cell the camera looks at.
delete Deletes the selected zones.
frame Frames the selection in the viewport.

New zones copy the environment of the start zone, so they look the same until you change them.

Environment zone section

Selecting a zone shows the Environment zone section in the Inspector. Its header has Frame, Make start zone and Duplicate (a copy one cell east). Raw fields whose meaning is unknown stay in the generic properties below the section.

Trigger

Field Meaning
Cell X, Cell Z (row) The trigger cell. It needs an exit floor (material 16) or a door object, otherwise the teleport never fires.
Cell Y (height) The height of the trigger, for stacked zones in one cell.
Height test When the zone matches: player y ≤ cell Y, player y ≤ cell Y − 1 or player y ≤ cell Y + 1 (no step). The lowest matching zone of the cell wins.

For the start zone this part only explains that the trigger cell is not used.

Teleport target

Field Meaning
Move the player here On: the player is moved to the target. Off: only fog, colours and music change.
Target X / Y / Z Arrival point in cells.
Facing (°) Direction the player looks after arriving: 0 = +z (down the grid), 90 = +x (east).
Step forward Cells the player is pushed along the facing after the teleport, so they do not stand on the exit floor again. Not used with the height test Y + 1.

Fog and draw distance

Field Meaning
Mode 0 – no fog, 1 – darkness, light around the player (radius = fog start…end), 2 – fog (table), 3 – fog (vertex, most levels). No original level uses mode 1.
fog ramp bar Shows the fog band from start to end in the zone colour.
Draw distance Draw distance in cells at detail Min, Medium and Max. Beyond it nothing is drawn.
Start (Min), End (Min) Fog start and end at detail Minimum.
Start (Max), End (Max) Fog start and end at detail Maximum. If the Max start is not above the Min start, the game uses 1.5 × the Min pair.
Fog / sky colour The colour everything fades to; also the backdrop colour behind the sky.
Ambient (objects) Added to the light of all object models in this zone. Tiles are not affected – they use their vertex colours.

Colour pickers update the viewport live while you pick; the whole pick is one undo step.

Tip: the original levels end their fog between 7 and 23 cells. Much shorter fog makes a wall right in front of the player, much longer fog is slow on old PCs and wakes enemies from far away.

Music and sky

Field Meaning
Music Track started when the zone becomes active (music/<name>.ASF): VILLAGE, JUNGLE1, RIVER, CITY, CATACOMB, LAB, BALLOON, KRONK, VICTORY … 0 – (none) stops the music. Tracks marked (no file on the CD) have no music file (on the German CD) – pick another one.
Sky model The object model drawn as the sky dome (one of the sky models used in this level), or none.
Sky yaw Turns the sky dome.

Zones tool

The Zones tool (toolbar group env, or + Teleport) edits triggers and targets directly in the viewport. The options bar has two modes:

Mode Click / drag
Target Nothing selected: a click on a cell creates a new zone there (its trigger) – then click where the player should arrive. With a zone selected: click or drag places its arrival point; Shift+drag turns the facing (22.5° steps).
Trigger cell Clicks move the selected zone's trigger cell.

[ and ] turn the facing of the selected zone by 22.5°.

The viewport shows a ring and a facing arrow at every zone target (layer Zone targets & facing). The selected zone additionally gets a filled trigger cell, a box and an arc to its target. The target ring is pickable: clicking it selects the zone.

Lights

The Lights tab lists all lights of the level (colour swatch, type, position and radius).

Control What it does
Preview lights on objects Lights every object model in the viewport with the engine's formula (also View → Light objects (LGHT preview)).
+ Point Starts the Lights tool.
+ Directional Adds a directional light (a sun).
delete Deletes the selected lights.

Engine limit: lights only light object models (characters, pickups, props), per vertex: the zone's ambient colour + all directional lights + the nearest point lights (6 at most). The level geometry (tiles) is never lit at run time – it keeps its baked vertex colours. To light tiles, bake the lighting or paint vertex colours.

Directional lights have no position; the viewport draws them as diamonds with a direction line above the player start. A new level keeps the base level's directional lights (Village: three) and none of its point lights.

The Lights tab with the point lights of the Village and their radius rings

Light section

Field Meaning
Light type Directional (sun), Point light or Negative point light (darkens). Other type numbers are ignored by the engine.
Colour Light colour (red / green / blue).
Intensity 1.0 = colour value 128 (the engine doubles it), 2.0 = maximum.
Azimuth (°), Elevation (°) Directional lights: where the light comes from (0 = from +z, 90 = from +x / east).
X, Y (height), Z (row) Point lights: position in cells.
Full radius Full strength up to this distance (cells).
Falloff radius Linear falloff to zero at this distance; nothing beyond.
Flicker The engine randomly scales the light ×1.5 / ×0.5 every frame (torches, fires).

Frame and Duplicate are in the section header.

Lights tool

Click on the level to place a point light one cell above the surface; drag to set its radius. The options bar chooses a colour preset – Torch (orange), Fire (red), Lamp (warm white), Magic (cyan), Moon (blue), Glow (green) – the Height above the surface and the Radius.

In the viewport, directional lights are shown as arrows above the level centre and point lights as radius rings (layer Light gizmos); a selected point light shows spheres for both radii.

Baking the lighting

The Lighting tab (also Level → Bake lighting…) computes new vertex colours for the tiles: sun light with real shadows, a sky/ground hemisphere and ambient occlusion in corners. A bake of the whole Village takes under a second and is one undo step.

Lighting tab after baking the Night preset

Group Options
Preset Day, Dusk, Night, Cave, Flat (no lighting) fill in the values below (nothing changes until you bake). Level's current loads the level's own lighting settings.
Sun Azimuth (°) (0 = from south, 90 = from east), Elevation (°), Strength, Sun colour.
Sky Sky colour (light from above), Ground colour (light from below), Ambient occlusion (darkening of corners and crevices), AO radius (cells), Shadow light (0 = black shadows, 1 = no shadows).
Bake All tiles or Selected tiles; Add point lights (LGHT) to tiles (the level's point lights also brighten the tiles, with shadows); Also light brushes (level setting) – brushes are lit when they are built, from the level's lighting settings, so the bake can store its values there; Set start zone fog & ambient colour – takes the preset's fog and ambient colour into the start zone.
Display Textured or Vertex colours only; Paint vertex colours switches to the brush.

Press Bake lighting. The status line says how many tiles were baked.

The same village spot in the game before and after a night bake

Note: the bake reproduces the look of LlamaMod's level builder, not the hand-tuned original lighting of Argonaut. Bake Selected tiles if you only want to relight a part of an original level.

Painting vertex colours

The Paint vertex colours tool (V) is a brush for the vertex colours of tiles – darken a corner, warm up a fireplace, add a glow under a lamp. Every stroke is one undo step.

Painting a dark patch onto the village ground

Option Meaning
Mode Paint (blend towards the colour), Lighten, Darken, Smooth (evens out neighbouring vertices).
colour The paint colour. Ctrl+click on the level picks a colour.
Bright Brightness: 1.0 = the texture's own colour, 2.0 = maximum (the engine doubles vertex colours).
Radius Brush radius in cells (0.1–16, default 1.5).
Str. Strength per dab (0.01–1, default 0.5).
Falloff Smooth, Linear or Constant towards the brush edge.
Selection only Only paint the selected tiles.

Tip: tiles that share a model still have their own vertex colours, so painting never changes other tiles.

View options

Menu item Effect
View → Fog preview Live fog of the zone (see Fog preview).
View → Light objects (LGHT preview) Engine lighting on object models.
View → Vertex colours only (Shift+V) Shows only the baked/painted vertex colours, without textures – useful to judge the lighting.

Environment checks

Level → Check for problems and every build also check the environment:

Severity Problem
warning No start zone (the level starts without its fog, colours and music), or several start zones (the last one wins).
warning Fog ends after less than 3 cells even at detail Maximum, or the draw distance is above 30 cells.
warning Fog start is not before fog end.
warning A trigger cell is outside the grid (never entered).
error A teleport target is outside the grid.
info No exit floor (material 16) or door object in a trigger cell – the teleport only fires on an exit floor.
warning Tiles with flat grey (unlit) or completely black vertex colours – bake the lighting.
warning / info Point lights with falloff radius 0 or smaller than the full radius, black lights, light types the engine ignores.

Double-click a problem to select the zone or light. The visibility checks are described in Visibility regions.