Skip to content

A 3D Maze game in which you walk around a maze and can only see what's in front of you. There are portals and traps along the way to throw you off as well. You may either use the keyboard to control the character or the website from any other device on the network. Lastly, you can also just click a key to allow a reinforcement learning algorithm…

Notifications You must be signed in to change notification settings

rishavb123/3DMazeGame

Repository files navigation

3D Maze Game

Installation

git clone https://github.com/rishavb123/3DMazeGame.git

Setup

The AI requires python 3, which can be downloaded at https://www.python.org/downloads/. Make sure to check the box to add python (and PIP) to your PATH.

Then run

pip install requests
pip install numpy

in command prompt to install the dependencies.

Also, the server uses an ssh reverse proxy to forward the server port to a url, so ssh must be enabled to use the forwarding capabilities. To check if ssh is enabled run

ssh

If it says "'ssh' is not recognized as an internal or external command, operable program or batch file.", then ssh is not enabled yet. On Macs, Linux, and most Windows devices, it should be auto-enabled, but on some older windows machines you have to manually enable. To do so follow this link: https://www.howtogeek.com/336775/how-to-enable-and-use-windows-10s-built-in-ssh-commands/.

Scripts

Run Script

run

This runs a batch script which will run the java application (Application.java) and will forward port localhost:8000 to port maze.serveo.net:80 for general use of the http server. If maze.serveo.net:80 does not work, it is likely that serveo is temporarily down and will be fixed in a couple of days. As I am writing this it is currently disabled due to phishing. The controller can still be accessed at |your-ip|:8000/controller.

Two windows will open; one is to forward the server, while the other is the game. These two windows and the original window need to be open for all of the programs functionality to work.

Parameters

The first parameter will specify which maze to use.

run one

will run the program using the maze stored in mazes/one.txt. If this parameter is left blank, the program will default to mazes/seven.txt.

A second parameter is whether or not to forward the server to serveo.net.

run one X

will run the program on mazes/one.txt and will not forward the server to serveo.net. So only one window will open and you will not be able to control the player from maze.serveo.net/controller. The server is still accessible on localhost and the computers ip address.

Clean Script

This will just delete all the class files.

Controls

Keys

  1. Pressing and holding the UP key will move you forwards.
  2. The LEFT and RIGHT keys will turn you left and right respectively.
  3. The DOWN key will move you backwards.
  4. The R key will reset you to your original location.
  5. The SPACE key will toggle between the two dimensional view and the three dimensional view.
  6. The C key will toggle the compass in the two dimension view.
  7. The P key will launch a python script that uses a reinforcement learning algorithm to control the explorer using the server. It will find the optimal path (maximizing your health) to the end adapting to portals and traps.

Maze Controller

If you are forwarding the server to serveo.net then you will be able to control the explorer from the url maze.serveo.net/controller. The UP, DOWN, LEFT, and RIGHT buttons do that same thing as the keys.

If you are not forwarding the server, this site can still be accessed at locahost:8000/controller locally or |your-ip|:8000/controller on the network.

Game Mechanics

You will start with an initial health equal to the area of the maze. Every step makes you lose 1 health. If you hit a trap (Trap.java) you will lose 10% of your maximum health. When the explorer reach 0 or less health, the explorer will "die," and you will have to restart.

Three Dimensional View

  1. A red ceiling indicates that there is a trap in that location.
  2. A purple floor indicates that there is a portal in that location.
  3. A green wall means that you are at the end. Just run into the green wall to win.

Two Dimensional View

  1. Red squares indicate traps.
  2. Blue and green squares indicate portals. To find the corresponding portal, look for a portal with the same shade.
  3. The white square is the goal state or the winning location.

Maze Design

  1. S is the starting location
  2. + is the end location
  3. # are walls
  4. _ is a space
  5. ~ is a trap
  6. Any numbers are portals. 1 teleports to 1, 2 teleports to 2, . . .

About

A 3D Maze game in which you walk around a maze and can only see what's in front of you. There are portals and traps along the way to throw you off as well. You may either use the keyboard to control the character or the website from any other device on the network. Lastly, you can also just click a key to allow a reinforcement learning algorithm…

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published