Cold Takes/10 - The Smartest Unit in Zero-K

From Zero-K
Jump to navigation Jump to search

Cold Take #10 - The Smartest Unit in Zero-K


Most player actions in real time strategy boil down to giving commands. After all, these are games about telling units what to do. But there is a subtle difference between RTS and most other genres, in that players tend to act indirectly, by assigning goals to units. The game world itself is only ever affected by units as they try to achieve their goals. This takes a certain level of unit intelligence, and the stakes are high. The fantasy of commanding an army can be shattered by a single unit wandering off in a weird direction.

Issuing commands also has to feel good, since it is your primary way of interacting with the game. This implies that common commands should be small and simple, like short words. In fact, commands can be thought of as the language used by players to tell their units what to do. This analogy turns unit control into a communication problem; how can the player communicate their grand plans to the fragile bundles of code that stand-in for the brains of their units?

The units of Zero-K are relatively smart. Here are some examples.

  • Units in almost all games know how to close range with the enemy, but Zero-K units also know how to step backwards when the enemy gets uncomfortably close.
  • They can be told to hold their fire against cheap targets, and know how to stop short of firing enough missiles to kill something twice over.
  • They can be told to repair or reclaim everything in an area, rather than requiring that the player point out each target individually.
  • Some can be told to avoid wasting their precious reload time on wobbly radar dots, while others can be told to fire in the general direction of distant targets.
  • Units even know how to spread themselves out along a line.

File:056759079cd17b79367266a95b66b6ab58d43ff8.gif

The examples above hardly seem earth-shattering, but that is by design. Zero-K units are only much smarter than average because they understand a wider range of commands. The more complicated behaviours, such as the ability to move away from enemies, are optional. Set a unit to hold position and avoid telling it to Attack Move, and it will stay put. This is vital because the principle fight your opponent, not over-automated ingrained unit behaviours is just as important as fight your opponent, not the UI.

In short, Zero-K units are smart by virtue of their expanded command vocabulary, rather than by making decisions themselves. Units should not be making significant decisions, those are for the player to make, because otherwise we start diluting the "Strategy" in RTS. To this end, the complexity of each command has to be quite limited. Notice how the examples above were explained in about half a sentence? You have to be able to to describe your intention when giving commands, otherwise unit control becomes a process of clicking random buttons while hoping for a good result. So unit behaviours need to be predictable. For example, the "keep enemies at a distance" aspect of Attack Move only considers the closest enemy, since a whole-battle view would be too chaotic.

File:Ecbdae9b8372c79ef60a5b8f0f83e8c6b2769771.png

Commands are great, but how do they relate to the smartest unit in Zero-K? Well, players assign goals to units, which the units then try to execute. Achieving goals seems like a good measure of intelligence, so we can think of the smartest unit as the one that is the best at using its abilities to achieve goals. This includes goals that the player has trouble communicating due to a limited command vocabulary, so as to not give a free pass to abilities that are trapped behind poor UI. Also, since we are talking about game AI, it is more useful to think in terms of "least stupid", where stupidity is the misuse of an ability in pursuit of some goal.

The stupidity formulation of smartness turns abilities into liabilities. For example, if you tell a unit to move East and it ends up walking West, then we would say it uses its movement stupidly. But if the unit has no legs, so fails to move at all, we can hardly blame its failure to achieve the goal on its inbuilt AI. Thus, the only units with "perfect" pathfinding are those with the inability to move. And being incapable of failing is almost like intelligence.

File:3fcd786c522d0665bc02a17cd803d9d5b9cb3274.png

So there you have it. The smartest unit in Zero-K is the humble Storage. It has a single ability - to blow itself up - and it is very rarely a good idea. Consider some alternative candidates. Most energy structures have impressive explosions, so it is more conceivable that a player would want to give them some sort of Fire At Will stance. Solar Collectors are out due to the wealth of agency bestowed upon them by the ability to armour up. But perhaps you have a more normal, less technical, definition of unit. One that involves the ability to move. In that case, I might have to argue for Aspis, the mobile shield generator, for the title of smartest unit. But if you have alternative candidates, be sure to post them.

So let's take stock of Aspis's abilities. Being unarmed is a good start, since deciding where and when to fire is a whole can of worms. Then there is the issue of pathfinding, which I could have avoided by nominating a plane or gunship. However, with great mobility comes great responsibility, so even Owls need to be pretty smart to not fly into an untimely end. No, a slow ground unit is safer, as its low speed makes it less responsible for its fate. And besides, the pathfinding in Zero-K is pretty good.

Aspis can also charge its shield, float, morph, and self-destruct. Floating and morphing are niche options for Aspis, and self-destructing is very rarely good. That leaves charging, which can be toggled on or off, and is integrated into the priority system. So Aspis has a pretty good command vocabulary in this area. Remember, it is not on Aspis to optimise its energy drain for the overall economy, it just needs to have a rich set of ways for the player to tell it what to do. So Aspis is very good at using its abilities. Now, those of you with some shield experience might be wondering, what about shield link? Aspis can share its shield charge with nearby shields, and there are some well known ways to exploit this ability.

File:5a1865aa12a0bbedce11412412adc387007cebcb.png

Aspis' bid for the title of smartest unit hinges on the fact that shield link is a passive ability. Think back to Storage, is it "smart" or "stupid" for blocking projectiles? No, being hit by projectiles is part of being a Storage, it is a passive rather than an active ability. So too with shield link. If two allied shields touch, they share charge. Nobody can control it, and this sort of thing is a powerful technique for making units seem smart. Simply avoid giving units opportunities to be stupid.

Imagine if Aspis could control when to link, it would be an absolute AI nightmare. Linking is great when you need to pump charge into a Felon, but it can send a shield cluster below the threshold required to block tacnukes. The decision to link or not would take global information into account, and the best course of action would change too fast for players to manually control. A configurable linking stance would be unwieldy and riddled with edge cases, making it unpredictable. So it is better to keep linking innate, and let both sides of a battle work its straightforward behaviour into their plans.

File:412d445276616335df2078f22bde3cfa91d5d03c.png

Shield link is the highest-profile case of making an ability passive to avoid tricky optimisations, but we have many other more subtle ones. For example, Snitch and Imp have the ability to hide themselves by burrowing when stationary. If they took a significant amount of time to unburrow, then whether to burrow would be a decision with many strategic factors. Rather than make this decision, or make players manually press the burrow button, we made unburrowing near-instantaneous. Here are a few more examples.

  • Bulkhead and Fencer pack up quickly for similar reasons.
  • Units cannot hurt themselves with area of effect damage, as firing safely has tradeoffs.
  • Vehicles are very bad at moving in reverse, so that they do not seriously consider doing it.

To sum up, unit intelligence has three parts; vocabulary, competence, and not expecting too much. Think about what is going on next time you encounter a stupid unit. Does it lack the command language to understand what you are trying to tell it, does it lack the competence to achieve the goal, or do its abilities mean it has to solve complex optimisation problems which lack a satisfactory answer?