Terraform walls block less LOS when not aligned to the 32-elmo LOS grid
A player reported in Discord that a commander next to an Alt+N terraform wall sees the ground a short way behind it, and that a second wall of the same height did not do this.
Cause: LOS uses the level-2 mip heightmap (losMipLevel = 2, 32-elmo cells), and each cell is the average of the terrain under it (CReadMap::UpdateMipHeightmaps). An Alt+N wall has a 32-elmo top at +54, with its points on a 16-elmo grid. If the top lines up with a 32-elmo cell, LOS sees the wall at 54. If it sits across two cells, LOS sees two cells at 40.75. The engine also rounds the eye height to 16-elmo steps, and that rounding depends on ground height.
Measured on the bench (real Alt+N walls made by the terraform gadget, viewer 40 elmos from the wall). The shadow is the LOS cells hidden behind the wall, counted from the viewer:
| viewer | wall top | terrain hides | LOS hides |
|---|---|---|---|
| Strike trainer commander (eye 70) | aligned | cells 3-9 | 3-9 (3-15, the LOS edge, at another ground height) |
| Strike trainer commander | across two cells | 3-8 | 3-4 or 3-5 |
| Conjurer (eye 47) | either | to the LOS edge | to the LOS edge |
Every hidden/visible cell matched a model of the averaged mip exactly. RecoilEngine#3629 (mip update bounds) has no effect on these walls.
Left: wall top aligned with the LOS grid. Right: the same wall 16 elmos further, across two cells; the commander sees past it.

Options:
losMipLevel = 1in modrules: 16-elmo LOS cells, so every straight wall lines up and the eye rounding halves. LOS raycasting covers about 4 times as many cells, so it costs more; I can measure that in a large game if you want.- An engine option to build the LOS mip from the maximum height instead of the average. Walls keep their height, but rough ground and hill crests would also block more.
- Snap wall points to the 32-elmo grid. Coarser placement, and diagonal walls are still averaged.
- Leave it: thin walls are not reliable LOS blockers for tall units.
Hm this is annoying as consistency would be nice. Slightly higher walls should be more consistent though due to the shraka pyramid. I'd double the LOS resolution if it were sufficiently free. The engine change sounds like it would have too many side effects, but would be worth trying it it existed.
Measured losMipLevel = 1: aligned and straddling Alt+N walls then block LOS the same, but sim time per frame went up 16-24% (live 4v4 CAI late game 3.78 -> 4.45 ms; the 29-player replay late game 4.72 -> 5.87 ms). So not free.