Skip to main content
grammar punctuation and format
Source Link
Gnemlock
  • 5.3k
  • 5
  • 30
  • 60

Path finding: Avoidavoid being surrounded by enemies

I'm building a bot that plays a simplified version of Pac-manPac-Man. The The bot does a pretty good job, but sometimes it chooses a path where it ends up surrounded by enemies. EX

Here is an example:

XXXXXXXXXXXXXXXX         XXXXXXXXXXXXXXXX         Legend:
xxxxO1   E1              xxxxPE1                  
XXXX XXXXXXXXXXX    ---> XXXX XXXXXXXXXXX         O Objective
E2   P        O2            E2 E3      O2         P Player
XXXXXXXX XXXXXXX         XXXXXXXX XXXXXXX         E Enemy
XXXXXXXX XXXXXXX         XXXXXXXX XXXXXXX         X Wall
XXXXXXXXE3XXXXXX         XXXXXXXX XXXXXXX         x Wall


In this situation, my bot is at the point of no return. It will choose to move
to and pick up objective one (O1), as it is the closest objective in sight, 
and in theory is still a safe path. However, in doing so, enemies will surround 
him and he will die. (Map on the right). 

Legend: O are objectives, P is the player, E1, E2 and E3 are enemies that are chasing the player, X and x are walls. (Map on the left)

In this situation, my bot is at the point of no return and it will choose to go and pick up O1, because is the closest objective in sight, and in theory is still a safe path, but doing so, enemies will surround him and die. (Map on the right).

I'm trying to come up with ideas on how to make my bot avoid that path, and go for thea safer one. The The bot should determine in advance if completing the current path (to O1O1) is a good idea or not, in advance, and make a decision.

BTWHow would I go about this? I'm using a simple A* for pathfindingpath finding over a grid. Any pointers, ideas or comments are very welcome.

Thanks in advance!

Path finding: Avoid being surrounded by enemies

I'm building a bot that plays a simplified version of Pac-man. The bot does a pretty good job, but sometimes it chooses a path where it ends up surrounded by enemies. EX:

XXXXXXXXXXXXXXXX         XXXXXXXXXXXXXXXX
xxxxO1   E1              xxxxPE1   
XXXX XXXXXXXXXXX    ---> XXXX XXXXXXXXXXX   
E2   P        O2            E2 E3      O2
XXXXXXXX XXXXXXX         XXXXXXXX XXXXXXX
XXXXXXXX XXXXXXX         XXXXXXXX XXXXXXX
XXXXXXXXE3XXXXXX         XXXXXXXX XXXXXXX

Legend: O are objectives, P is the player, E1, E2 and E3 are enemies that are chasing the player, X and x are walls. (Map on the left)

In this situation, my bot is at the point of no return and it will choose to go and pick up O1, because is the closest objective in sight, and in theory is still a safe path, but doing so, enemies will surround him and die. (Map on the right).

I'm trying to come up with ideas on how to make my bot avoid that path and go for the safer one. The bot should determine in advance if completing the current path (to O1) is a good idea or not and make a decision.

BTW I'm using a simple A* for pathfinding over a grid. Any pointers, ideas or comments are very welcome.

Thanks in advance!

Path finding: avoid being surrounded by enemies

I'm building a bot that plays a simplified version of Pac-Man. The bot does a pretty good job, but sometimes it chooses a path where it ends up surrounded by enemies.

Here is an example:

XXXXXXXXXXXXXXXX         XXXXXXXXXXXXXXXX         Legend:
xxxxO1   E1              xxxxPE1                  
XXXX XXXXXXXXXXX    ---> XXXX XXXXXXXXXXX         O Objective
E2   P        O2            E2 E3      O2         P Player
XXXXXXXX XXXXXXX         XXXXXXXX XXXXXXX         E Enemy
XXXXXXXX XXXXXXX         XXXXXXXX XXXXXXX         X Wall
XXXXXXXXE3XXXXXX         XXXXXXXX XXXXXXX         x Wall


In this situation, my bot is at the point of no return. It will choose to move
to and pick up objective one (O1), as it is the closest objective in sight, 
and in theory is still a safe path. However, in doing so, enemies will surround 
him and he will die. (Map on the right). 

I'm trying to come up with ideas on how to make my bot avoid that path, and go for a safer one. The bot should determine if completing the current path (to O1) is a good idea or not, in advance, and make a decision.

How would I go about this? I'm using a simple A* for path finding over a grid.

Source Link

Path finding: Avoid being surrounded by enemies

I'm building a bot that plays a simplified version of Pac-man. The bot does a pretty good job, but sometimes it chooses a path where it ends up surrounded by enemies. EX:

XXXXXXXXXXXXXXXX         XXXXXXXXXXXXXXXX
xxxxO1   E1              xxxxPE1   
XXXX XXXXXXXXXXX    ---> XXXX XXXXXXXXXXX   
E2   P        O2            E2 E3      O2
XXXXXXXX XXXXXXX         XXXXXXXX XXXXXXX
XXXXXXXX XXXXXXX         XXXXXXXX XXXXXXX
XXXXXXXXE3XXXXXX         XXXXXXXX XXXXXXX

Legend: O are objectives, P is the player, E1, E2 and E3 are enemies that are chasing the player, X and x are walls. (Map on the left)

In this situation, my bot is at the point of no return and it will choose to go and pick up O1, because is the closest objective in sight, and in theory is still a safe path, but doing so, enemies will surround him and die. (Map on the right).

I'm trying to come up with ideas on how to make my bot avoid that path and go for the safer one. The bot should determine in advance if completing the current path (to O1) is a good idea or not and make a decision.

BTW I'm using a simple A* for pathfinding over a grid. Any pointers, ideas or comments are very welcome.

Thanks in advance!