Over the past week I've been delving into the world of OpenAL to create support for music and 3D sound effects in my game. Below you can watch my dev log video of this week's development, or you can read more about the updates below the video. Enjoy!
- Background Music: With the help of OpenAL I set up a background music system. Music tracks can be allocated to certain areas in the 3D world, and will start playing when the player enters the area. When moving between 2 areas the music currently playing will slowly fade out, before the new area's music begins to play. There's also a cool-down period of 30 seconds to stop tracks changing too frequently when the player crosses back and forth between different areas.
- Event Music: Not only does the background music depend on the area that the player is currently in, it can also depend on what events are taking place in game. Event music is music that starts playing instantly when a certain event occurs, and then once the event has finished it fades back into the area music. This sort of music could be used when the player enters a boss battle, or maybe when engaging in combat.
- Ambient Sound Effects: I also added ambient sound effects this week, which are sounds like birds tweeting and the wind whistling which can be heard in certain areas of the world. These sounds are emitted from sound nodes that I can place anywhere in the world. The closer the player is to a sound node the louder the sound coming from can be heard. Within a certain radius of a sound node its sound is played at full volume.
- Other Sound Effects: Finally, there is now support for general sound effects in the game. Any entity can emit a sound, and the volume that the sound can be heard at depends on the player's distance from the sound emitting entity.
So that's it for another week! Next week I'm working on particle effects, and you can check out my progress on my Twitter account or my Youtube channel if you're interested :) Thanks for reading!