Asteroids! Asteroids, everywhere!


Asteroid Fields

One feature I've always wanted to implement: asteroid fields.  Vast fields of rocks that can span across huge distances.  

The problem: performance degradation from updating a large number of bodies.  

The solution: use a smaller number of bodies, local to the player position, which are updated and displayed when in defined asteroid field areas.  Perform updates using the Unity Job System for improved performance.  

The first videos show the result of an infinite asteroid field.  A clipping distance is used, hence asteroids will pop in and out of view at the boundary.

How it works: asteroids are initially spawned around the players local position as far as the defined viewing clipping radius.  Each asteroid is checked to determine if it falls within a defined asteroid field area.  If it is, then show it, otherwise we hide it from view.  We then move each asteroid based on the players velocity.  When an asteroid goes past the boundary of the clipping area we re-spawn at another random position at the boundary edge.

This works well and performance is improved using the Job System over a single threaded process.  These asteroid fields demos were run within the Unity editor so performance would be improved in the build without the editor overhead.  One problem I will have is figuring out a balance for lower end systems as access to such a system is currently out of picture right now.  I will be using Unity Analytics to help, once a playable build is made available, I will be able to compare performance across a range of systems as players engage with the game.

Currently, on my dev build performance starts to drop when 7500 bodies are visible.  This was not the huge performance boost I was expecting using the Job System, so I may have to also experiment with the Entity Component System.

The asteroid field is not finished, I'd like to add further improvements to the aesthetic and also make them feel more dangerous than they currently are.  In the version two video, below, there are now asteroid debris and dust clouds.

Flying through an infinite asteroid field with dust clouds and debris gave me a sense of claustrophobia that I had never had before. I just wanted to get out yet there was no end...

Mission Editor

Have you ever wanted to create you own missions and test the limit of your combat skills by creating your own adversities to over come?  Or is it just me?  Below is a short video showing a proof of concept on this idea. Simply click and place enemies to fight inside an area, click launch and go to battle.  

It's pretty simple, the only rule set currently is to destroy all enemies within the area.  I'd like to expand this so the player can create simple sets of rules for spawning additional enemies along with other success and failure conditions, and configure ship loadouts.

You can updates showing the development of Absolute Territory @ https://twitter.com/abs_territory

Leave a comment

Log in with itch.io to leave a comment.