Pacman clone - ghost ai

  • I'm working on a pacman clone. I searched the forums for how to do ghost AI in the game, but the links lead to construct classic. I don't remember the pacman talk, but the original developer talked about how each ghost had a personality.

    -one ghost chased pacman

    -another went randomly

    -another ghost would chase pacman only when he got close

    -another ghost followed pacman's previous steps

    I can figure it out in my head, but Im not sure about how to put it in construct2. I also apologize in advance - Im not good at programming and went to school for art.

  • Pathfinding.

    You can find a few examples in the forums, as well as a wonderful plugin/behavior.

  • This article can be interesting if you want to know a bit more about pacman ghosts

    http://gameai.com/wiki/index.php?title=Pac-Man

  • Hm, pathfinding seems way more complicated than I expected. I'm looking for a more simple solution.

    I'm dumbing down my idea.

    So if a ghost hits a wall, it decides to turn either left, or right. In a sense, it moves kind of random.

    Right now, I'm trying to figure out how to make this work.

    http://db.tt/0GaUmvpL

    Thanks in advance. <img src="smileys/smiley5.gif" border="0" align="middle">

    Edit : Hmm, there's a Simulate Controls. Forgot about checking the sticky 'How Do I' forum post.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Read the page that Yann linked. The original Pac-Man is not using pathfinding; as a ghost approaches an intersection it merely measures the distance to its target location and then picks one direction.

  • Hmm. So based on that, I'm thinking of creating invisible nodes to decide which way to turn. I'm still trying to figure out how to make the ghosts move randomly. Thanks for the ideas!

  • If it will help you, I have a "pacman" learning exercise that I'm putting on hold for now. It incorporates Kyatric's pathfinding behavior (which actually makes it simpler, rather than more difficult!) Anyway, if you want it, here it is:

    PathfinderPman.capx

    I took one of the pathfinder examples that shows how to move an object, gutted it and grafted on the pacman stuff. There are performance problems and lots of bugs. The worst is that the enemies just will not start out where they should! But it may help you getting things going.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)