I'm making a top down shooter where zombies are coming to kill you... yada yada yada. I was wondering how would be the best way to get pathfinding in 360 degrees. Just using the line of sight thing isn't good enough.
I'm making a top down shooter where zombies are coming to kill you... yada yada yada. I was wondering how would be the best way to get pathfinding in 360 degrees. Just using the line of sight thing isn't good enough.
For my zombie game I use nodes at specific points of the map, and the zombie targets the nearest node in relation to the player if he isn't in easy range of the zombie.
For example, (once the player has been spotted by a zombie) say we're in a maze, I'd put nodes in the corners of the walls, so a zombie would walk towards the nearest node in the direction of the player. Dunno if that helps jump-start any ideas in your brain or not. I haven't got the system working perfect yet, but it works in a vague sense. I've been using the Vector movement by the way.
Remember though, with zombie AI, it doesn't have to be super intelligent, basic pathfinding is adequate.
I was thinking of doing something like a grid where the zombies will move to the player from different sides to try to surround the player. I'm still thinking of how to do that.
Hm.. I had something like that. You can take a look at it in action here: http://publiclag.sitesled.com/files/magegame.exe
Basically it works like this. When an enemy sees the player (direct line), he will store the players position and moving direction in its own values and approach the player. As soon as the enemy can't see the player anymore, he will go to that position until he can see the player again. If it reaches that point and still can't see the player, it will turn the direction that the player was facing and go there (bouncing ball style).
For zombies this works pretty well. Enjoy(btw, if someone likes that game that you can see up there and wants to finish it, message me, you can have it :P I don't have the time to finish it)
I thought about doing that, but the only problem is that that makes the game too easy, where you can just keep running in a big circle and they will always be behind you.
What I'm going to do is just have it so the zombies, when created, are assigned a random integer to be added onto their angle so some may trail behind or in front of the player, and if they get too close to a wall, they'll rotate away from it accordingly. I might also use your method on every other zombie, just to add some variation.
One thing you can do is calculate the movement vector of the player and use that as the destination position.
So you use his direction and speed and calculate the player position of the future (a couple of seconds), then send the enemies there.
This will make them go where the player is heading.. (but you better don't do that with all of them)
What I meant was have it so they would cut him off from around a corner or something. I think I've got a good system now.