Pacman clone - ghost ai

Get help using Construct 2

Post » Wed Feb 08, 2012 3:28 am

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.
B
20
S
5
G
5
Posts: 66
Reputation: 4,515

Post » Wed Feb 08, 2012 3:31 am

Pathfinding.

You can find a few examples in the forums, as well as a wonderful plugin/behavior.
B
11
S
3
G
2
Posts: 110
Reputation: 2,410

Post » Wed Feb 08, 2012 9:39 am

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
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Thu Feb 09, 2012 6:56 pm

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.

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

Cpryd0012012-02-09 19:09:01
B
20
S
5
G
5
Posts: 66
Reputation: 4,515

Post » Thu Feb 09, 2012 8:53 pm

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.
B
12
S
3
G
3
Posts: 73
Reputation: 2,647

Post » Thu Feb 09, 2012 9:42 pm

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!
B
20
S
5
G
5
Posts: 66
Reputation: 4,515

Post » Mon Feb 13, 2012 3:51 am

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. kittiewan2012-02-13 03:51:38
B
29
S
11
G
12
Posts: 281
Reputation: 11,888


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 25 guests