You have received a request from a client for an application for the playing of dungeon-style puzzles. You will follow an agile development process to design and implement a desktop Java application that satisfies the requirements of the client (see below). The final piece of software you deliver is expected to be of professional quality, user-friendly.
NOTE: For the first milestone, it is not necessary to set up the project in Eclipse.
Because this project uses JavaFX, it requires some additional setup steps in Eclipse. It's relatively straightforward if you're using a CSE computer, but if you're using your own computer you will need to download an alternate JDK.
- (Only necessary for non-CSE computers) Go here and download the Java 11 Zulu JDK FX for your OS. Unzip it once it finishes downloading.
- In Eclipse, import this project as normal. You should see an exclamation mark on the project indicating an error.
- Go to Window -> Preferences. On the left, under Java select Installed JREs then click Add. Ensure Standard VM is selected and click Next.
-
- (On CSE computers) Enter exactly
/home/cs2511/jdk-jfx
into JRE Home. The other fields should fill in automatically. - (On non-CSE computers) Click Directory and select the directory of the Zulu JDK you unzipped in step 1. Change JRE name to exactly
jdk-jfx
.
- (On CSE computers) Enter exactly
- Click Finish then Apply and Close
If these steps worked, the project should no longer have the exclamation mark on it and you should be able to run the starter code.
The client desires an application that lets the user move a player around a dungeon and try to overcome various challenges in order to "complete" the dungeon by reaching some goal. The simplest form of such a puzzle is a maze, where the player must find their way from the starting point to the exit.
More advanced puzzles may contain things like boulders that need to be pushed onto floor switches,
enemies that need to be fought with weapons, or collectables like potions and treasure.
To be specific, the layout of each dungeon is defined by a grid of squares, each of which may contain one or more entities. The different types of entities are as follows:
In addition to its layout, each dungeon also has a goal that defines what must be achieved by the player for the dungeon to be considered complete. Basic goals are:
- Getting to an exit.
- Destroying all enemies.
- Having a boulder on all floor switches.
- Collecting all treasure.
More complex goals can be built by logically composing basic goals. For example,
- Destroying all enemies AND getting to an exit
- Collecting all treasure OR having a boulder on all floor switches
- Getting to an exit AND (destroying all enemies OR collecting all treasure)
If getting to an exit is one of a conjunction of conditions, it must be done last. For example, if the condition is to destroy all enemies AND get to an exit, the player must destroy the enemies then get to the exit.
Your application will read from a JSON file containing a complete specification of the dungeon (the initial position of entities, goal, etc.). Example dungeons are included in the dungeons
directory and the starter code contains an incomplete dungeon loader.
The dungeon files have the following format:
{ "width": width in squares, "height": height in squares, "entities": list of entities, "goal-condition": goal condition }
Each entity in the list of entities is structured as:
{ "type": type, "x": x-position, "y": y-position }
where type is one of
["player", "wall", "exit", "treasure", "door", "key", "boulder", "switch", "portal", "enemy", "sword", "invincibility"]
The door
, key
, and portal
entities include an additional field id
containing a number. Keys open the door with the same id
(e.g. the key with id
0 opens the door with id
0). Portals will teleport entities to the one other portal with the same ID.
The goal condition is a JSON object representing the logical statement that defines the goal. Basic goals are:
{ "goal": goal }
where goal is one of
["exit", "enemies", "boulders", "treasure"]
In the case of a more complex goal, goal is the logical operator and the additional subgoals field is a JSON array containing subgoals, which themselves are goal conditions. For example,
{ "goal": "AND", "subgoals":
[ { "goal": "exit" },
{ "goal": "OR", "subgoals":
[ {"goal": "enemies" },
{"goal": "treasure" }
]
}
]
}
Note that the same basic goal can appear more than once in a statement.
You can extend this format to include additional information if you wish, but your application should still work with files in the original format.
The UI component of this project will be implemented in JavaFX. The starter code contains a very basic UI showing how a player can be moved around with the arrow keys, but it is missing many features (the player can walk through walls for one).
The client has given you free reign over the visual design of the program. Included in the starter code are some example assets, but you are free to use different ones. You can find them elsewhere or even create your own. The examples above came from here.