Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Game Development Projects with Unreal Engine

You're reading from  Game Development Projects with Unreal Engine

Product type Book
Published in Nov 2020
Publisher Packt
ISBN-13 9781800209220
Pages 822 pages
Edition 1st Edition
Languages
Authors (4):
Hammad Fozi Hammad Fozi
Profile icon Hammad Fozi
Gonçalo Marques Gonçalo Marques
Profile icon Gonçalo Marques
David Pereira David Pereira
Profile icon David Pereira
Devin Sherry Devin Sherry
Profile icon Devin Sherry
View More author details

Table of Contents (19) Chapters

Preface
1. Unreal Engine Introduction 2. Working with Unreal Engine 3. Character Class Components and Blueprint Setup 4. Player Input 5. Line Traces 6. Collision Objects 7. UE4 Utilities 8. User Interfaces 9. Audio-Visual Elements 10. Creating a SuperSideScroller Game 11. Blend Spaces 1D, Key Bindings, and State Machines 12. Animation Blending and Montages 13. Enemy Artificial Intelligence 14. Spawning the Player Projectile 15. Collectibles, Power-Ups, and Pickups 16. Multiplayer Basics 17. Remote Procedure Calls 18. Gameplay Framework Classes in Multiplayer

9. Audio-Visual Elements

Overview

In this chapter, we will finish the dodgeball-based game that we have been working on in the past four chapters. We will conclude this chapter by adding sound effects, particle effects, and by creating another level, this time with an actual path the player must follow to finish it. By the end of this chapter, you will be able to add 2D and 3D sound effects, as well as particle effects, to your UE4 projects.

Introduction

In the previous chapter, we learned about game UI and how to create and add a user interface (also known as a widget) to the screen.

In this chapter, we will learn how to add audio and particle effects to our game. Both of these aspects will increase the quality of our game and produce a much more immersive experience for the player.

Sound in video games can come in the form of either sound effects (also known as SFX) or music. Sound effects make the world around you more believable and alive, while the music helps set the tone for your game. Both these aspects are very important to your game.

In competitive games such as Counter-Strike (CS: GO), sound is also extremely important because players need to hear the sounds around them, such as gunshots and footsteps, and which direction they came from, to gather as much information about their surroundings as possible.

Particle effects are important for the same reason that sound effects are important: they make...

Audio in UE4

One of the essential components of any game is sound. Sounds make your game more believable and immersive, which will provide a much better experience for your player. Video games usually have two types of sounds:

  • 2D sounds
  • 3D sounds

2D sounds don't have any consideration for the listener's distance and direction, while 3D sounds can be higher or lower in volume and pan to the right or left, depending on the player's location. 2D sounds are usually used for music, while 3D sounds are usually used for sound effects. The main sound file types are .wav and .mp3.

Here are some of the assets and classes related to audio in UE4:

  • Sound Base: Represents an asset that contains audio. This class is mainly used in C++ and Blueprint to reference an audio file that can be played.
  • Sound Wave: Represents an audio file that has been imported into UE4. Inherits from Sound Base.
  • Sound Cue: An audio asset that can contain logic related...

Sound Attenuation

For a sound to be played in 3D inside UE4, you'll have to create a Sound Attenuation asset, as we mentioned in the first section of this chapter. A Sound Attenuation asset will let you specify how you want a specific sound to change volume as its distance from the listener increases. Have a look at the following example.

Open Unreal Editor, go to the Audio folder inside the Content Browser interface, right-click, go to the Sounds category, and select Sound Attenuation. Name this new asset BounceAttenuation:

Figure 9.7: Creating the Sound Attenuation asset

Open this BounceAttenuation asset.

Sound Attenuation assets have many settings; however, we'll want to focus mainly on a couple of settings from the Attenuation Distance section:

  • Inner Radius: This float property allows us to specify at what distance the sound will start lowering in volume. If the sound is played at a distance less than this value, the volume won&apos...

Particle Systems

Let's talk about another very important element of many video games: Particle Systems.

In video game terms, a particle is essentially a position in a 3D space that can be represented with an image. A Particle System is a collection of many particles, potentially with different images, shapes, colors, and sizes. In the following image, you will find an example of two Particle Systems made in UE4:

Figure 9.12: Two different Particle Systems in UE4

The Particle System on the left is supposed to be electrical sparks that could come from a cable that has been sliced and is now in short-circuit, while the one on the right is supposed to be a fire. Although the particle system on the left is relatively simple, you can tell that the one on the right has more than one type of particle inside it, which can be combined in the same system.

Note

UE4 has two different tools for creating Particle Systems: Cascade and Niagara. Cascade is...

Level Design

Since Chapter 5, Line Traces, related to our dodgeball game, we've added quite a few game mechanics and gameplay opportunities, as well as some audio-visual elements, all of which were handled in this chapter. Now that we have all these game elements, we must bring them together into a level that can be played from start to finish by the player. To do that, let's learn a bit about Level Design and level blockouts.

Level Design is a specific Game Design discipline that focuses on building levels in a game. The goal of a Level Designer is to make a level that is fun to play, introduces new gameplay concepts to the player by using the game mechanics built for that game, contains good pacing (a good balance of action-packed and relaxed gameplay sequences), and much more.

To test the structure of a level, Level Designers will first build what is called a level blockout. This is a very simple and boiled down version of the level that uses most of the elements...

Extra Features

Before we conclude this chapter, here are some suggestions on what you can do next in this dodgeball project:

  • Make it so that the normal Wall class we created in a previous chapter doesn't block the enemy's line of sight. This way, the enemy will always throw dodgeballs at the player, which should still be blocked from going through this wall.
  • Add a new feature that will allow the player to visualize where the dodgeball thrown by the enemy character will impact first, using the concept of Sweep Traces.
  • Add a new type of wall that blocks the player character, the enemy character, and the dodgeballs, but that also takes damage from dodgeballs and gets destroyed when it runs out of health points.

There is a whole world of possibilities for expanding the scope of this project. You are encouraged to use the skills you've learned, and to do further research, to build new features and add more complexity to your game.

Summary

You have now completed the dodgeball game project. In this chapter, you learned how to add polish to your game by playing audio and using Particle Systems. You now know how to add 2D and 3D sounds to your game, as well as some of the tools at your disposal in regard to that. Now, you can try to add even more sounds effects to your game, such as a special sound effect for when an enemy character sees you for the first time (such as in Metal Gear Solid), a footstep sound effect, or a victory sound effect.

You also built a level using all the tools that you made throughout the last few chapters, thus culminating all the logic we built in this project.

In the next chapter, we'll be starting a new project: the SuperSideScroller game. In that project, you'll be introduced to such topics as power-ups, collectibles, enemy Artificial Intelligence (AI), character animation, and much more. You will be creating a side-scrolling platformer game where you control a character...

lock icon The rest of the chapter is locked
You have been reading a chapter from
Game Development Projects with Unreal Engine
Published in: Nov 2020 Publisher: Packt ISBN-13: 9781800209220
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}