User Tag List

Results 1 to 7 of 7

Thread: Making enemies find player

  1. #1
    No Products Registered

    Join Date
    Jul 2006
    Location
    Texas
    Posts
    1,225
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Making enemies find player

    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.

  2. #2
    No Products Registered

    Join Date
    Oct 2006
    Location
    Sheffield, England
    Posts
    41
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Making enemies find player

    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.

  3. #3
    No Products Registered

    Join Date
    Jul 2006
    Location
    Texas
    Posts
    1,225
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Making enemies find player

    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.

  4. #4
    No Products Registered

    Join Date
    Jun 2006
    Location
    Land of raging rockets
    Posts
    1,231
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Making enemies find player

    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)

  5. #5
    No Products Registered

    Join Date
    Jul 2006
    Location
    Texas
    Posts
    1,225
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Making enemies find player

    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.

  6. #6
    No Products Registered

    Join Date
    Jun 2006
    Location
    Land of raging rockets
    Posts
    1,231
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Making enemies find player

    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)

  7. #7
    No Products Registered

    Join Date
    Jul 2006
    Location
    Texas
    Posts
    1,225
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Making enemies find player

    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.

Similar Threads

  1. Enemies that follow player???
    By MrXkill in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 18th April 2011, 03:49 AM
  2. Help with making enemies chase the player
    By Gamemaker10 in forum The Games Factory 2 - Technical Support
    Replies: 8
    Last Post: 23rd September 2010, 08:00 PM
  3. Making the player Slide with the PMO?
    By Atherton in forum Multimedia Fusion 2 - Technical Support
    Replies: 17
    Last Post: 9th December 2009, 08:27 PM
  4. Making player Jump??
    By hendrix in forum The Games Factory 2 - Technical Support
    Replies: 1
    Last Post: 12th May 2009, 04:42 PM
  5. Making enemies flash when hit.
    By camelman in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 18th November 2008, 11:55 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •