Astral Elites (2019)
Implementing
Procedural Meshes
The first system I built was runtime procedural asteroid mesh generation, giving every asteroid a unique, irregular silhouette. I then used Unity's 2D physics engine to hurl those asteroids toward the centre of the arena, keeping the physics simulation lively and each run feeling distinct.
Optimizations for
Autoplay in the Background
This page of my website features the game playing by itself in the background.
Configuring the game
To allow the game to be played in the background, I needed to create an alternate game controller that would manage the auto-playing of the game. This alternate game controller should only be active when the project is launched in background mode.
Allowing the project to launch in two different modes instead of creating alternate versions of the game means the website doesn't have to download two different games; which means users of my website can load the game faster.
In order to tell the game that it should be a background and not a playable game, I pass a command-line argument into the game in the JavaScript that launches the game. The game then checks for this, and launches in the alternate mode.
Finally, I added a basic AI player controller to play the game (albeit poorly) and the background is done!
Making it load faster
Since the game auto-playing is now apart of the project landing page, it's important that it loads as quickly as possible.
Using Unity's Asset Bundles, I moved the background music for the game into a separate bundle which is only downloaded is music is required. Since the background version of the game doesn't need music, it's not download until the player pressed the button to "Play in Browser".
Working with the
Discord SDK
One of the first things that I decided to implement to further the development of this project was to implement the Discord SDK. The Discord SDK provides "rich-presence" integration that allows me to render the players current game state with their friends.
I also explored the multiplayer APIs that Discord exposes, but I didn't implement them on this project due to it being a single-player game (though I was tempted to make it multiplayer purely to explore these multiplayer APIs more).