Repository navigation
CustomGame Fog
Fog thickens the further something is from the camera, so the world fades out instead of ending. It also fills the sky behind the terrain, which is the point: zoom out without it and the drawn world stops against a black void.
It works on every map, original or custom, and is configured entirely in
Data\Local\CustomMap.xdc. It needs the plugin active - without it the section is
read and then ignored - and without CustomMap.xdc there is no fog at all.
<Fog> is its own section in CustomMap.xml, unrelated to the <Info> list above
it. One row per map, keyed by map number.
<Fog Mode="Linear">
<Map Number="0" Color="0x8FA07A" Enable="1" Near="1870" Far="3000" Density="0" />
<Map Number="2" Color="0x8FA8C8" Enable="1" Near="1650" Far="2800" Density="0" />
<Map Number="140" Color="0x7A4A30" Enable="1" Near="1430" Far="2600" Density="0" />
<Map Number="160" Color="0x8A6B42" Enable="1" Near="1540" Far="2700" Density="0" />
</Fog>A map with no row gets no fog. Every row lists all six attributes, so all rows read alike;
Density stays 0 under Linear.
| Attribute | Values | Meaning |
|---|---|---|
Mode |
Linear (default), Exp, Exp2
|
how fog thickens with distance |
Mode belongs to the section, not to a row. It is one setting for the whole
game - it cannot vary per map.
| Attribute | Meaning |
|---|---|
Number |
map number. 0..146 are the original maps, 147 and up are custom |
Color |
0xRRGGBB. Also becomes the sky behind the terrain |
Enable |
0 turns a row off but keeps its values. Default on |
Near |
distance where fog starts. Linear only |
Far |
distance where fog reaches full colour. Linear only |
Density |
thickness per unit. Exp and Exp2 only, 0 under Linear
|
Distances are world units: one tile is 100. For scale, a band of roughly
2000..2700 is what the game itself uses.
Linear is the one to use. Fog starts at Near, reaches full colour at Far,
and everything closer than Near is untouched - so the foreground stays clean and
only the distance closes in.
Exp and Exp2 thicken exponentially and never quite reach full. That sounds
better and is worse here, because they have no clear zone at all: fog builds
from the camera outward, so the ground at the player's feet is already hazed and the
whole screen washes over. They are documented because they exist, not because they
are recommended.
If you do switch, Density sits around 0.0002 to 0.0006, and Exp2 stays
clearer up close while thickening harder further out.
Two things decide how fog reads, and the colour matters more than people expect.
Colour. Since the fog colour also paints the sky, a dark saturated colour stops reading as distance and becomes a filter over the whole screen - especially when it is close in tone to the map's own terrain. Pale, desaturated colours read as air; heavy ones read as a tint. A snow map takes a light blue-grey well; a red desert does not want a saturated red-brown, it wants something lighter than its ground.
Near. Distance is measured from the camera, not from the player, and the
camera sits well back and above. A Near that sounds generous in tiles can still
begin at the player's feet. If the foreground looks hazy, raise Near.
Raising Near with Far fixed also narrows the band, so the transition gets
steeper. Past a point that reads as a hard edge rather than gradual thickening -
then move Far with it.
Fog is a look, and some players simply do not want it. config.ini in the client
folder has switches of their own:
[Graphics]
Fog = 1
Culling = 1Fog = 0 turns fog off completely, on every map, whatever CustomMap.xdc asks for.
Culling = 0 keeps every object and every name bar drawn at any distance. Both are
read once at startup, so they need a client restart; both default to on.
This is separate from Enable on a row: Enable="0" is your decision for one map,
Fog = 0 is the player's decision for all of them.
Either remove the row, or keep it and set Enable="0":
<Map Number="140" Color="0x7A4A30" Enable="0" Near="1430" Far="2600" Density="0" />The second form keeps values you have already tuned.
A map script can override its map's fog while the player is on it:
Map.Fog(0x2A3340, 900, 2600) -- colour, near, far
Map.Fog(false) -- offThe override lasts until the player leaves the map. Configure fog in
CustomMap.xdc unless it genuinely has to change while the map is running.
Map objects fade out from a little past half of Far and are fully transparent beyond
it, so scenery comes out of the fog instead of popping in. With the camera plugin
active, name and health bars of monsters and players beyond Far are hidden too.
Past Far an object is not drawn at all, and its effects stop with it.
Effects that add light - fire, sparks, magic, glowing parts of models - fade into the fog with distance like the rest of the scene, instead of turning into squares of fog colour.
This uses the row's Far whether the fog is drawn or not - Enable="0" or the
player's Fog = 0 still cut there. A map without a row, or with no Far, cuts
nothing; the player's Culling = 0 turns it off everywhere.
Keep Far at or below the distance where the client starts drawing objects, or the
step still shows through. Too low and the world closes in.
-
Adding a map - the rest of
CustomMap.xdc -
Map scripts -
Map.Fogamong the other Map functions
MuLua Scripting Plugin | Home
🖼️ Lua UI
- File map
- Creating windows
- Client and server
- Designing a window
- Protocol
- Scrolling and scrollbars
- Controls
- Custom text
- Text input
- Debug console
- Bitmap Slicer
- Encrypting scripts
Maps
Monsters
Shared
Version 1.14 | 2026-09-09