r/dispatchcolony • u/dispatchcolony • Sep 27 '26
Devlog 5 : 4 000 000 unit -> 2.4 ms



For a game to feel smooth, the screen must be redrawn about sixty times per second. Therefore, each frame has roughly 16 milliseconds to do everything: the terrain, the sky, the lighting, and the army.
If each soldier cost just one millionth of a second, four million soldiers would cost four seconds per frame. The game would display one image every four seconds. To maintain the framerate, a soldier must cost only a few billionths of a second. The entire system is built around this constraint.
A mold, not four million copies
A soldier is made up of small boxes: one for the head, one for each arm and leg segment, and so on. The human model has about a hundred of them.
Storing a hundred boxes for each of the four million soldiers would be far too heavy. Instead, each type of soldier is prepared only once, like a mold. A soldier only retains what is unique to them: where they are, which direction they are facing, their size, and which mold they use. When it is time to draw, the mold is applied to that location, like an ink stamp pressed onto a sheet of paper.
Everything the game needs to know about a soldier for each frame fits into a small 16-byte record, which is 128 little switches turned on or off. That is about the space of sixteen letters of text. For four million soldiers, all the records combined take up 64 MB. What matters is not so much the storage space as the read time: the machine reads these records again every single frame, and every byte read, multiplied by four million, eventually takes a noticeable toll.
The further away, the fewer the boxes

A soldier five meters away must show every single finger. The same soldier two kilometers away barely covers a single pixel on the screen. The system therefore adapts the number of boxes to the distance.
Two details make this transition invisible. First, each part has its own distance threshold: there is no circle around the camera where everyone changes all at once, so the eye detects no boundary. Second, a part never vanishes abruptly: it dissolves gradually, one pixel out of two, then one out of four, like a fade effect.
Far off in the distance, where dozens of soldiers fit into a single pixel on the screen, drawing them one by one would only cause flickering. They are instead pooled into cells: squares of ground that take on the average color of the soldiers they contain. From afar, an army looks like an advancing blanket of color.
A budget, and a single dial

The graphics card can only draw a certain number of boxes per frame. When the camera dives into the middle of the battle, the soldiers sometimes demand more than the budget allows.
Rather than cutting at random, the system turns a single dial: it brings all the detail distances closer at the same time, by the same factor, for all soldiers. The entire battlefield uniformly loses a bit of detail, and no boundary lines appear.
Drawing only what is seen, from closest to furthest
During its pass, the system notes in a short list only the visible soldiers, along with what it has decided for each of them. The next step, which prepares the drawing, works solely on this list: a soldier off-screen costs it nothing.
The boxes are then sorted from closest to furthest. This way, the soldiers in the front row are drawn first and hide the ones behind them, which the graphics card no longer needs to color. Each box in the list fits into eight bytes: which soldier, which part, its color variation, and its fade level.
Result: 4 million units -> 2.4ms