Maze game questions

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
back_slash
Posts: 19
Joined: 20 Aug 2021 08:07

Maze game questions

#1 Post by back_slash » 03 Dec 2022 13:22

Hello. I've got a maze game that I'm trying to make.
I want it to have collision, an array of 10 maze "rooms" that the file can procedurally generate, and a monster that moves by itself.
I've got the prodecurally generated part down (probably), and collision will take a long time but it's possible, but I can't think of a way to have a monster that will always go to
whatever coordinates my character is currently at. I'm using batbox and bg, but I can also use other external commands. Any ideas, system I can use to make the monster go? And any suggestions when I start coding the game?

Edit: I should probably specify what i'm looking for:
- A simple collision system (that can detect if one character just took the spot of another character and can run a command after that happens)
- A way to make a character that moves towards a different character at a specific time interval
Last edited by back_slash on 03 Dec 2022 15:40, edited 1 time in total.

T3RRY
Posts: 250
Joined: 06 May 2020 10:14

Re: Maze game questions

#2 Post by T3RRY » 06 Dec 2022 02:17

back_slash wrote:
03 Dec 2022 13:22
- A simple collision system (that can detect if one character just took the spot of another character and can run a command after that happens)
For this, the objects you are testing for collision need to have defined information for their Y and X coordinates and Width and height if greater than one cell.
one of the most efficient algorithms for performing collision detection is a bounding box algorithm that can be performed using a single Set /a operation.
- A way to make a character that moves towards a different character at a specific time interval
This task requires multiple things to be considered.
- What system of time interval will you use to implement game "ticks"?
- What event/s are you going to monitor / test for to enact changes in direction?
- What behaviour/s do you want the pursuer to enact while 'hunting' the players, and what conditions will you employ to drive said behaviour/s?

The most basic solution for a maze game is to consider the paths within the maze to be a track, define intersections in the paths as nodes, and conditionally execute direction changes for the pursuer only when its Y;X coordinates correspond with a defined node, with the new direction being based on the current position of the player relative to the node.

For each node have a predefined array of direction changes that can be indexed using the current Y;X coordinates of the player.
For any given Node, there will be a shortest path possible to reach any given cell occupied by the player. This will require significant legwork from you to determine for each of your maze maps, unless you determine a method that can perocedurally generate the array of shortest path per node/player position combo [such as a maze solving algorithm that uses the possible player coordinate as the exit position].


I suggest Doing a bit of research into the OG maze game - pacman.

Some suggested further reading:
Control cursor position and mode/s:
- https://learn.microsoft.com/en-us/windo ... -sequences

Collision detection:
- https://tutorialedge.net/gamedev/aabb-c ... -tutorial/

Batch imlementation of the above mentioned collision detection method:
- https://www.youtube.com/watch?v=ph3SYsXvz-M
- links to code in the description

Aacini
Expert
Posts: 1913
Joined: 06 Dec 2011 22:15
Location: México City, México
Contact:

Re: Maze game questions

#3 Post by Aacini » 06 Dec 2022 14:11

I invite you to review my Tetris game (the color version is here) and my VIBORAS.bat game (a multi-player version of Snake game).

Both programs makes an extensive use of "collision detection".

I hope it helps...

Antonio

back_slash
Posts: 19
Joined: 20 Aug 2021 08:07

Re: Maze game questions

#4 Post by back_slash » 07 Dec 2022 19:35

thanks I was able to make it :D

Post Reply