This post was originally published by @Ryan_Darcey for @MasonicStudios.
I could kick this off by trying to convince y'all that good and plentiful player feedback is critical for your game, but that would be kinda dumb cause Lee Perry has already taken that mantle and been running with it for a while. So, before I jump into a more technical discussion about streamlining support for player feedback, maybe check out this post on Gamasutra or listen to Lee's contribution in this GDC talk. It's great stuff.
Now that we've got that part covered, let's get more concrete about how to deliver player feedback in the most efficient way possible.
Constructing A Feedback Event Factory
Removing friction in your development pipeline for implementing player feedback will not only speed you up, but it will also make you more likely to add it in the first place. Humans are lazy animals. We don't even like clicking too many times to purchase our laundry detergent, so we're definitely not going to like writing a lot of code to generate all of the events that communicate to the player in various ways.
As I'm writing this in 2018, we typically only have 3 of our senses available for delivering feedback to the player (actually pretty happy smell & taste aren't at our disposal). So, I've implemented a Feedback Event Factory that creates and manages common events that speak to those senses and generally execute together at the same time.
What I'm presenting here doesn't add a lot of "new" functionality to the engine, but it does drastically reduce time and complexity around the implementation of player feedback. As an added bonus, you'll never "forget" to add a hook. No more asking an engineer to add support for a camera shake in addition to that sweet particle system you've got in game. These events are all ready to be kicked off together in the Feedback Event Factory when you decide you need them, so let's take a look at one.
All of the Things
My specific implementation is for Unreal Engine, but there's no reason you can't take this structure and implement it in any other engine, as well. In the factory, I currently have support for the following feedback events:
I'm not going to get into the specifics for every setting in this factory, but I will at least open up the hood and show you what's underneath. You can decide if you want to dive deeper later by following some links at the end of this post.
1) PARTICLE SYSTEMS
First thing to notice here is that I'm defining an array of particle systems. You can kick off as many as you want; each with their own unique offset, scale, attach point, etc. Another setting worth calling out is the Type field, which defines whether this particle system plays for everyone, a specific team, a remote player only or a local player only (all in relation to the "owner" of the factory). In addition, you can specify the Alignment to change which axis in the particle system is "forward". This was super useful when I purchased a bunch of impact FX from the marketplace that were all authored in the Z direction and my code was trying to burst them in the X direction. No need for weird hacks in code or changes to the asset!
Again, you can define an array of sounds to play here just like the Particle Systems above. My favorite thing about this is the added head/loop/tail support. Built right into the factory!
Actor spawning has similar base settings as particle systems and sounds. The fact that you can spawn actors in this factory means it can be abused pretty badly, but it also means you can get really creative w/ your feedback events! I would generally not recommend using a factory like this to spawn actors for any other purpose than a feedback event. As an example, I purchased a scanning effect from the Unreal Marketplace that's implemented as an actor. I can create and manage that scanning effect along with every other event in this factory, which really streamlines this part of my development process.
4) FORCE FEEDBACK (RUMBLE)
Nothing super exciting here. Just your basic force feedback settings. Also, no reason for an array of these (that I've had at least) so you're just spawning a single one.
Unrelated to the factory itself, I would strongly recommend creating a small-ish set of predefined rumbles (no more than 20 or so) and just use those for your game. That's what I did for Halo 5: Guardians, so I'd be surprised if your game needed much more. Makes bug fixing/tuning/polishing a HELL of a lot easier. As an example:
5) CAMERA SHAKES
Coolest thing here is being able to share attenuation settings w/ the Force Feedback event defined above. Generally speaking, I find that I want my camera shakes and rumbles to be tuned the same in this way. Also, just like the Force Feedback events, I'm using a predefined list of camera shakes to choose from. No need to overcomplicate this by creating a unique camera shake for every event in the game.
Pretty basic stuff here. Just fires off an animation montage on the "owner" of this factory (which should probably have Skeletal Mesh that supports the montage).
7) TIME DILATION
Slow things down. Speed things up. Can't go backwards in time, tho :/ The map helps you ease in and out of the time dilation settings and keeps things smmmoooooth.
Even though I've been talking about player feedback here, I wanted to leave just a little room for AI. These settings allow you to make noise associated w/ the factory owner that AI units can react to. In my implementation, it speaks to the AI unit's Perception Component system.
Spawning a Feedback Event Factory
Lastly, here are the blueprint commands to spawn new Feedback Event Factories. Alternatively, you can just place them in the level. They will automatically be destroyed once all their events play out. Or, for looping events, save off the pointer to the Feedback Event Factory and destroy it whenever you're ready. You can also access handles to the individual events in the Feedback Event Factory in order to make updates to runtime parameters on sounds, particle systems, etc.
See below for how many nodes I would have needed to add in order to spawn these events if I didn't use a Feedback Event Factory.
Feedback Event Factory Plugin
That about wraps up the high level overview. Here's where I get to the good part; you can purchase a Feedback Event Factory plugin on the Unreal Engine Marketplace! You'll also find more documentation there, including a link to this video tutorial below which demonstrates how they might be used in game. I hope you've found this useful! It's one of the first things I implemented for my game and I can't imagine developing without it anymore.