Finally, another Unreal blog post getting added! Took some time because of life stuff, but also because this is a fully featured working game! I’m saying saving states, physics, score, game overs, multipliers, audio, and materials! I’m talking a fully working Pinball game. Check it out!
This project was a huge hurdle. Learning plenty about blue prints, audio design, material design, and overall project structure. Pinball is classic game with minimal use cases making for a great starter game in Unreal. With that in mind, I did enjoy spicing it up a bit with crazy particles effects and a multiplier mechanic. Anyways, let head into some nitty gritty.
Typically, I don’t spend much of my free time making Pinball layouts… I did what anybody else would do and looked up some designs of popular Pinball games. Taking from a few examples such as the Pinball game that came preinstalled on Windows 95 computers, my Pinball layout started to really flesh out.
These models are provided in my course, so none of this crazy detailed modeling was me. I had the toys provided to me, all I did was play! Came up with a color palette I planned to use, applied my materials to these objects, and found an appealing Pinball game. With one notable final touch, “THE DUDE” was placed dead center for all to see. My signature. Yes.
Pinball is pretty straight forward when it comes to mechanics and possible outcomes. I at least kept telling myself that as my Game Mode Blueprint turned into an absolute monster…
This project managed to avoid C++, but I believe there were plenty of times it could have been easier in C++. That’s something I’m hoping to dabble in my next project, but this project stayed with Blueprints throughout. All the spaghetti.
Once you learn to navigate the Blueprint modules, you can get some really sweet stuff going. The above is demonstrating child actors being added to a parent actor, more specifically “THE DUDE” drop targets. Each drop target is a generated child. They are generated based on the provided string of the parent actor. The parent actor is essentially a collection of these targets. “THE” and “DUDE” were separate actors consisting of multiple child drop target actors. Wild.
You can even do structs in Blueprint. My high score system revolved around the above struct, name and high score. Simple stuff, but let’s take it up a minor notch.
That’s right… Camera shake. Not seen in the demo, but when you tilt the board (just in case the ball gets stuck) the camera will give a small shake. I really enjoyed this feature because I can reflect on all the first-person shooters I’ve played that jerk your camera when getting shot… Usually ending in my death… Games. Are Hard.
Now we are taking it up a major notch! This is how the spline works for the ramps. The ramps consist of three parts. An entrance, mid-section, and the end. The above Blueprint is determining what section of the spline we are on and what mesh should be generated. What is extremely fancy about this approach, you can provide three meshes and this will dynamically spline them! I could do a ramp, rails, road, or whatever. Just provide the sections and poof, magic.
This Pinball game really opened my eyes to the crazy stuff you can do with Material Blueprints. There is so much potential and I know I’m only brushing the surface of this stuff!
Above is a more straightforward material, but turned out pretty awesome. Layering multiple textures to generate a more authentic looking worn wood that the ball glides across. I did keep the roughness a little low so I could see the other objects reflect on the surface. Made me feel like the level had a bit more depth.
This material is actually parameter driven and based on that parameter the material might glow! This is the bumper material. When the ball collides with the bumper, the Blueprint code performs a Lerp on the EmmissiveBoost parameter. This causes the top of the bumper to fade in/out light on hit.
Now we take our Material Blueprint action to the next notch! Those multiple types of arrows on the Pinball board are actually all one texture, but being individually chosen based on the RGB parameter provided! This is pretty wild and very useful for basic textures being added to the world. This material above is sort of like a “parent” material that will be provided the maps and parameters to show the correct texture.
This is an example of the parameters being passed. Provide the map (arrows in our case), provide which channel is to be visible (R), and lastly provide the primary color desired (Yellow). By choosing the red channel, the red arrow will be displayed, then altered to yellow. Crazy.
I didn’t get to go to crazy with the particles for this project. Mostly because it can get overwhelming really quick on such a small Pinball board! But I did get to dabble and I’ll talk a bit about the bumper explosion.
To achieve the particle explosion required a bit of thought. I opted for a general sphere shape for the particles, but restrained movement on the Z-axis completely. This results in the outward nova explosion on only the X and Y-axis.
One thing about the particles that was rather annoying is the explosion of particles just passed through everything. Instead of allowing this I enabled collision and added gravity to the particles. This made the particles bounce off the other objects around them and the ground! Was a really cool feature once it all worked together.
Last, but not least, the awesome audio going on this project. Beside the sort of corny looping game music, I had the chance of setting up a few audio features that are pretty slick. One being the audible ball roll!
This puppy auto adjusts the volume and pitch of the ball rolling sound all based on the ball’s velocity! As the ball moved quicker the pitch would rise, but as the ball moved slower the pitch would lower. This gives the ball a dynamic sound, especially when combined with my project’s attenuation settings.
All the sounds in the project use this attenuation setting. This setup gives all the sounds the same effect with a trail off as it approaches the camera. Paying close attention, I can hear that flippers are pretty loud compared to bumpers that are father away. Same with the ball rolling sound too!
To top it all off, a quick way of giving the project more immersive sound. A little bit of randomness! This Audi Blueprint is randomly selecting an impact noise when one of the bumpers is collided with the ball. Now that’s some small touch with big impact.
That’s it for now! Thanks for the read.