Jump to content
IGNORED

Maze A.I theory


Retro Lord

Recommended Posts

I would love too make a maze game someday in the spirit of Wizard of Wor. I have 1 theory on how the A.I could be done.

 

1. Have a counter for each of the corners/openings so the monsters can wander about. Like:

If player1x=80 && player1y=50 then a=(rand&1)

if a=0 then player1x=player1x+1

if a=1 then player1y=player1y+1

 

And have a bunch of those. The downside would be that it would be pretty bloated, especially if there is more then 1 maze...And it would be impossible to do with a maze generator which in my book would be the ultimate thing.

 

Any other theories out there on how to do maze A.I?

Link to comment
Share on other sites

I'd start with a basic finite state machine (FSM) that has 2 states, traveling and navigate. In the traveling state the AI agent would continue to move in the same direction until it aligns with the PF, at which time it would transition to the navigate state. In the navigate state I would map the A.I. agent's location to the PF pixel/block that it is currently aligned with and then look at the surrounding pixels (top, bottom, left, right) to determine which directions it can go without colliding with a wall. Once a new course is chosen it would transition back into the traveling state and start the process all over again.

 

The selection of available directions could be made at random or use an algorithm to chase/flee the player.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...