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
Maze game questions
Moderator: DosItHelp
-
- Posts: 19
- Joined: 20 Aug 2021 08:07
Maze game questions
Last edited by back_slash on 03 Dec 2022 15:40, edited 1 time in total.
Re: Maze game questions
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.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)
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.
This task requires multiple things to be considered.- A way to make a character that moves towards a different character at a specific time interval
- 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
Re: Maze game questions
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
Both programs makes an extensive use of "collision detection".
I hope it helps...
Antonio
-
- Posts: 19
- Joined: 20 Aug 2021 08:07
Re: Maze game questions
thanks I was able to make it