Skip to content

Sound Effects

Su LAN edited this page Oct 19, 2021 · 17 revisions

Purpose

Music, interactive and atmospheric sounds provides a more immersive experience for the player, giving character to the world around them.

Sounds were developed for:

  • The player picking up buffs and debuffs
  • The player winning a level
  • The player losing a level
  • The player pressing buttons on the menus

Music was developed for:

  • The Main Menu
  • Game beginning story pages
  • Game loading screen
  • Level One
  • Level Two
  • Level Three
  • Level four
  • End of game story pages

Initial Research

Being a fast-paced platformer, some inspiration was taken from popular game themes, such as Sonic the Hedgehog's Green Hill Zone theme.

Design of sounds

The sounds were designed using different software and websites, depending on which provided effects and samples that fit the overall theme we were aiming for.

Software

Garage Band

Garage Band was used for the design of the menu sounds, including the appearing of the menus when the player wins and loses, and also the on-click sounds for the menu buttons.

屏幕快照 2021-10-05 下午12 15 52

Ecrett music

Ecrett music is an AI-based music generator and editor tool. It automatically creates royalty-free game music based on different themes, backgrounds and mood settings. We used this tool to generate and edit sounds for the game beginning and end story, loading screen and game level four.

Integration into the final release

Currently, the sounds which have been implemented into the game are:

Background Music

  • The Main Menu theme

    As the game is set in the universe, the soundtrack was made more ethereal, so that players can imagine the immensity of the universe just by listening to the music during the menus.

  • The Game theme (level 1, 2, 3, 4)

    Each background music has a number of tracks, the main ones being the background track and drums track.

    The background tracks are different for each level, depending on the design background of the level

    During the game session as players are being chased, drums are added to simulate footsteps and create the atmosphere of being chased, which will become faster and faster as the level increases.

  • Others

    The beginning introductory story sets the space adventure theme with a hopeful mood. Integrating the music in the game immersively makes players feel their escaping mission and enhances their game expectations.

    The ending story music appears when players completely win the game. The cheerful, groovy and uplifting suits the mood of winning.

    The loading screen uses an electrical soundtrack. The upbeat sound can potentially increase the player's expectation of the game.

Sound Effects

  • The player picking up a buff

  • The player picking up a debuff

  • The button effect on the main menu and intro page

    When picking up a buff the sound effect is designed to be crisp and the pitch is rising. When picking up a debuff the sound effect is designed to be low and the pitch is down.

Code

First things you need load the music files

private static String[] forestMusic = {"sounds/maingame.mp3", "sounds/level2.mp3", "sounds/BGM_03_mp3.mp3","sounds/level3.mp3",};

you need to add the music to the sound effect area. And add a play function. Call the playMusic function in Creat Function

private static final String backgroundMusic = "sounds/maingame.mp3";
private static final String[] forestMusic = {backgroundMusic};

private void playMusic() {
    Music music = ServiceLocator.getResourceService().getAsset("sounds/maingame.mp3", Music.class);
    music.setLooping(true);
    music.setVolume(0.3f);
    music.play();
  }
public void create() {
    playMusic();
  }

Designed but not yet ready for implementation

Sound Effects

  • The player click buttons

Designed to add some sound effects to the interaction of buttons on the main page and some pop-ups to increase the sensory effect.

  • When the player win & lose the game

When a player wins or loses a game, design some sound effects for the sensory presentation of the current state.

Further implementation

During the last sprint, several new game screens were created including the game beginning story screen, the loading screens between each level, the level four game area. Therefore, the new sound effects should be designed and implemented for these screens. Below are some implementation hints for adding the sound effect of these screens. Unlike the game areas, the implementation of the screens is a little bit different. For the game beginning story, the sound effect should be implemented in the IntroDisplay class instead of the IntroScreen. However, the corresponding .mp3 file still needs to be loaded in the IntroScreen class. Here is the example of implementation: Firstly, add the sound effect in IntroDisplay class.

    private void playBackgroundMusic() {
        Music menuSong = ServiceLocator.getResourceService().getAsset(MUSIC_FILE_PATH, Music.class);
        menuSong.setLooping(true);
        menuSong.setVolume(0.5f);
        menuSong.play();
    }

Then, load the corresponding music file in IntroScreen.

    private void loadAssets() {
        logger.debug("Loading assets");
        ResourceService resourceService = ServiceLocator.getResourceService();
        resourceService.loadMusic(introScreenMusic);

        resourceService.loadTextures(screenTextures);
        resourceService.loadSounds(mainMenuClickSounds);
        ServiceLocator.getResourceService().loadAll();
    }

The sound effects implementation for the loading screen is quite similar to the intro screen. Firstly, implementing the sound effects in LoadingDisplay class. Then, load the music asset in LoadingScreen class. For the implementation of the background music in level four area. It called the playMusic() function in the ForestGamearea class and load the music asset in the LoadingScreen class.

Table of Contents

Home

Introduction

Main Menu

Main Game Screen

Gameplay

Player Movement

Character Animations

Enemy Monster Design and Animations

Game basic functionalities

User Testing

GitHub Wiki Tutorial

Game Engine

Getting Started

Documentation

Entities and Components

Service Locator

Loading Resources

Logging

Unit Testing

Debug Terminal

Input Handling

UI

Animations

Audio

AI

Physics

Game Screens and Areas

Terrain

Concurrency & Threading

Settings

Troubleshooting

MacOS Setup Guide

Clone this wiki locally