Leader Powers Part One

Published Monday, July 13, 2009 1:41 PM by Aloysius

Hi, my name is Marcin Szymanski, and I’m a programmer with Robot Entertainment. I worked on several systems in Halo Wars, and one of my main contributions was in the area of Leader Powers. This was a very interesting gameplay system that presented a unique set of challenges.

Script vs. Code

Halo Wars is a game about tactical control of dozens of military units, but we decided early on that we wanted to have a series of over-the-top “signature” abilities for the various leaders. These would serve a dual purpose: amping up the console nature of the game, and adding a way to help break stalemates.

We initially prototyped most of the powers in Halo Wars’ strong visual scripting system. This allowed us to get the powers up and running very quickly. It also helped us quickly iterate on the gameplay, because designers could jump right into script code to modify each power.

There were some areas, however, where the scripting system was slowing us down. It didn’t allow for very precise control over power execution, it didn’t support cool programmatic effects, and it was very difficult to debug. Being the greedy developers that we are, we decided that we wanted more! We could have retrofitted the scripting system to support the needed functionality, but it became clear that the right direction was to move everything into native C++ code.

I had a lot of experience working with the god powers in Age of Mythology, so I was asked to help out with the Halo Wars leader powers. When architecting the new power system with another programmer, I applied several of the lessons I learned years ago. For example, the system would need to allow for a lot of data-driven customizability for rapid iteration of each power’s gameplay and visuals. I also knew that it would need to support a variety of user interface modes to address each power’s unique needs. So, I opened up a blank sheet of code and dug in.

Once we got most of the fundamental systems in place, we began moving the powers from script into code. By the end of the project, I touched practically all of the powers in some way. In the following sections, I talk about a few of the powers where I spent the most time. Enjoy!

Cleansing

The script-based version of this leader power did its job well enough, but it wasn’t very satisfying to use. The beam was controlled like any other unit: you scrolled over to a spot on the ground and gave the beam a move command. This felt very indirect and just not badass enough. I decided to give the player direct control over the beam.

One problem: Halo Wars is a peer-to-peer synchronous game. When a unit begins to move on your screen, it’s after the move command has bounced across the internet and back. This meant that the beam still felt too sluggish to control.


An early version of the Cleansing Power, and a mock-up Covenant Base.


The solution? Split the beams! This is sort of like crossing the streams, except in reverse, and it doesn’t cause every molecule in your body to explode at the speed of light. The way it works is that the player controlling the power only sees a fake beam that reacts immediately to controller input. This fake beam exists only on the caster’s Xbox and deals no damage (if it dealt damage, the game would immediately go out of sync). However, there’s also a real beam that follows the fake beam. This real beam exists on every machine and is updated synchronously (i.e., it’s in the same place on all players’ machines), but is invisible to the casting player. The second beam is responsible for dealing the power’s damage to enemy units, and trails the fake beam by a meter or two depending on network latency.

The split described above is why it works so well to lead a moving target with the Cleansing beam – the real beam is just a touch behind the beam you see on your screen.


Cleansing was always one of the harder things to get to look right.


Carpet Bomb

This power illustrates one of the main advantages of going to code: we were able to have very specific input handling and UI feedback for targeting the power. The arrow that you use to target the power would have taken significantly more time to implement if we’d tried to go through script.

The bulk of the work for the power’s delivery was spent on customizing the blast pattern. We didn’t know right away what kind of pattern we would want for the cluster bombs, and we didn’t know how it should upgrade. My approach here was to make a very customizable pattern, with the ability to configure everything from its length to the size of the intro “wedge” for the pattern’s shape. It was pretty basic stuff, but it allowed the designers and me to experiment with several different looks for the power as it upgraded through its stages.


The aiming arrow for the Carpet Bomb.
So, I had this blast pattern worked out, but the initial version still didn’t feel very cool. In that version, the bombs dropped down and exploded instantly, dealing damage right away. It felt bland, as if there was something missing about its tempo. Maybe it was too slow? Too fast? Eventually, I started experimenting with a dual-stage approach – bombs impact, then explode a few beats later -- and that started to feel tons better. By splitting the impact from the explosion, we got a cool little chunk of tension after the bombs drop, but before their explosion sends everything flying.

The carpet bomb's devastating effect on Warthogs.


Tune in next week for the next part in our Leader Powers Dev Blogs. Marcin talks more about the Mac Blast and the Transport Powers, along with more never seen before screenshots, including ones from Halo Wars Development.