Gravity Ace
Wishlist on Steam! Follow on itch.io!

Making better bullets in Godot Engine

Making better bullets

Transcript:

Hey everybody and welcome back to video devlog number 2 for Gravity Ace.

Why is making video games so hard? Let me show you an example from Gravity Ace and Godot Engine. This isn't quite a tutorial but I did want to show you some concepts and tips that you can apply whether you use Godot or some other engine like Unity, Game Maker, or Construct. Please feel free to ask specific implementation questions in the comments and I'll do my best to help.

Gravity Ace is a game about precision flying, difficult maneuvers, and blowing stuff up. Because shooting is such an important part of the game I want to make sure that it feels good and looks good. So what's so tough about shooting? Like most effects in the game, it's not just one thing… there are multiple effects and mechanics all layered together into a delicious and satisfying game sandwich.

Keep in mind these are my opinions – not rules. There are going to be exceptions and you might disagree. What works for one game may not work for another. But I think these are good general guidelines.

Let's start by looking at the humble bullet.

This tip is pretty simple but I see people missing it all the time: make the bullets bigger. That's it! I see lots of games that use tiny bullets. Maybe they do it because bullets are tiny in real life. The thing is, bullets move fast. If they're too small then they become almost impossible to see. That makes it hard for the player to correct their aim, hard for the bullet to hit the target, and hard for the player to tell if they hit or missed. With a bigger bullet you can also use a bigger hit box. So what if it's not realistic? It's a game. Bullets in Gravity Ace are about half the size of the player ship.

Enemy bullets have a similar set of issues. But with enemy bullets you want the player to be able to see them coming and for it to feel fair when they get hit. Mine are about the same size as player bullets making them easier to see and easier to dodge. And the hitbox on enemy bullets is slightly smaller than the sprite so that players can make really cool close escapes.

There's a particle system attached to each bullet. The particle system causes each bullet to emit little sparks in their wake. The particles make the bullets look cool and give a feeling of power, like they're ripping the fabric of space.

Every bullet has a glow sprite attached to it. The glow is a simple texture of a circle with a soft edge. The color is modulated to match the particle system and the blend mode is set to Add so that it makes the bullet and things near it brighter.

Every bullet leaves a line trail behind it just like the ones on the player wingtips. It makes the bullets more visible and gives them a feeling of speed.

Each shot triggers a muzzle flash from the gun with two components. The first component is a flash that shoots out perpendicular to the shot. This is like a gas exhaust or smoke. You might do something similar by ejecting shell casings, for example. The second flash happens at the same time and it appears in line with the direction of the shot. The muzzle flash is a six frame animation with four variations so it doesn't seem repetitive. The flashes give each shot weight and impact and make the bullets feel powerful.

That's the visual stuff. Now let's talk mechanics.

First, if shooting feels good then you should let the player do it a lot. Obviously this is going to be different from game to game. But in Gravity Ace I want to let players put a lot of bullets into the air. Therefore the gun is fully automatic, it has a high rate of fire, and the player has unlimited ammo.

Each time you shoot a bullet there's a slight amount of knock back. A small force impulse is applied to the player in the opposite direction of each shot. You can actually fly the ship around (slowly) this way. It's subtle but it helps the player feel each shot.

There's a little bit of screen shake added for each shot. Literally the camera shakes for every shot, just a little, for more impact. Just like the knock back, it gives the player the visceral feeling that something significant just happened whenever they pull the trigger.

Another layer is a screen space shader that adds a chromatic aberration effect. Randomly, the red and blue channels on the entire screen are separated in opposite random directions. It looks like a visual glitch. It's like your bullets are so powerful that they're breaking your computer.

Finally, there's sound. Shooting needs a sound. Lots of different directions you can go. Since the gun in Gravity Ace fires so many bullets I didn't want it to become repetitive or tiring. So I created a sound that wasn't too overwhelming, something that felt balanced with the rest of the audio. The sound is also pitch shifted randomly for each shot to give it variation.

On top of that there's another sound that plays when the bullet impacts a wall and a different sound when the bullet impacts an enemy.

And I could go on and on because that's not totally the end of the story. Bullets hit things and those things explode. Explosions have a similar story with lots of effects and sounds and mechanics all layered together. But maybe I'll talk about that another day.

Let me know in the comments below if you have any questions or tips or just want to share your thoughts. You can also go to GRAVITY ACE DOT COM, try the beta, and join the Discord server and hang out.

Thanks and see you next time!

Published December 15, 2019

More devlogs...

Laser beam art stream

Live coding and debugging session

Code review!

More...