SveterCZE / maze-game

Simple world generation and exploration engine. My attempt to solve the final project of CS61B, Berkeley's data structures class.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Introduction

My first large project built in Java, a 2D tile-based world generation and exploration game. It is based on the final project of CS61B, Berkeley's data structures class (see https://sp19.datastructur.es/materials/proj/proj3/proj3).

The rendering engine, some starter code as well as the random numbers generator were provided by Berkeley team (see the starte code at: https://github.com/Berkeley-CS61B/skeleton-sp19/tree/master/proj3/byow). However, I wrote all the code for world generation and the interaction between the player and the environment.

Installation

  • Clone the whole repository.
  • Compile the game using javac byow/Core/Main.java. On Windows, you might need to use javac -encoding UTF-8 byow/Core/Main.java.
  • Run the game using java byow.Core.Main
  • Enjoy the game :)

Features

Once the program is launched, a menu window will be displayed.

The following options are available:

  • Press 'N' or 'n' to start a new game.
  • Press 'L' or 'l' to load a saved game.
  • Press 'Q' or 'q' to quit the game.

After selecting a new game, another window will be displayed, asking the user to enter a seed. The seed is a positive number up to 9,223,372,036,854,775,807 and is used by the random generator to generate a unique game world. That means that if you enter the same seed, the identical world be generated.

Once the seed is entered, press 'S' or 's' to generate the world. Only the player avatar (@) and its surroundings are visible, while the rest of the map is covered by a fog of war. Also, a status bar is diplayed on the top of the window, displaying the level number, identification of tile over which a mouse cursor is hovering, player's health and its inventory. image

The world looks something like this - it consists of uniquely generated rooms and corridors connecting them together. Various items are randomly generated around the map. image

Game items

The following items can be found in the world:
Game item Symbol Description
Avatar @ Player's avatar. Press 'W', 'A', 'S', 'D' to move it around the world. If the player's health drops to 0, it dies.
Ghost ghost Ghost. Uses a pathfinding algorithm to chase the player around the map. If the ghost catches the player, the player dies unless it equipped a magic potion, in which case the ghost dies.
Anti-ghost potion A magic potion. If equipped by the player, it will survive an encounter with the ghost.
World map map A map that removes fog of war and displays the whole map.
Marker If equipped by the player, it marks the tiles that have been visited by it to aid in the navigation around the world. Very helpful if the player does not have a map.
Poison Poisons the player, causing it to lose 35 health points.
Radioactivity Exposes the player to radioactivity. It loses 25 health points immediately and 1 additional point per turn.
First aid kit + Restores 30 health points if the player was not exposed to radioactivity. If it was exposed, the first aid kit removes the effects of radioactivity, but does not restore any health points.
Key When equipped, opens the door to allow the player to enter the next level.
Locked door Door to the next level. A key must be equipped to open the door.
Open door Door to the next level. Once reached by the player, a new level will start.

Game objectives

In each level, the player must: * Find the key. * Enter the door to the next level. * Avoid being killed by the ghost, poisons or radioactivity.

There are 9,223,372,036,854,775,807 unique levels available, so each player should have some fun for a while.

Game controls

  • 'W', 'A', 'S', 'D' – Movement of player around the world
  • 'Q' – Quit the game. The game is saved and can be loaded from the main menu.

Known issues

  • Map might not be displayed properly on some combinations of screen resolutions and DPI.
  • A minor bug appears when the ghost navigates through rooms of certain shape.
  • Unicode symbols of some game items might not display properly on some systems.

TODO

  • Improve the fog of war, so that it shows only the room in which the player is located.
  • Introduce additional game items and mechanics.
  • Replace Unicode symbols for game items with icons.

Testimonials

"Much better game than Grand Theft Auto: The Trilogy – The Definitive Edition" – every game journalist

About

Simple world generation and exploration engine. My attempt to solve the final project of CS61B, Berkeley's data structures class.


Languages

Language:Java 100.0%