Tower Defenense - tower effect on enemy path

Hey there,
Im looking for some ideas for my enemy AI in a tower defense game.
I need my enemys to be able to cross to the other side of the screen. I’ve seen a few algorithems that caculate their path, but I want it to consider the towers location, so the enemys are “smarter” and try to avoid walking right through the range of multiple towers. Something like finding the “safest” way. It doesnt have to be super complicated, just to have an effect on the game.
Does anyone have ideas on ways to do something like that? It can even help if you saw someone doing something similar.
Any help would be great, thank you!

Generally A-star pathing is the way to go. A tower would increase the localized “cost” of nodes nearby, causing agents to try to path around it, make agents tend to avoid it, almost as if it was an “invisible hill” that they didn’t want to go over.

Thank you for your quick answer! I actually didn’t know that, it sounds exactly like what I need. Before I dive into the documentaion, just wanted to ask- is there room for changing it to my needs? like controlling the tower’s range or impact, or stuff like that. I’m trying to get my game to be challenging and it could help a lot :slight_smile:

A-Star is a completely-abstract way to find an optimal way through a non-directed graph, so it is up to you to define and map that graph, both nodes and connections, to your game problem. Work through some tutorials on Astar but do it OUTSIDE of your problem space; you need to understand the basics of it before you can apply it to your problem space.

My bad, I thought you were talking about the A* package. Any way, I will look into it. thanks!

Astar A* A-STar whatever, it’s a mathematical graph concept, many people have used it, some have even packaged it as commercial offerings. In fact, I am 99.9% sure Unity uses some flavor of it inside the navmesh AI system. Maybe you can even leverage that system… I’m not sure it supports dynamic weights, but it’s a thing you could investigate.