Learning Unity - Argon Assault
- Jason Warrick
- Jun 2, 2022
- 6 min read
Created by following and expanding upon a GameDev.tv tutorial
The next section of the boot camp covers a sci-fi rail shooter called Argon Ashsault!

The first order of business was to set up and paint some initial, basic terrain for the main level of the game, which looks like so! I tried to keep it as organic as possible and prevent it from feeling like something that was painted quickly in a terrain builder, but that's sort of hard to avoid when it's what you're doing.

To help refine the terrain we installed the terrain tools package, and then used the tools in that to make the terrain more interesting and realistic. I put an extra emphasis on realism and tried to apply erosion as it would happen in real life, as well as make it interesting with some wild detours and narrow passes.

After some brief trips to the Unity Assets Store, we have a pretty new painted terrain! I'm very happy with how it looks, maybe aside from the trees, but I'm not too concerned with that at the moment as I can change it pretty much whenever I'd like.
In the next lesson we pretty much just got straight into it with creating the rail for our player and camera! So far, I'm not a huge fan of using the timeline, as you can't adjust key frames once they're made (why????) which makes it feel pretty rigid and unintuitive. I'm sure that there's some tricks or additional tools that will help this pain point, so we'll see!
The next step was to add an enemy that flies by, which I sort of did, but ended up making more of a first encounter rather than a brief interaction, which I'm not upset with! Also, I discovered that you can edit keyframes in the "Edit Curves" window of the timeline editor, which is why the player animation is also much smoother now, nice!
This is another double update on both the new player ship, and keyboard and controller inputs! Before that though, you might be saying to yourself "Man, that terrain looks awful different from how it did before," to which I would say "Y'know what reader, you're right!" And this would be because, in all of my infinite wisdom, when trying to move the terrain from the terrain folder to the prefab folder, I brilliantly decided to swap steps and delete the terrain folder BEFORE moving the terrain to the prefab folder. Super cool, right? Anyways, I'll just say it was "for the better" since it gave me the opportunity to make the terrain a little more interesting, with more opportunities for camera rails.
Now, onto the new stuff! The player ship was just from a free asset pack from the Unity asset store, but it's pretty great! For the inputs I opted to use the new input system, as the instructor gave a lesson on how to set it up, and I figured it's best to learn what's new in the engine, and it seems like it has the opportunity to be really useful!

This is the setup for the new input system, and it's a lot less complicated than I thought it was (I had to use it a little for a recent school project, but I didn't really spend the necessary time to think about it). The out-of-the-box controller support is super nice as well!

Accessing it in code is pretty easy as well! Once it's set up it's pretty close to identical to the old system, so it should hopefully be smooth sailing from here!
Using that player input and some minor transform code we can get the player moving! This is with the controller and it actually feels really good! There's something about controller integration that makes it feel like a much more polished game than it actually is.

This is the new PlayerControls class with some stuff in there to move the player. I'll probably tweak this a bunch and try and implement the input handling I made for Water You Doing, but for now this works well!
There have been quite a few notable changes since I last updated! Firstly, lasers! For testing purposes they're just infinitely running, but I assume that making them player-controlled will be a next step. They were made with particle emitters, which happened to be relatively intuitive to use! In addition to the lasers, the camera rail is now much longer and much smoother! There are some points where the rotation isn't exactly spot on, but it's good enough for now, and feels pretty good to play!
As predicted, the next batch of lessons covered how to fire on a button press, which again, wasn't too bad! I also took the liberty of adding some linear interpolation onto the rotation, that way it's much more playable with a keyboard, as it was pretty jumpy before.

These changes can both, quite conveniently, be shown in this screenshot! The ProcessFiring and SetActiveLasers methods are doing the heavy lifting for the firing (and by the way, firing is just a separate InputAction that responds to the space bar, and the south face button on controllers!), and line 74 handles the interpolation, with the help of some frame-independent variables!
Now for another slew of updates! Starting small, the projectile bullets now bounce (just because), and the enemies (and player) can die on hit! All of this is accompanied with some new particles, all of which are implemented in slightly different ways! FYI, the bouncing particles was just a matter of turning the bounce value to 1 in its inspector.

Here is the new, fancy dancy player collision handler script, that performs a variety of tasks, including playing particle systems, detecting which objects hit the player, and reloading the level when getting hit, after a brief delay. This was mostly a repeat of what was learned in the development of "Water You Doing," but it's always nice to refresh!

What IS new however, is the use of the Destroy() method in Unity, which has been used to remove the enemy object from the world when it's hit by the player's bullet. At this time, the enemy explosion particle system is instantiated at the location of the player and played on awake.

Just as a small optimization / organization note, each enemy particle system has this script attached to it that destroys it after a certain time of it being awake. I was going to look for a more modular approach for this (one that only destroys the object after its particles are done playing), but I figured that can be saved for later in development.
Again, quite a few updates have been made, let's review!
Firstly, you'll notice that there's both a scoreboard, new enemy ships, and vfx every time you hit an enemy. These are all essentially tied to the new enemy prefabs, which all have their own hit points, score values, and models. The ScoreBoard script keeps track of and displays the points on the screen, and the actual display was done using a TextMeshPro!

Here's the ScoreBoard script, which is pretty small as there isn't that much it needs to do. The important thing with this script that we learned about was the use of public variables and classes, that way the enemy script can access the updateScore method, in order to dynamically keep track of the players score.

This is the updated, significantly beefier enemy script as well! You can see the serialized health and score variables up at the top, as well as the expanded OnParticleCollision method, that now includes a case for a hit but not a kill.
With the addition of a new skybox, post-processing, an end scene, a main menu, and more enemy encounters, Argon Assault is complete! The new skybox is from the unity assets store, and the only post processing I added was ambient occlusion and bloom, so those processes were pretty simple. I've really been hoping to learn how to work with post-processing sometime soon, so I was happy to do that here!

The programming for the restarting of the game when the timeline ends was pretty simple, but also definitely not the most modular approach I could've taken. Said approach being loading the title screen when a specific game time has been reached. It was definitely the easiest to implement, which was what I was looking for as I was somewhat anxious to get onto my own games at this point.

The title screen was also pretty simple, it's just constructed from a skybox and a canvas layer that has the title and a button attached to it. The button has the above script which just loads the proper scene, as you would expect.
Play Argon Assault here, by the way!
What I Learned
Advanced Unity Timeline concepts
Custom particle systems with collision
Post-Processing
Unity Asset Store integration
Controller support
Basic menus and buttons
Instancing at runtime
Terrain construction / design / texturing using the Terrain Tool
HUD with dynamic text and audio representation
Advanced 3D character movement
Clamping motion
More than the technicals and bullet points, this was an absolute mammoth of a project that taught me a lot about what it takes to make a game feel full and complete. There were a lot of small details that were taught, and that I made myself, that add up to a satisfying experience, which is something that I will always strive to do with my projects. There are a few more games I could complete through the bootcamp, but I may return to them after making a few of my own.


Comments