In June 2022, my friend (Tariq) and I made C.L.3.4.N UP in 36 hours as an entry to the Simple Jam #1. The aim of the game is to mine asteroids and drop the resources off at the correct space station to make as much money before the timer hits zero. You can play it here!
I did all of the programming for this project whereas Tariq did all of the sound design and composed the music. We both shared responsibility for the games visuals and art. Check out Tariq’s work here! Below is some more details about technical aspects of the game.
Object Pooling
Despite this being a short project (made for fun), it was still important to me to produce a well-optimised code. I used object pooling to handle spawning & de-spawning of the both the asteroids and the player’s missiles. Two different approaches we’re used for each of these mechanics.
Firstly, the each instance of any of the asteroids we’re automatically teleported to a new position (nearer the player) each time the player flew past a certain distance. This ensured that objects we’re not being constantly instantiated and destroyed throughout the gameplay and also offered a easy way to balance the number of asteroids within the level at any one time.
Optimisation player missiles, were far simpler. During run time, a list kept track of all of the active missiles in the game. At the start of the game, five missile objects were instantiated, set inactive and added to the list of active missiles. Each time a missile was fired one of these missile would be activate in the scene, removed from the list and teleport to player’s position so they a forward force could be applied. Upon contact with any other object the missile would deactivate itself within game world and added back to the list. If the missile did not hit anything with a few seconds it would be de-spawned as in the same way as if it collided with an object.
Third-Party Flight Controller
I’ll always give credit, where credit is due and its important to make clear that I did NOT program the flight controller used within Clean Up. It was made by a very talented developer Brian Hernandez (a.k.a. Why485 on Youtube). He made and released the flight controller used within the game in 2019 under a MIT license; it can be found here on his GitHub. It’s a great, well documented asset that I would definitely recommend to other developers.