Real-Time Space Tactics Game – Dev Log 3

Since my last update, I’ve begun work on the combat system. Specifically, I’ve implemented a laser cannon on the flagship, and set up a way for friendly ships to lock onto enemy ships and fire at them when they’re in range. In the future, I’m going to set up an “autofire” or “defensive fire” system where the ship will fire at any enemy ships that come within range. This will also be the “point defense mode” for the ship’s beam weapons. I’ll play around with it some more once I’ve set up enemy torpedoes.

The flagship (highlighted in green) fires a blue laser beam at an enemy frigate (highlighted in red).

Right now, the beams use simple line renderers – in the future I’ll play around with some particle effects and materials to make them prettier.

I had to do some tweaking to get enemy ships to properly flag as deselected – originally it only flagged a ship as deselected if you clicked off of it onto the map, and not if you clicked another enemy ship. I also realized that a binary “isTargeted” value wouldn’t be sufficient due to the possibility of multiple ships targeting the same enemy ship, so instead I used a counter that tracks how many ships are targeting that ship at any given time; if the number is above zero, the ship gets highlighted.

I think my next priority is going to be getting enemy ships to exhibit some basic “seek and destroy” AI when given a target, along with setting up torpedoes that can be shot down by beam fire. As for how targets will be assigned, that I will leave to an AI “enemy fleet commander” that I’ll design at a later date.

Leave a comment