Cold Takes/16 - Aim and Fire

From Zero-K
Revision as of 18:13, 15 September 2024 by RandomX (talk | contribs) (Init. transfer.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

it is finally time to talk about weapons, starting with how they are fired. The weapon design space is huge, thanks to projectile physics, and we put it to good use. But such freedom is a double-edged sword, since much of the full design space contains frustrating or incomprehensible mechanics. There are interesting games in this space, but Zero-K is first and foremost a strategy game, which means it needs to be stable and predictable enough to reward planning. So, to combat the full freedom of physics, we installed a few guard rails around weapon design; a loose set of rules that, if followed, limit how badly a weapon can break the game.

There are rules for many aspects of weapon design, but those around aiming and firing are some of the most important. The rules consider the following three aspects of our design goals.

  • Intelligence - Aiming and firing are just abilities, and units should be good at using their abilities.
  • Predictability - Players should be able to learn how units aim and what causes them to fire.
  • Verisimilitude - Weapons should feel like they can be used in ways that make sense within the observable fiction of the game world, rather than just being a bundle of arbitrary mechanics.

As you might have guessed, projectile physics causes most of the conflicts between these goals. This specific set of problems is mostly limited to descendants of Total Annihilation, since projectiles have a minor role in other types of games. The standard RTS projectile is a animation and a short delay between firing and dealing damage, since they are guaranteed to hit their target, and only their target (unless something unusual happens, such as death or teleportation). This limits just how stupidly units might misuse a weapon, and it allows weapon fire to be quite predictable.

File:026fb2312c1c5586d539bbe4a34af0e2ffb84aa3.png

Total Annihilation probably used projectile physics to enhance verisimilitude, but I would disagree that this means other games inherently lack it. Every RTS simplifies many aspects of reality, and simplified projectiles are quite popular. How closely a simulation hews to reality is only loosely related to the experience of a reasonably consistent and believable game world. There are, of course, many players that seek out strict realism, but Zero-K does not simulate projectiles to be realistic. We use physics to make intricate, yet fundamentally simple, mechanics that reward intuition and creativity. But I digress, physics generally seems to cause problems for the goals above, rather than solve them.

Physical projectiles are hard to use. You shoot at the enemy, but then the enemy moves and the projectile hits empty ground. So you shoot where the enemy is going to be, but they dodge the other way, or you miss due to innate weapon spread. Units do a decent job at leading their shots, but many still miss. This makes deciding when to shoot of utmost importance, but this decision has to be quick, which risks making it unpredictable.

File:C44233e0938f15b2faa15c6f9afe6901a5209c2a.png

To make matters worse, the sense of verisimilitude subscribed to by Zero-K says that, ideally, weapons only provide two in-world abilities:

  • Change where the weapon is aiming.
  • Fire the weapon.
  • In other words, we think of units as having the same basic abilities as a player in a first person shooter. In practice the implementation does not go that far, but we do at least let units blindly fire at the ground, since a cloaked bomb might be there. But even this limited ability means that, in theory, players could manually control every shot, which raises the spectre of fighting the UI. So units have to be smart enough for players to not need to resort to manual control.

We could write some whizz-bang first person shooter-level AI, but then battles would amount to little more than watching units careen around the screen. This brings us back to predictability, so perhaps intelligence and predictability are fundamentally opposed. Worry not, the deadlock can be broken by imposing limitations upon weapons that are designed to make them simpler, so that units can be reasonably smart without breaking the "intelligence budget" of predictability. These limitations tend to be quite gamey, beyond the realm of pure physics, which causes trade-offs with verisimilitude.

File:9b17039d3798b5a330976c7f3c0650dfb6fdf605.png

Consider the ubiquitous range ring and its implications for homing missiles. A Fencer can only fire missiles at enemies within a circle around itself, but an enemy that dances just out of this circle will still be hit, which is a bit weird. What happens if we let just the goals argue it out?

Verisimilitude
That's ridiculous! The missile can demonstrably hit units beyond its arbitrary "range". Fencer should be firing in more situations, at everything that it can physically hit.
Intelligence
Hmm... sounds exploitable, we don't want to fire at things barely within physical range. Borderline targets could (and should) just step back and let the missile run out of fuel before impact.
Predictability
We could just only let missiles fire at structures, not units. Those are sure to stay still.
Verisimilitude
That's super arbitrary!
Intelligence
How about we use the target's max speed, accounting for slow and EMP, hill climbing, facing, angular velocity....
Performance
uhh...
Predictability
And how is anyone meant to know which combination of factors will or will not result in a Fencer firing a missile?

At this point we might placate verisimilitude with some mumbling about "missile lock range", but background lore is no match for what players can observe ingame. Besides, we have many ballistic weapons that could also shoot a bit beyond their range ring, and this cannot be explained by any sort of "missile lock". So the the fact is that verisimilitude lost this battle, and the best we can do is make these situations as simple and consistent as possible.

File:C380f7bab9d61e4a39b5f4ca6e6a6238a4046c48.png

The verisimilitude of Zero-K demands that units can do everything that they look like they are capable of, predictability demands whatever is simplest to communicate to players, and intelligence only cares that the resulting ability is hard to screw up. Designing a weapon with these constraints in mind looks a bit like this:

  • Imagine the ideal form of the weapon, packed full of verisimilitude. A Glaive holds a gun in its hands. It can actuate its arms in any direction and pull the trigger at any time. It is a real robot.
  • Next consider the proper use of the weapon. Should Glaives spend their time shooting wildly into the sky? Probably not, unless an enemy is flying overhead.
  • Then impose as many behavioural or mechanical limitations as you like, provided that you only cull the stupid or pointless ways that the ideal weapon might have been used. These should help the unit avoid being stupid. Shooting into the sky is almost always pointless, so Glaives only do it when there is an enemy flying overhead.
  • Finally, add a small set of standard limitations, such as range rings. Consistency is key here, since the goal is predictability, and arbitrary limitations hurt verisimilitude the most.

In practise, the process is not as simple as working through four steps. Most limitations affects all three aspects simultaneously, and sometimes you need to revise the ideal version of the weapon to make the downstream implementation workable. It is also possible to start at the implementation, then work backwards to figure out what sort of ideal weapon would result in it.

One of the most important corollaries of the process is that weapon behaviour cannot depend on the existence of a target. This is known as the No Void Ray rule, as it was developed back when Starcraft 2 had a unit that gained damage the longer it fired. The unit was redesigned in the first expansion, probably because shooting your own stuff is allowed in Starcraft, but incentivising players to do it looked a bit silly. In any case, Void Ray would not even make it into Zero-K, since there would be nothing stopping it shooting into the sky when idle. Maintaining its damage bonus is smart, so we could not in good conscience prevent it from doing so. This would make the mechanic pointless, so we would avoid adding it in the first place.

File:1e26c2fe036f574843c21bc23c8f7c89d945ab48.png

The same rule applies to lock-on mechanics, or mechanics that penalise a unit for switching targets. A weapon shooting down a line of enemies should not care which unit is "aiming at", since it all involves aiming in the same direction. Any mechanical distinction would drag the interface abstraction of "targeting" into the realm of the game world. There should be no "best command" among those that cause the unit to aim and fire in the same direction. Commands are meant to help the player manipulate the game world, not be themselves be something that require optimisation.

There are ways around the No Void Ray rule. For example, the weapon could apply an escalating status effect on the target that causes the target to take more damage from that type of weapon. This would look a bit like a Void Ray, and even solves the problem of charging by shooting at your own stuff. However, this particular mechanic would be discouraged by Physics vs. Formulas, but in general there are often ways to make a design work within the weapon design guidelines.

Perhaps it is best to think of the weapon design rules as a set of guarantees, rather than a set of restrictions. Working within the rules keeps Zero-K consistent and delineates a relatively safe part of design space. These restrictions can aid creativity, and not only via the usual refrain, but because the safety guarantees free up brainpower that would otherwise be spent making sure that an idea does not completely break the game. For example, the rules inherently disallow designs that incentivises players to shoot at their own base. So the rules can be bent, but more care is required, because the rest of the game is built on their assumptions.

File:B39f91a2cd7781297487c9021cab2646d389ef92.png

Anti-air weapons are the most blatant violators of idea that weapons can be fired in any direction. Being so blatant is great actually, since a large and well-defined exception feels much less arbitrary. Every weapon falls into one of the following categories.

  • Weapons that can only shoot at aicraft. Units with these weapons have "Anti-Air" in their two-word role description.
  • All other weapons. These weapons shoot at aircraft if they have a decent chance of hitting. Melee weapons can and do hit planes, when the wielder is thrown high enough.

We could have avoided creating the special Anti-Air category. One approach would be to make aircraft significantly slower or flimsier, to allow their best counters to be weak enough to hit ground as well. Unfortunately this would make air units more like ground units, or just weaker overall, violating Quant's Rule. We also considered giving anti-air weapons upwards-facing firing arcs, to allow them to shoot into the sky without hitting the ground. This has poor implications for predictability, as an inverted cone would give anti-air variable range depending on terrain and cruise altitude, as well as make for great artillery against cliffs. An inverted cone also just kick the can down the road, as it raises the question of why this amazing weapon cannot be built at an angle.

None of the alternatives to Anti-Air were as good as defining a simple category that gives air the freedom to be powerful and different. That said, most games with air have Anti-Air, so perhaps the more interesting part of Zero-K is the lack of strict Anti-Ground. This choice is a type of design minimalism, we started with projectile physics and then added as few mechanics on top as seemed necessary. We could have widespread Anti-Ground, either as a targeting category, or just by making planes fly so fast and high that nothing but Anti-Air could hit them, but the game works fine as-is.

Truth be told, ground units shooting at planes is a feature, not a bug. The goal is not realism, the goal is the feeling of a fairly consistent world, and we like the extra interactions between different parts of the game. In a sense we picked our flavour of verisimilitude because we like where we end up when taken to its logical conclusion. But now it feels like this article is about to fold back on on itself. Just remember, for future articles or discussion, that Zero-K units are generally allowed to aim their weapons and fire at whatever they want, provided they agree to avoid using this freedom to do anything too pointless or stupid.