For week 4 I thought I’d explore some new grounds and learn some new skills. The idea for this week started when I saw this game from Ludum Dare 42. I thought it would be fun to learn all the things needed to make a game look and feel like that.
The game is a space shooter through an asteroid field: asteroids are coming towards you and you’re running out of fuel. Collect fuel to keep you’re speed up and keep going.
Thanks to Oliver Wilde for the sound design.
The controls are WASD for moving and Left Click for shooting. Remember that the Y-Axis is inverted, so W pushes down the nose of the ship and S brings it up.
The glowing bar on the bottom indicates how much fuel you have left, the more fuel you have the faster you’ll go, if you run out of fuel you lose.
Avoid and shoot the asteroids and see how far you can go.
Design & Development
The game as I said started when I saw this game from Ludum Dare 42, other inspirations were the GummiShip segments from Kingdom Hearts and the N.Gin boss fight from Crash Bandicoot 3.
Eventually, during the week it started resembling more and more a clone of the game from LD42, so I decided to roll with it.
Again, the thing that had more appeal to me was the look and feel of that game because it covered most of the areas I was unfamiliar with, in Unity and in game development in general.
The first challenge to overcome was how to deal with all those objects on screen. I had already encountered some object pooling systems, a pretty advanced one in fact, from the Unity 2dGameKit, but this was the first time I made a new one from scratch so I went simple. I used a static class with a singleton pattern inside for the main OP code and then I would reference it from the various spawners in the scene. It turns out that a system this simple is not very good at dealing with objects of different kinds, I had to use an interface to pass information to the objects spawned and that had all sorts of problems. Next time I’ll try imitating the 2dGamekit system, that uses inheritance and allows for more flexibility.
For spawning all the asteroids and fuel I use a few spawner objects placed at a fix distance from the ship; these spawners spawn objects randomly within a radius or between two radii. I used a main one that spawned the bulk of the asteroids, it spawned asteroids of small size at a pretty high rate. The second spawner I used spawns the big asteroids and its radius is pretty small to keep the big asteroids mostly in the center. I also used one to spawn a lot of asteroids on the outer ring to delimit the game area.
Lastly I used five spawners with a very low rate to spawn fuel. I used five because I wanted the fuel to be mostly located near the edges to keep the player from staying in the center and forcing him to maneuver wide and fast.
Shader Graph and Post Processing
Honestly the Shader Graph tool was the whole reason I made this game the way it is. I wanted to try this tool for a long time and I always made my projects with the LW Render Pipeline in the hope of finding time to use it. This was the perfect opportunity: I made a Fresnel effect for the body of my ship and for the planets in the background, this effect gives a little glow to a surface when viewed from an angle; second I made a shader that emits only from certain parts of the body and last I made one that makes the object look like a hologram for the HUD.
The HUD actually, I’m a little ashamed to admit, is a plane parented to the camera. I went this way because I was short on time and couldn’t find a good way to make it consistent with the look of the game, but I’ll definitely work on my UI skills in the future.
All this would have been useless if I hadn’t discovered how to use post processing to make emitting materials actually glow and look like neon.
Another tool I was very curious about was the particle system of unity. Combining the acquired knowledge on shaders and post processing I was able to make some pretty cool looking particles, especially for the engines. For the engines I used a system that emits tiny cube meshes with an emitting material on them, and that makes it look like the particles actually come out from the engines. For explosions and similar effects I used the same system but with bigger and fewer meshes and managed to make some effects that feel powerful but don’t clutter the screen too much.
Finally I was able to make some sort of hyperspace effects using both meshes and sprites: the first I came up with uses sprites and is used to make that little space dust that is supposed to give a reference for how fast you’re going; the second one uses meshes and creates some high speed glowing debris and gives the illusion of moving fast through space.
Modelling the ship in blender
As I said, last week I took some time to research and Blender was the first thing I researched. I never made assets for my games and making one for the first time was very exciting. I started with modelling the rear of the ship, since that’s what you’ll see most of the time. Pretty soon I found that I wanted to make 6 different engines so two in the center 2 on the sides and two wide engines in between. I went with this because I had a pretty clear idea of the colors I wanted in the framing of the scene in game. Next for the body of the ship I tried my best to make something resembling the Obi Wan fighter from Attack of the Clones. If I had more time I would have added more glowing materials on the body of the ship, because I found that in-game the front of the ship looks uninteresting compared to the engines. All in all I had a lot of fun making the ship and I probably spent more time then I should have on it.
Other assets I made in blender were the asteroids, for which I used a cube with a simple subsurface modifier and the planet with the glowing crater, for which I mainly used a UV sphere it few segments.
I have to say, I’m very proud of this game and how it turned out. I’m also very happy of the amount of new skills and knowledge I gained: the development went pretty smoothly and I think I’m starting to have a feel for how and when things have to be done in order to make a game in a week. I was going to switch to Unreal soon, but after this project I feel that leaving Unity, given how little I actually know it, would be a shame. I’m very much looking forward to my new projects and all the new things I can learn.