Turret Tracking


Author: Matthew Pacheco

As we are getting closer to the finished product of the game, I am working less on new defenses, and more on improving/ adding functionality to existing ones. There are a lot of different issues that I ran into, but having run into some before, like the component hierarchy, I was able to move past them quickly. One of the optimization pieces that gave me the most difficulty was different ways for the turrets to track the enemies. The grenade turret in particular, has to take into account the fact that it's attacks take time to hit their target. This means, between the turret shoot and the attack landing, the enemy will be in a different position. There are many solutions to this, but each come with more issues that have to be fixed before it works perfectly.

To deal with these calculations, I mainly used interlopes based on the enemies distance from the turret, and velocity. There are multiple values that now lerp based on how far the enemy is, and allow the turret to accurately hit enemies with predictable pathing. The lerp functions along with the explode on impact, made it possible to have this turret fire accurately in different situations. I was then able to add the same functionality as the other turrets, so that they can target the best enemy of the ones in range. Eventually, there will be different options for how the turrets target and fire, saved as presets.

Posted on 11/16/2023

Get Cyber Siege

Leave a comment

Log in with itch.io to leave a comment.