Quantcast
Channel: Questions in topic: "tower defence"
Viewing all articles
Browse latest Browse all 10

What tower defence turret AI approach is best-practice?

$
0
0
G'day guys, I'm writing a tower defence game and currently have a functional system where the player clicks to 'deploy' a turret, after which any enemy that enters that turret's collider triggers an event which adds it to a list of available targets. The tower shoots at it until the target is either out of range (left the collider) or dead. When I implemented a raycast to check LOS, it occurred to me that the trigger+array system might not be the most efficient long-term. I've read (and experimented with) using **Physics.OverlapSphere** and I've encountered another approach that relies on one global array of all enemies, and every turret in the game is constantly raycasting each enemy to see if it is in LOS/range, etc. What I'd like to know is which approach (especially if there are some I'm unaware of) is the most efficient? I know efficiency could be debated, but I figured I'd ask as I imagine many of you blokes have written TD games before. Cheers guys.

Viewing all articles
Browse latest Browse all 10

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>