SWEN20003 Object Oriented Software Development
Project 1, Semester 2, 2022
Released: Friday, 26/08/2022 at 8:59pm AEST
Initial Submission Due: Thursday, 01/09/2022 at 8:59pm AEST Project Due: Friday, 09/09/2022 at 8:59pm AEST
Welcome to the first project for SWEN20003, Semester 2, 2022. Across Project 1 and 2, you will design and create a fantasy role-playing game in Java called ShadowDimension (inspired by Stranger Things). In this project, you will create the first level of the full game that you will complete in Project 2B. This is an individual project. You may discuss it with other students, but all of the implementation must be your own work. By submitting the project you declare that you understand the University’s policy on academic integrity and aware of consequences of any infringement.
You may use any platform and tools you wish to develop the game, but we recommend using IntelliJ IDEA for Java development as this is what we will support in class.
The purpose of this project is to:
• Give you experience working with an object-oriented programming language (Java),
• Introduce simple game programming concepts (2D graphics, input, simple calculations) • Give you experience working with a simple external library (Bagel)
Note: If you need an extension for the project, please complete this form. Make sure you explain your situation with some supporting documentation such as a medical certificate, academic adjust- ment plan, wedding invitation, etc. You will receive an email saying if the extension was approved or if we need more information.
If you submit late (either with or without an extension), please complete this form. For both forms, you need to be logged in using your university account. Please do not email any of the teaching team regarding extensions or late submissions. All of this is explained again in more detail at the end of this specification.
“A dark evil has arrived in your hometown. A group of government scientists have opened a gate in their laboratory to another dimension called the Over Under. The Over Under is ruled by Navec (an evil creature of immense power) and his henchmen are called demons. The scientists thought they could control these creatures but alas they failed and are being held captive in the Over Under. Navec has created sinkholes that will destroy the lab and is planning on eventually destroying your world.
The player’s name is Fae, the daughter of one of the scientists. In order to save your father and your town, you need to avoid the sinkholes, find the gate in the lab and defeat Navec & his demons in the Over Under...”
Project 1 will only feature the first level - finding the gate in the lab. The player will be able to control Fae who has to move around the walls and avoid any sinkholes that are in the lab. If the player falls into a sinkhole, the player will lose health points. To win, the player has to get to the gate, located in the bottom right of the window. If the player’s health reduces to 0, the game ends.
The Game Engine
The Basic Academic Game Engine Library (Bagel) is a game engine that you will use to develop your game. You can find the documentation for Bagel here.
Every coordinate on the screen is described by an (x,y) pair. (0,0) represents the top-left of the screen, and coordinates increase towards the bottom-right. Each of these coordinates is called a pixel. The Bagel Point class encapsulates this.
Bagel will refresh the program’s logic at the same refresh rate as your monitor. Each time, the screen will be cleared to a blank state and all of the graphics are drawn again. Each of these steps is called a frame. Every time a frame is to be rendered, the update() method in ShadowDimension is called. It is in this method that you are expected to update the state of the game.
The refresh rate is typically 60 times per second (Hz) but newer devices might have a higher rate. In this case, when your game is running, it may look different to the demo videos as the constant values in this specification have been chosen for a refresh rate of 60Hz. For your convenience, when writing and testing your code, you may either change these values to make your game playable or lower your monitor’s refresh rate to 60Hz. If you do change the values, remember to change them back to the original specification values before submitting, as your code will be marked on 60Hz screens.
It is sometimes useful to be able to tell when two images are overlapping. This is called collision detection and can get quite complex. For this game, you can assume images are rectangles and that the player falling into a sinkhole or overlapping with a wall is a collision. Bagel contains the Rectangle class to help you.
The Game Elements
Below is an outline of the different game elements you will need to implement.
Window and Background
The background (background0.png) should be rendered on the screen and completely fill up your window throughout the game. The default window size should be 1024 * 768 pixels. The back- ground has already been implemented for you in the skeleton package.
All messages should be rendered with the font provided in res folder, in size 75 (unless otherwise specified). All messages should be centered both horizontally and vertically (unless otherwise specified).
When the game is run, a title message that reads SHADOW DIMENSION should be rendered in the font provided. The bottom left corner of this message should be located at (260, 250).
Additionally, an instruction message consisting of 2 lines:
PRESS SPACE TO START
USE ARROW KEYS TO FIND GATE
should be rendered below the title message, in the font provided, in size 40. The bottom left of the first line in the message should be calculated as follows: the x-coordinate should be 90 pixels below and the y-coordinate 190 pixels below.
There must be adequate spacing between the 2 lines to ensure readability (you can decide on the value of this spacing yourself, as long as it’s not small enough that the text overlaps or too big that it doesn’t fit within the screen). Nothing else, not even the background, should be rendered in the window before the game has begun.
The player, the walls and the sinkholes will be defined in a world file, describing the type and their position in the window. The world file is located at res/level0.csv. A world file is a comma-separated value (CSV) file with rows in the following format:
Type, x-coordinate, y-coordinate
An example of a world file:
You must actually load it—copying and pasting the data, for example, is not allowed. Note: You can assume that the player is always the first entry in the file and that this world file has a maximum of 60 entries.
faeRight.png should be rendered. Initally, the player will start by facing right. Health Bar
The player’s current health points value is displayed as a percentage of the maximum health points on screen. This can be calculated as is 15 and their maximum is 20, the percentage is 75%. This percentage is rendered in the top left corner of the screen in the format of k% where k is rounded to the nearest integer. The bottom left corner of this message
should be located at (20, 25) and the font size should be 30. Initally,
the colour of this message should be green (0, 0.8, 0.2). When the percentage is below 65%, the colour should be orange (0.9, 0.6, 0) and when it is below 35%, the colour should be red (1, 0, 0).
A sinkhole is a stationary object, shown by sinkhole.png. A sinkhole has damage points, which determines how much damage it inflicts on the player when they collide. A sinkhole has 30 damage points. The sinkhole should prevent the player from moving through it. If the player falls into (i.e. collides) with a sinkhole, it will inflict damage on the player (according to its damage points value). After collision, the sinkhole will disappear from the screen and the player should be able to move through the area it was placed at before.
You must submit a class called ShadowDimension that contains a main method that runs the game as prescribed above. You may choose to create as many additional classes as you see fit, keeping in mind the principles of object oriented design discussed so far in the subject. You will be assessed based on your code running correctly, as well as the effective use of Java concepts. As always in software engineering, appropriate comments and variables/method/class names are important.
readCSV() method and an update() method that draws the background. • pom.xml: File required to set up Maven dependencies.
Submission and Marking Initial Submission
To ensure you start the project with a correct set-up of your local and remote repository, you must complete this Initial Submission procedure on or before Thursday, 01/09/2022 at 08:59pm.
1. Clone the [user-name]-project-1 folder from GitLab.
2. Download the project-1-skeleton.zip package from LMS, under Project 1. 3. Unzip it.
- Move the contents of the unzipped folder to the [user-name]-project-1 folder in your
- Add, commit and push this change to your remote repository with the commit message
- Check that your push to Gitlab was successful and to the correct place.
After completing this, you can start implementing the project by adding code to meet the require- ments of this specification. Please remember to add, commit and push your code regularly with meaningful commit messages as you progress.
You must complete the Initial Submission following the above instructions by the due date. Not doing this will incur a penalty of 3 marks for the project. It is best to do the Initial Submis- sion before starting your project, so you can make regular commits and push to Gitlab since the very start. However, if you start working on your project locally before completing Initial Sub- mission, that is fine too, just make sure you move all of the contents from your project folder to [user-name]-project-1 in your local machine.