Jump to content
IGNORED

Enemies moving in maze?


yuppicide

Recommended Posts

Let's say I draw a maze in BB as a playfield.. we'll say it's 32 x 30 using Superchip.

 

How would I implement an enemy or two that moves around the maze similar to Maze Craze?

 

I am trying to think of a way to do this, but all I am coming up with is the following:

 

- Randomly pick a number from 1-4.

- If 1 then enemy moves up, if 2 moves right, if 3 down, if 4 moves left.

- Game checks to see if enemy has collided with the playfield. If yes then go back to randomly pick another number. If no then drawscreen showing enemy in

new position.

 

The problem with this is, the enemy will have some crazy movements.. and may sometimes just move back and fourth like an idiot.

 

I don't want it to specifically chase and hunt down the player.. I want it to be somewhat stupid, in which if it's chasing the player, the player can duck down a hall and the enemy may or may not follow him.

Edited by yuppicide
Link to comment
Share on other sites

Let's say I draw a maze in BB as a playfield.. we'll say it's 32 x 30 using Superchip.

 

How would I implement an enemy or two that moves around the maze similar to Maze Craze?

 

I am trying to think of a way to do this, but all I am coming up with is the following:

 

- Randomly pick a number from 1-4.

- If 1 then enemy moves up, if 2 moves right, if 3 down, if 4 moves left.

- Game checks to see if enemy has collided with the playfield. If yes then go back to randomly pick another number. If no then drawscreen showing enemy in

new position.

 

The problem with this is, the enemy will have some crazy movements.. and may sometimes just move back and fourth like an idiot.

 

I don't want it to specifically chase and hunt down the player.. I want it to be somewhat stupid, in which if it's chasing the player, the player can duck down a hall and the enemy may or may not follow him.

How about this idea:

 

(1) Pick an initial direction and let the enemy move that way until there's an intersection, cul-de-sac, or corner.

(2) If the enemy hits the end of a cul-de-sac, or a wall at the corner of a turn, randomly pick a new direction.

(3) If the enemy enters an intersection, randomly pick a new direction.

 

Similar to your original idea, except the enemy stays headed in the same direction until hitting the playfield or entering an intersection.

 

Michael

Link to comment
Share on other sites

I don't know if it will help, but here is a thing I was working on when batari Basic was older:

 

http://www.atariage.com/forums/index.php?s...t&p=1586075

 

The code has been edited so it will run using the latest version of bB.

Edited by Random Terrain
Link to comment
Share on other sites

Here's another thing you could do: set the maze intersections be the similar numbers up, down, left and right, and then keep track of the enemy's distance and once it reaches that point, have it either continue along its way or choose a new direction. It's kind of hard to explain what I mean, so I made a little program so you can see better.

maze.bas

maze.bas.bin

Link to comment
Share on other sites

IIRC, the "cops" in Maze Craze to not use any AI deduction. Each of them just always turn a specific direction when faced with an intersection. If that turn is invalid, 90 degrees from that is tried (and so on). In this manner, the entire maze is explored one turn at a time.

In theory. I always thought that you could traverse an entire maze that way, but then I ran into a maze in one of my NES games (sorry, I don't remember the name, but I think it might have been "Might & Magic"?) where always turning right did *not* take you all the way through the maze, and there was a message written on one of the walls that said "Remember, never do anything right," or something like that.

 

Michael

Link to comment
Share on other sites

In theory. I always thought that you could traverse an entire maze that way, but then I ran into a maze in one of my NES games ...

 

Yeah, the "ejection loop" is an old trick of maze makers. Check the simple pic I attached. The maze on the left is a "simply" connected maze. Always taking the right-hand path will get you to the goal and out again. But the maze on the right has a loop that will take you around and back to the start, but the path to the goal will be opposite your "always turn ***" rule.

 

Random Terrain's Ruins game makes randomized mazes, but it looks to me like they will most always have a loop round the outside and a few loops throughout the interior. Always turn *** would get the AI stuck fast.

 

Back to Yuppicide's problem, maybe you could give the AI a certain probability of choosing the correct path to catch the player, and otherwise it goes in a random direction? That could give you more options for selecting game difficulty, letting the player choose how smart the AI is.

post-6069-1221325550_thumb.jpg

Link to comment
Share on other sites

In theory.

 

In fact. That is how Maze Craze functions (which contains no looped paths).

Sorry, I meant in a general sense, not specifically in reference to Maze Craze. I don't know what the mazes in yuppicide's game are going to look like, so I was pointing out that "always turn right" (or "always turn left") might not let the enemies traverse the entire maze. I've been a long-time user (and still am) of the "always turn right" rule of thumb when exploring mazes in games, and it *usually* serves me quite well. :)

 

Michael

Link to comment
Share on other sites

What I am thinking (and have thought for many years) is a Maze Craze like game with multiple screens. The enemy/ies would be confined to one screen so they can't follow you to the next.

 

I would have say 10 or 15 screens. These are all pre-made up, not random. But the thing is the entrances and exits to each screen are all in the same location, so the screens can be put together in a random order.

Link to comment
Share on other sites

What I am thinking (and have thought for many years) is a Maze Craze like game with multiple screens. The enemy/ies would be confined to one screen so they can't follow you to the next.

 

I would have say 10 or 15 screens. These are all pre-made up, not random. But the thing is the entrances and exits to each screen are all in the same location, so the screens can be put together in a random order.

I made a random maze generator in bB a few years ago that could be modified to work with a Superchip playfield. I'll do an update of it, in case you're interested in checking it out.

 

Michael

Link to comment
Share on other sites

I would love to see the maze generator updated, sure.

 

I have three games I am working on separately and I was thinking maybe I could squeeze them onto a larger cart all together somehow.

 

I picked up a Superchip cartridge with 8K and I'm going to be testing them soon on real hardware. I need to pick up a rom programmer first.

 

I'm going to pick up the BX32 Batupo based on some recommendations here. My problem is money right now since I am moving soon. The programmer is $149.50 and I will need an eraser as well and those I see are $99. :(

Edited by yuppicide
Link to comment
Share on other sites

Since SeaGtGruff recently posted sprite to playfield conversion info, I decided to rip the guts out of Ruins, update it with the new conversion info, and stick it in the maze that atari2600land posted in this thread.

 

Below is a simplistic Pac-Man-ish demo where you can move around the maze. You can move faster by holding down the fire button. There is no collision detection in this demo and the bad guy is dumb (no AI added yet). The bad guy just wanders around the maze without paying any attention to you.

 

Here's the .bin file to use with your favorite emulator:

maze_2008y_09m_21d_0128t.bin

 

Here's the .bas file if you want to look at the code:

maze_2008y_09m_21d_0128t.bas

 

 

Since I spent time ripping out the guts of Ruins and updating the code, I'll probably make a complete game based on this demo (with different mazes and sprite data).

Link to comment
Share on other sites

  • 1 month later...

As I said above, I'm just going ahead and making a game based on the demo I posted here. Looks like it will be my first game instead of that scrolling game I was working on. What I thought would be my first game will end up being my second. Thought I would let you know that I discovered a couple of mistakes in the code posted above, but I fixed it in the game I'm working on. I hope it won't be too long before I can post the new code. I need to add sound effects and some 'AI' first.

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...