The making of Terraria for consoles — Part 2, The Controls
Continued from Part 1.
The Codebase
Terraria was written in C#, using a framework called XNA — a set of tools Microsoft had released to make it easier to develop lightweight games for Windows and Xbox 360.
As a result, this meant that Engine Software was able to get Terraria “up and running” on the Xbox 360 within days, albeit with a lot of platform-specific work still ahead of them.
PlayStation 3, however, was an entirely different beast. XNA wasn’t compatible with the platform — nor was C#. If memory serves, Engine needed to translate the codebase line-by-line from C# to C++, and write custom solutions for all the low-level interfaces (2D rendering, audio, networking, and so on).
But regardless of the platform, the biggest question was always going to be “How do you play this game with a controller?”
The Controls
Movement
Since Terraria looks more-or-less like a 2D platformer (i.e. like Mario), one thing was obvious: Left Stick to move left or right.
From there, things got… trickier.
Jumping and performing actions
In the early development builds, I was surprised by Engine’s initial control mapping: Right Trigger to jump, and the A button to perform an action (swing your pickaxe, etc.).
When I asked what their thinking was, their explanation did make sense: sometimes you need to jump and perform actions at the same time, so it’s important that they’re assigned to inputs you can press simultaneously.
That said, I had a few concerns with this mapping:
- Since the game looked like a 2D platformer, it seemed to me like pressing A to jump would be more intuitive.
- Furthermore, Minecraft: 360 Edition had just come out. It assigned the A button to jump — and the Right Trigger to perform actions. And the more I played Minecraft: 360, the more I appreciated the choice of assigning “Right Trigger to fire”. Most shooters at this point were using Right Trigger to fire (since it does feel more like “pulling a gun trigger”, after all), and people mostly played Minecraft in 1st-person, making it sort of feel like a shooter. But more importantly:
- Using the Right Trigger uses your index finger, which is not only more ergonomic to press repeatedly than one of the “face buttons” (A, B, X, or Y) — but it also frees up your right thumb to aim at the same time using the Right Stick.
I made my case, and Engine adjusted the controls: A to jump and Right Trigger to fire. They were still concerned that there might be situations where you’d need to simultaneously aim (with your right thumb) AND fire (with your right index finger) AND jump — so as a compromise for these rare situations, we assigned pressing the Left Stick (with your left thumb) as a secondary jump input.
But from my perspective, I was happy that your right thumb was mostly free to aim.
About that…
Aiming
In Terraria, you had lots of different tools and weapons you could use, such as a pickaxe, a sword, or a bow. On the PC version, you just used your mouse to aim, and Left Click to fire. Aiming this way was very easy to do with a mouse, because you could move the cursor very quickly and precisely.
With a dual stick game controller, the most straightforward solution was to continue using a cursor and just assign “moving the cursor” to the Right Stick. This was what Engine did initially and, indeed, the game was technically playable this way.
However.
It became pretty clear to me that the game didn’t play well this way — because moving a cursor with a thumbstick was slow and imprecise. It made doing standard game actions like digging extremely tedious (since you’d need to target each, individual block of dirt with a comparatively clumsy thumbstick), and combat was almost impossible. When you were jumping around, frantically trying to aim and fire a weapon, you simply couldn’t move a cursor with a thumbstick fast enough or accurately enough.
Aiming during combat
At some point while playtesting — probably after dying for the dozenth time during what should’ve been an easy fight — it occurred to me that when you’re using a weapon, the X and Y position of the mouse cursor didn’t actually matter. Since your weapon just fired “toward the cursor”, the only thing that actually mattered was the direction you wanted to fire. We were just deriving that direction, somewhat inefficiently, from the position of the cursor relative to your character.
With this in mind, I figured a much easier way to indicate “the direction you fire” would be to just use “the direction of the Right Stick” rather than “firing toward the cursor’s position”.
Using the direction of the Right Stick to aim was something I’d seen in another 2D game, Geometry Wars: Retro Evolved does — a game that I’d put a lot of time into. (Its controls, in turn, were inspired by an old arcade game called Robotron.)
I convinced Engine to test out this style of aiming, and it worked brilliantly — for combat.
But not so much for other things you need to do all the time in Terraria, like digging — since you still need to aim at specific blocks to mine them. This would be the next challenge.
Aiming while digging
The vast majority of the time, when you were digging in Terraria, you’d just want to clear “all the blocks to your left or right”, or “all the blocks below you”. With a mouse, this meant continuously making small, precise adjustments to your cursor to target each block in your way.
On a controller, with the initial “move the stick to move the cursor” approach, mining this way was possible — just very tedious and prone to inaccuracy. But with the new “move the stick to indicate direction” approach, the direction by itself wouldn’t automatically target every individual block you’d want to clear.
“But why couldn’t it?” I wondered. Since you could already indicate the general direction you wanted to mine with the Right Stick — left, right, down, or up — why didn’t we just automatically target each individual block in your path (in the indicated direction) as they mine?
This is ultimately what we did, leading us to call this the “Auto Cursor”. Engine did a beautiful job with the implementation, and I think it made a world of difference — making it dramatically easier to dig. Arguably it made it easier to dig with a controller than with a mouse.
It also made it much easier to chop trees, once we also auto-targeted tree trunks. Unfortunately, however, this solution wouldn’t work for building, where you still needed to indicate a specific grid square to place a block.
Aiming while building
Ironically, the initial approach of moving the cursor around like a mouse worked pretty well for building, since most of the time you could take your time to be precise.
Two cursor modes
The bigger issue was that there were now two distinct approaches for the cursor that worked well in different contexts: the directional “Auto Cursor” worked well for digging and fighting, and the mouse-like “Manual Cursor” worked well for building. I’d hoped that there would be a single solution for aiming that would cover all these use cases, but the more I played, the more I was convinced that we’d need to include both cursor modes, and let players switch between them.
I didn’t love the complexity two cursor modes added, but they worked so well for their respective activities that I figured we needed both.
The next obvious question was “How will you switch between cursor modes?” Inspired by playing a lot of Halo, where pressing the Right Stick would change between “aiming modes” (standard aiming or zoomed-in sniping), I suggested we use the same “pressing the Right Stick” input for switching between cursor modes. We tried it, and it immediately stuck.
Switching items
Another important control in Terraria was switching between items (e.g. your pickaxe, your sword, etc.). Much like in Minecraft, there was a “hotbar” of items you could switch between which, on PC, was done with the 0–9 keys or by scrolling the mouse wheel.
This pattern was a direct legacy of 1st-person shooter games, like DOOM or Quake, where you might rapidly switch between different weapons during combat.
In Minecraft: 360 Edition, the developers solved item switching in a straightforward way by using the “secondary triggers” — Left Button (LB) and Right Button (RB) — to switch items left or right on the hotbar. So we followed this convention for Terraria.
One thing I was worried about, however, was that in Minecraft it was basically okay if you couldn’t switch between items very fast (since it’s not a combat-focused game), but in Terraria there might be situations where you’d want to quickly switch between multiple weapons, or use a potion. The PC version even had keyboard shortcuts for “Quick Heal”, “Quick Mana”, etc.
Shortcuts
If I recall correctly, Engine cleverly assigned these “quick” shortcuts to the D-pad, but I observed that we might be able to provide a more flexible solution by allowing players to assign any item in their inventory (such as other weapons, etc.) to these D-pad shortcuts — the way that Zelda games like Ocarina of Time and Wind Waker let you assign items to buttons. This is ultimately what we did.
Other controls
The remaining controls were, by comparison, much less fraught:
- B to interact with game objects (e.g. open doors or chests)
- Y to open the inventory menu (again following Minecraft)
- X to drop your current item
- BACK button to open the map (more on that later)
- START to pause
- Left Trigger (LT) to activate your grappling hook, if you had one. The grappling hook was another very strange situation because, once you had it, it was very important that you be able to use it at any time independently of moving or jumping or firing. This ruled out just letting players assign it to the hotbar or D-pad. (Again, on PC there was just a keyboard shortcut.) It seemed a little bit like a waste to assign an input as valuable as LT to a late-game-only item, but nothing else necessarily more sense. Ultimately I think it worked okay.
The PlayStation 3 controller
Luckily, the Xbox 360 controller and the PlayStation 3 controller (the “DualShock 3”) had almost the same layout, so most of our Xbox 360 controls mapped directly to PS3 equivalents.
An odd bit of history, though, is that the shoulder buttons weren’t quite the same:
The ergonomics of the PS3 controller meant that your index fingers usually rested on the “closer” L1/R1 triggers rather than the “farther” L2/R2 ones, whereas on the 360 controller this was reversed; your fingers usually rested on the “farther” triggers rather than the “closer” buttons.
Because of this, I noticed that when a game released on both 360 and PS3, usually controls that mapped to LT/RT on 360 would be mapped to L1/R1 on PS3. After some discussion, we decided to follow this convention as well.
The control guide
Despite how much work we put into making the controls intuitive, they were still a lot to remember and it was easy to sometimes forget things, especially in contextual situations (“How do I open a chest again?”) or when you were coming back to the game after a break.
To that end, once again inspired by Minecraft: 360 Edition, we followed their (very helpful) approach of having a persistent control guide in the bottom-left corner of the screen (which I suspect they took from the Xbox 360 dashboard).
We even managed to follow Minecraft: 360’s pattern of having the control guide be context-aware; e.g. it says “Attack” when you’re using a sword, or “Chop” when you’re using an axe, etc.
I think the control guide dramatically improved usability, and I’ve noticed it’s a convention that’s become much more common in the years since.
A good scheme
Overall, I’m really proud of the controls we developed. This was during an era when remappable controls still weren’t common on console (though some games might offer a few control schemes), and I believed — and still believe — that defaults are powerful, and should work well for as many players as possible.
The controls — especially the directional “Auto Cursor” — determined whether the moment-to-moment experience of fighting and digging were fun — or frustrating. I remain convinced that the game playing well with a controller was critical for Terraria’s success on 360 and PS3.
With the controls solved, all that remained was, well… quite a bit.
Continued in Part 3.