





🌟 Special thanks to our amazing supporters:
✨ $10 Tier: [Geeks Love Detail]
🌈 $5 Tier: [Arch Toasty][Benedikt][David Martínez Martí]
Welcome back to Cold Takes for 2025. The goal this year is to post one every three weeks, but to not fight for space with patch notes.
Just about every real time strategy game has fog of war. Without it, you could watch the enemy base and start countering anything they do. This dynamic can work - there are whole genres built around perfect information - but it seems ill-suited for games with incremental real-time decisions that take time to pay off. But before delving into the role of vision, it is worth taking a look at how it works.
Fog of war can be dead simple. All you need to do is draw a circle around each unit and structure, then declare everything within a circle to be visible. Plenty of games stop there, but I suspect the majority take the extra step of considering terraces and trees. A terrace sight system has clearly defined levels of terrain, with units on lower levels unable to see onto higher ones, and games often block sight with opaque static features, such as trees and buildings. And such simplicity works great, up until the simulationists get involved.
Games of the TA lineage are more simulationist than your Starcrafts or Command and Conquers. That is, they care more about mechanics that match reality, or at least seem to match reality. Zero-K often downplays this aspect, but it is still a bit too simulationist to use a terrace-and-tree sight system. For one thing, we care too much about terrain to approximate the expressiveness of hills and mountains by a series of plateaus with ramps between them. This makes the simulationist route attractive, but it is hard to know where to stop without clear guidance from other design goals.
Before thinking about those goals, it is instructive to consider what fully realistic sight looks like. Such a system would involve drawing straight lines between the "eye" of each unit, and everything the unit might want to see. If the line has a clear unobstructed path, then the unit can see the target, and we can even draw lines to the edges of units to see them when they poke around corners. This is a general technique called ray tracing, and it reflects how light behaves in the real world. But would such a system work for Zero-K, what does the rest of the design have to say about it?
To cut the chase, we will appeal to fight your opponent, not the UI. In short, the interface is your friend, it should not get in the way, and it should tell you everything you need to know about your forces. This includes information about what your forces can or cannot see. An interface that fulfils this promise has to be clear and simple, which is a problem for realistic sight. The crux of the matter is that you need to know what you don't know.
Any old sight visualisation can tell you what you know you know. If you can see a giant robot peeking over a cliff, then the UI just has to draw the giant robot. But how do you rule out the existence of a sneaky medium-sized robot? The UI has to tell you whether you would be able to see one if it were present. The standard solution - spooky black fog - is a great representation of the unknown, but it breaks if you try to do too much with it. Fog is inherently fuzzy, so how is it going to tell you that you could spot a giant robot, but not a medium-sized one? Shifts in opacity are hard to make out to any degree of accuracy, and clearer cues such as contouring or colour coding would be quite busy. So Zero-K straight-up avoids having the visibility of a unit depend on its size.
Here is the trick to line of sight, used by many games: units never actually see each other, they only ever see parts of the terrain. The line of sight shader blurs this fact, but vision works on a grid, with the visibility of a square determined by ray traces to the middle of each square. The ray starts at the "eye" of each unit, so tall units are better at seeing over terrain, while the end hovers a fixed distance above the terrain (or the surface of the ocean). Units are visible if they are on visible terrain, which makes the potential visibility of enemy units very easy to tell the player.
Zero-K sight is still a bit janky compared to simple terrace-and-tree. Smooth terrain makes it difficult to precisely predict what one of your own units will be able to see when it reaches a given location, but this is significantly better than not even knowing what it can see once it arrives. To ameliorate this further we tune the heights of the hover ray trace targets to be fairly forgiving, although in theory they represent the height of an "average" unit.
So there you have it, sight detection in Zero-K is based on whether a unit of "average" height would be visible, because doing it this way allows for simple binary fog of war to tell the player everything they need to know. Except, this is only actually true for ground units. It is time to talk about the exceptions.
Projectiles, explosions, and non-landed aircraft ignore the usual sight rules, instead, using a circular sight system called air line of sight. This is a parallel sight system, but we make sure the air line of sight range of everything matches their standard line of sight range. The system is a nod to realism, since it lets you see planes without being able to see the terrain underneath. On the visuals side, it is nice to have projectiles not blip out of vision when they are fired over a ravine. Why not add air line of sight for particular giant robots? Consistency and clear thresholds; a plane is clearly a plane, but there is no clear cutoff between giant and non-giant robot.
Except, that is not quite true either, as giant robots can often be seen by air line of sight. In fact, anything that has fired a weapon in the last few seconds is visible to air line of sight. This is sensible, since muzzle flares are hard to hide, but it also solves a few edge cases. Without this mechanic you would be able to position turrets behind tall cliffs, making them very hard to target, but still able to shoot at approaching units. As a bonus, a giant robot that spots your base over the edge of a cliff is likely to start shooting at you, so it is almost as if it were visible to air line of sight to begin with.
Sometimes I wonder how many people know about air line of sight. It is one of those mechanics that smooths things over in the background, making the game look good and make sense. Being unaware of it seems fine, and there is a cost to making it more visible. I know from experience that varying the opacity of fog does not look great, because air line of sight used to be drawn as a lighter form of fog. The engine default for air line of sight is 150% of sight range, but we override it to match sight range so that we can avoid needing to draw it (see above). I picked a map with good contrast for these images, but in general it is hard to make half-opacity fog of war sufficiently visible on all maps.
Zero-K also has radar and sonar, but they are nothing new to someone who understands line of sight. Radar is just a form of sight, ray tracing to the same points hovering above the terrain, while sonar is a simple circular system. It turns out the engine developers did not want to implement a full acoustic wave propagation and detection system. That is it for sight. Why units would want to see each other will have to wait, but at least there is now a record of how.
Index of Cold Takes
[ 6078 ]
[ 2031 ]
[ 4226 ]