Indie Game Devlog Episode 21: Recycling Projectiles, Engine SFX, and Floating Text Boxes
Hey, everyone! Welcome to Episode 21 of the Resonant Blade Devlog series! I’ve done some more work on the Underwater Tunnel Scene, adding in some sound effects, UI components, and speeder projectiles. I’ve also added some much-needed functionality into the code-base that will help keep track of more changes throughout scenes. That and some other improvements coming up!
ADDING SOME JUICE TO THE SPEEDER
The speeder controller I showed last time allowed the player to move around while changing the parallax factor of the background layers. I added a gun that the player can shoot now while riding on the speeder. It’s a fairly simple mechanic that shoots a continuous stream of bullets while holding down the left mouse button. Instead of instantiating and destroying every single projectile, I implemented a pool of projectiles that basically gets recycled. The projectile object is deactivated and its position is reset after flying off of the screen or hitting a surface.
I also added in some destructible crates that will spawn randomly in the player’s path. The projectiles will also create a small explosion when hitting these crates and the other barriers from the last video. Because the backgrounds are moving and the player is mostly staying still, I had to make sure to add movement to any new objects that are instantiated like the crate explosion and projectile impacts.
I created some new sounds for the speeder. When approaching the speeder, the icon now makes a small humming sound, letting the player know they can interact with this vehicle. For the speeder engine, I used a virtual synth, Massive, to create the engine start, the looped section, and the engine stop sound effects. Using a custom function, I can now create sound effects on the fly with one line of code. These have a wide array of parameters I can pass in for many different situations. Of course, this isn’t always the most optimal way of doing sound effects when it comes to performance, but it works great for quickly testing sounds. When the player activates the speeder, the start engine and ui confirm sound effects are generated and played back. The engine loop sound effect is also generated twice with different start times so they will start towards the end of the start engine loop and fade in. The reason I double up the looped engine sounds is because they create a phasey effect and I also dynamically shift the pitch of one of them while the player moves back and forth and the other sound remains static. Then when you get off the speeder, the loop sound fades out and the engine stop sound effect plays back. For the projectiles and impact sounds, I used some pre-existing sounds.
FLOATING DIALOGUE TEXT BOXES
I wanted to try and add some story elements to this scene as well. I created a new floating dialogue system that will appear above characters. During this section, Atlas receives an incoming radio transmission from a group of survivors in Locria. Not only do you have to locate the next Resonant Crystal, but you now have to rescue some survivors, too. This adds some urgency and gives some more context to the player’s upcoming mission. Design-wise, I’m not sure about the half-size pixels and smaller text. I like how it looks, but it doesn’t fit the pixel scale of everything else. I might scale this up and see how it looks at a later point.
I also made a small animation for when Atlas answers the radio call. I had to break up the speeder animation into multiple layers to make this work though. Atlas’s hair and the speeder will continue their animation loops while Atlas’s body can answer the call.
I tested out this floating dialogue box system on a couple of NPCs. I made the dialogue box and text box size dynamically change depending on how large the string of text is. I also added in a little pointer indicator sprite below the chat box to more easily show who’s speaking. After that, I just added in a couple of tags in the text that can move the chat box position between different NPCs so it looks like they’re having a conversation.
I made some small improvements to the Sonic Grenades. I added in an explosion sound effect and tried to create an animated sprite explosion effect to use with the smoke particles.
I reversed the animation order of the blockade of pillars from the Underground Locria Tunnel map so that it’s easier to discern what’s happening when the pillars descend.
Back in the land of code, I updated a script that will update the main camera settings when loading a new scene. I organized the script’s properties using the “Header” attribute making it a lot easier to look at and make changes quicker. This script can update the camera’s position, whether or not it’s following a target, set up the camera bounds for the scene, change the bg color of the camera, adjust ambient lighting, adjust post processing brightness and contrast, adjust the player sprite’s brightness, and make it rain.
I also added a new static class for keeping track of switches and triggers in scenes. When loading into a new scene, Unity will not keep track of whatever happened in the previous scene automatically. All of that info will be reset when re-entering that scene. Using a static class with a dictionary storing the scene name and name of the trigger makes it easy to update and modify when making changes in the game. This will also come in handy when I have to write all of this data to a text file for saving and loading.
Alright, that’s it for this episode. I’m still working on the next experimental demo build for you guys to try it out. Thanks for watching/reading everyone and I’ll see you next time!