Back in 2024 I did a lightning talk on Gunplay In Games for Code Youngstown. I didn't have enough time to really get into some important features that I really wanted to discuss.
Shooters are an incredibly prominent and popular genre in gaming. So many modern games have "gunplay" in them. Heck, my team at RustBit is even working on a shooter. What makes them so prominent?
Talking about Feel
Feel is this werid emotional experience one gets while playing a game. Think about it, if you're a gamer, you've talked a bunch about how the controls might feel on a game, regardless of its genre. Every game from Candy Crush, to Call of Duty has some amount of feel.
Now that feel can be simple as representative responsiveness to the visual experience of interacting with an object in a game, or it can be something more complex like gunplay!
Why talk about gunplay in particular?
Gunplay (and combat in general) in games is particularly interesting when it comes to feel and emotion. In the book Designing Games by Tynan Sylvester:
An image of one unit shooting at another is clear and visceral, and requires no abstract interpretive symbols. People just get physical violence. It supports mechanics well because it’s easy to learn and understand, so it gets used over and over.
It [gunplay] is visceral, clear, and requires little interpretation. I'd even argue that if you understand gunplay (and combat) in games, you'll better understand feel in games all around!
Designing weapons in games
The first step is to ask yourself: what purpose does combat serve in my game? It's going to differ between a survival horror game vs a fast-paced boomer shooter. Understand what sort of experience you want your player to have while playing.
The next step is to build the weapon! At RustBit we use the RustBit Behavior Tree (RBBT) library for building our guns and our AI (and a bunch of other things, basically anything that requires a defined sequence of events). Behavior Trees are a surprisingly great way to build guns with a finite state machine at the BTs root.
Most commonly Finite State Machines are the go-to tool for implementing a weapon.
Here's what a finite state machine for a weapon might look like:
flowchart LR A{"Idling"} B("Firing") C("Reloading") A--"Start Firing"-->B B--"Stop Firing"-->A A--"Reload Triggered"-->C C--"Reload Completed"-->A B--"Ammo Exhausted"-->C
Each one of these states has several events taking place (consuming ammo, applying recoil, wait times, etc). With a behavior tree, these chunks of logic can be made into sequences of nodes. The kinds of states and events for a given weapon, require an understanding of what sort of game you're working on.
flowchart LR D("Consume 1 Ammo") E("Hitscan with 1 Trace") F("Apply Recoil From Curve") G("Play Shoot Animation") H("Wait n seconds (fire rate)") I("Continue firing unless ammo is unavailable") subgraph Firing F E D G H I end
Lastly, balance out your stats, once you have your core behavior implemented, you might want to introduce some stats and additional behaviors. Damage is an obvious one, but there are so many others. Here's a few:
-
Recoil -> Wether its a simple camera shake, you physically move the camera up, or you draw a pattern when firing, its important to adjust the intensity and make sure that your recoil patterns feel reasonable with what your weapon is trying to be.
-
Reload Time -> Reloading can be a quick thing or it can be a slow, cumbersome activity. Either way, you'll want to adjust the time accordingly. You'll also want to make sure that your reload times are in line with your ammo counts.
-
Ammo Counts -> You'll need to think about how much ammo is a player given? How much before they have to reload? How much do they have on their person?
-
Fire Rate -> How many rounds can you fire per second?
A lot of these will require some reasoning on your end, or looking at real life examples of what you're trying to accomplish.
Case Study: VALORANT's ODIN
This video has a player firing a weapon called the ODIN in Riot's Tactical Hero-Shooter: VALORANT. In this example, the combination of sights, sound, recoil pattern, and timing go to create the base experience of firing this heavyweight machine gun.
The feel that VALORANT's designers wanted to convey with the ODIN is: "Slow, heavy, and powerful*. The length of animations is used to convey the slow and heavy (how long does it take to equip said weapon, or reloading it is incredibly slow). Whereas the power behind it is communicated through sound cues (how noisy it is!) and how intense its recoil pattern is (thats the path the crosshair travels while firing).
That specific experience that you have when firing the ODIN. That's feel. Notice that this example, the weapon isn't fast and snappy necessarily. But it's feel is still representative of what the concept the weapon is trying to convey.
Conclusion
In conclusion, gunplay is a common mechanic that a lot of games have. It's easy to understand, reasonable to get good feel on. And I'd recommend anyone wanting to learn more about gameplay programming to have a look at gunplay mechanics (and combat) mechanics as a great way to hone in your sense of feel and what makes a game feel good to play!