Inside the Box serves as a forum for individuals involved in the production of Gearbox Software content to share personal motives, methods, process and results. Gearbox Software projects are created by a diverse range of individuals spanning a spectrum of different backgrounds, interests, objectives and world views. The views and opinions expressed in this article are those of the author and do not necessarily reflect the official policy or position of Gearbox Software or any of its individual members outside of the author.

Welcome to another edition of Inside The Box! It’s me again, Keith Schuler, Senior Designer here at Gearbox. Today, I’d like to tell you a little bit about The Once And Future Slab, one of the missions I worked on during the development of Borderlands 2. More to the point, I wanted to talk about how Brick came to be a “Buddy AI” character who could fight alongside the player during the latter part of that mission.

The man. The legend. The building material.

A Low Priority Mission

In a previous Inside the Box article, I explained that “Buddy AI” describes a player-allied NPC capable of prioritizing enemy targets and attacking them. Up until fairly late in the project, there were no plans or support for implementing Buddy AI in Borderlands 2, but for the Firehawk Battle, I got around that limitation by scripting a Lilith NPC to teleport and spawn explosions in places where enemies were recently detected. In short, I faked combat AI using Level Designer tricks.

At that time, the plan was for The Once And Future Slab to end right after Brick revealed himself at the end of the factory battle in Thousand Cuts. The player would hand him the note, and he’d agree to join up with Roland in Sanctuary. (Actually, he’d stand there doing nothing until the player left the area.) As with Hunting The Firehawk, the narrative was written in a way that didn’t rely on a buddy accompanying the players and fighting by their sides.

Brick clearly deserved better, but at this point in development we were running out of time and we were reluctant to take any big risks. The Once And Future Slab was simply not the most important part of the story we wanted to tell. It brought Brick back into the Crimson Raiders, and there was some mention of having the Slab bandits on call to fight Jack’s impenetrable defenses, but that was it. This low prioritization meant that the mission was always doomed to be the last thought about and the last worked on. Special features and content were simply not in the cards, because there were a million more important things for the team to focus on.

Once I started working on the mission in earnest, though, the situation was looking even more lame than it sounds. I had just spent weeks working out issues with Roland’s AI in Angel’s Chamber. (Watch for a future Inside The Box article!) Now Lilith and Roland were both actively participating in combat with the player, while Brick (of all people) was never seen fighting anyone at all! I wanted to see if there was anything “low risk, high yield” that we could do to make The Once And Future Slab as cool as some of the other missions in the game.

Brick The Psycho

I’d learned a lot from the work I’d done with Roland’s AI in Angel’s Chamber, so I had an idea of what I wanted to try with Brick. One night, after dinner (Gearbox was having dinner catered at the office every night. Tonight it was curry. Again.), I took a basic psycho bandit, set his allegiance to the players’, and gave him Brick’s mesh.

They look different, but they have the same chewy center.

My initial experiment worked even better than I’d hoped. “Psycho Brick” was running around Thousand Cuts, beating up on bandits! Brick was using his original Borderlands 1 mesh, and he looked horribly broken because he was playing psycho animations on the wrong skeleton, but it worked. It demonstrated that Brick, using psycho AI, could fight alongside the player.

I noticed a problem right away, though. One of the behaviors of a psycho in Borderlands is to throw his buzzaxe. He does this whenever he decides that his best available target is one outside his melee range, and he can’t navigate any closer to it. Without this behavior, the psycho would stop attacking anytime his target (normally a player) decided to jump up onto a rock. Brick, being a psycho in disguise, was exhibiting the same behavior. He kept targeting the Buzzards that fly around Slab Town, and he was throwing buzzaxes at them.

Though he primarily used his fists, Psycho Brick needed something to throw, and I didn’t think a buzzaxe was right for him. Luckily, Nate Overman (the level designer who built The Slab King’s throne) had already inadvertently provided a solution. He had taken Sledge’s Hammer from Borderlands 1 and hung it from the ceiling like a trophy. I figured it would suit Brick just fine to throw that hammer at enemies he couldn’t reach. Brian Thomas later added a bit to Brick’s intro showing him ripping it down.

For Brick, a hammer IS a ranged weapon.

Such a proof of concept was only the first step, though. I had demonstrated that Brick could be made to fight alongside the player, but the mission would need to be reworked in order to give him a reason to do so. Also, the animation department had never budgeted the time to give Brick an entire suite of combat animations. One little idea from a designer, implemented in a curry-fueled frenzy, could result in tons of additional work for other members of the team.

Fortunately, Trey Davenport and the entire team of animators are always eager to make the game as good as it can be. I demonstrated Psycho Brick to them, and told them how I wanted to improve the mission. Since he was using unaltered psycho AI, Brick’s animation suite would be no different from a basic psycho’s. In fact, the animation set could be smaller, because Brick didn’t need to be able to do everything a psycho could (like dying, for example.) The animators soon agreed that Psycho Brick would give us a lot of bang for the buck, and they budgeted some extra time for him.

More Mission, Please

Brick would now be able to fight along with the players as a Buddy AI, but the mission did not yet call for such a sequence. We would need to tell more story than had been originally planned.

Luckily (I guess), The Once And Future Slab was already awaiting a rewrite. The original design of the “Slab Initiation” had called for the players to run back through Slab Town and hang out in No Man’s Land dodging mortar fire for 30 seconds. I had gone so far as to get the mortars working, but the objective didn’t work very well. No Man’s Land was too large for mortar dodging to be challenging or fun, and making the player backtrack through town twice was terrible. This was compounded by the grim reality that we couldn’t change anything about the level to make a player feel like he had “become a Slab.” The bandits in town would still attack anyway, both during and after the initiation.

I wanted to keep the mortars, though. They worked alright, the artists had created assets for me, and I liked how dodging circles of death on the ground was a change of pace from the usual gameplay. So, Anthony and I worked out a change to the story where Handsome Jack would send the mortar attack against the Slab Town itself. The tighter environment lent itself better to the dodging gameplay, and I figured that if the bandits were getting blown to bits by mortar fire, the player might not notice that the whole town was still hostile to somebody who was supposed to be a fellow Slab.

Since Brick was now a Buddy AI, he could accompany the player back through Slab Town, which solved the “backtracking twice” problem. Brick and the player could run through the rain of mortars together, and then the player could turn in the mission back at the entrance to the level.

Brick needed to do more than simply run from point A to point B, though. He needed to punch things, and punching mortar rounds just wasn’t going to cut it. Fortunately, we’d already established a precedent (later in the game, but earlier in development) with orange shields. An orange shield was something that was impervious to the players unless they had a Vault Hunter to knock it out. Thus, the “mortar beacon” objective was born. The players would run with Brick to each orange-shielded beacon, destroy it, and then fight some Hyperion robots together. The player could feel like being a Slab meant something, even if all it meant was saving bandits who were cowering out of sight inside their homes and would still just as soon kill you as look at you.

Remaining Challenges

Now that we had a plan in place, all that was left was to implement it. As usual, this had its own series of additional challenges.

The first challenge was that I had two different versions of Brick to deal with. NPC Brick didn’t have any combat AI, so he worked well for scripting. NPC Brick will never suddenly decide that he needs to kill somebody in the level and go completely off the rails trying to do it. I use NPC Brick to be the well-behaved Slab King and for the player to hand the note to after the initiation. But, in order for him to fight as a buddy AI, I needed to replace NPC Brick with Psycho Brick. There’s no changing room available, so Brick makes the swap right before the player’s eyes. This could’ve been done in a better way, but I was distressingly low on time. The swap happens right at the end of the exposition, just before he opens the exit for the player. You can see him pop slightly off the floor if you watch for it.

The next challenge was to make Brick avoid the mortar fire. The mortars aren’t really a projectile flying through the sky; they work by spawning an object on the ground. The object lives for a few seconds, during which it displays the big red warning circle. At the end of the object’s lifetime, it spawns some effects and an explosion, and anything within the explosion radius will take damage.

I set the mortar object to be an “obstacle”, which means that AI navigation will treat it like a wall and try to go around it. However, if Brick happened to already be inside the radius of the mortar when it spawned, then he was already inside the make-believe barrier and would act like nothing was out of the ordinary.

To solve this problem, I ended up implementing one of my favorite designer hacks in Borderlands 2. A “designer hack” is what we call it when a designer uses a feature in a way that was never intended, instead of requesting a purpose-built solution from the coders. Since coder time was at such a premium by this point, a designer hack would have to do the trick.

As it turns out, bandits have a feature in their AI that allows them to react to grenades that land near them. If a live grenade lands near a bandit, he will dodge or roll away from it. Psycho Brick inherited this behavior, too. So, right when the mortar object is spawned, I also spawn an invisible, harmless grenade at the center of the object. Brick’s AI knows the grenade is there, and he tries to dodge away from it. This hopefully makes Brick look a little smarter because he always tries to dodge out of mortar targeting circles.

You can’t see the grenade, but he knows it’s there.

We had one final challenge, which was that the Slabs would continue trying to kill the player, despite having passed initiation. During the mission itself, it was easy enough to stop spawning bandits and temporarily spawn robots in their place for Brick to fight. But, we didn’t want the town to be full of robots for the rest of the game, nor did we want it to be completely empty.

To address this, Anthony wrote an extra line of VO for Brick. Brick explains that the Slabs are “freakin’ idiots” and will probably still try to kill the player. “So don’t feel bad about killin’ ’em. I never do.” Problem solved.

That, my friends, is how we fixed up an unpolished mission and vastly upgraded Brick’s role in Borderlands 2. “Hacks, Rewrites, and Curry” was the secret formula for getting it done in a very short timeframe and without so many requests for new code or content that the producers would shut the effort down. Thanks for reading this edition of Inside The Box. Hope to see you next time!