SWEN20003 Object Oriented Software Development Project 1, 2023
The University of MelbourneSchool of Computing and Information SystemsSWEN20003 Object Oriented Software Development
ShadowDanceProject 1, Semester 2, 2023Released: Friday, 25th August 2023 at 4:30pm AESTInitial Submission Due: Thursday, 31st August 2023 at 4:30pm AESTProject Due: Friday, 8th September 2023 at 4:30pm AESTPlease read the complete specification before starting on the project, because thereare important instructions through to the end!
1.Overview
Welcome to the first project for SWEN20003, Semester 2, 2023. Across Project 1 and 2, you willdesign and create a music arcade game in Java called ShadowDance (an adaptation of the original90’s arcade game Dance Dance Revolution). In this project, you will create the first level of thefull game that you will complete in Project 2B. This is an individual project. You may discussit with other students, but all of the implementation must be your own work. By submitting theproject you declare that you understand the University’s policy on academic integrity and awareof consequences of any infringement,including the use of artificial intelligence.You may use any platform and tools you wish to develop the game, but we recommend using IntelliJIDEA 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)Extensions & late submissions: If you need an extension for the project, please complete theExtension form in the Projects module on Canvas. Make sure you explain your situation withsome supporting documentation such as a medical certificate, academic adjustment plan, weddinginvitation, etc. You will receive an email saying if the extension was approved or if we need moreinformation.If you submit late (either with or without an extension), please complete the Late form in theProjects module on Canvas. 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.You must make at least 5 commits (excluding the Initial Submission commit) throughout the
development of the project, and they must have meaningful messages. This is also explained inmore detail at the end of the specification.1SWEN20003 Object Oriented Software Development Project 1, 2023
2.Game Overview
“The aim is simple : the player has to hit the corresponding musical notes that appear on screenn different lanes on time to score points. Can you beat the target score to win the game?”The game consists of three levels - Project 1 will only feature the first level. The notes willdescend from the top vertically in the 4 lanes. The player has to press the corresponding arrow keywhen the note overlaps with the stationary note symbol at the bottom. The accuracy of how closethe note was to the stationary note when the key was pressed, will determine the points given.There will be special hold notes thatrequire the player to hold down the key. To win, the playerneeds to beat the target score when all the notes have fallen. If theplayer’s score is lower, thegame ends.Figure 1: Completed Project 1 Screenshot2SWEN20003 Object Oriented Software Development Project1, 2023
3.The Game Engine
The Basic Academic Game Engine Library (Bagel) is a game engine that you will use to developyour game. You can find the documentation for Bagel here.CoordinatesEvery coordinate on the screen is described by an (x, y) pair. (0, 0) represents the top-left of thescreen, and coordinates increase towards the bottom-right. Each of thesecoordinates is called apixel. The Bagel Point class encapsulatesthis.FramesBagel will refresh the program’s logic at the same refresh rate as your monitor. Each time, thescreen will be cleared to a blank state and all of the graphics are drawn again. Each of these stepsis called a frame. Every time a frame is to be rendered, the update() method in ShadowDance iscalled. It is in this method that you are expected to update the state of the game.The refresh rate is now typically 120 times per second (Hz) but somedevices might have a lowerrate of 60Hz. In this case, when your game is running, it may look different to the demo videosas the constant values in this specification have been chosen for a refresh rate of 120Hz. For yourconvenience, when writing and testing your code, you may change these values to make your gameplayable (these changes are explained later). If you do change the values, remember to changethem back to the original specification values beforesubmitting, as your code will be marked on120Hz screens.
4.The Game Elements
Below is an outline of the different game elements you will need to implement.Window and BackgroundThe background (background.png) should be rendered on the screen and completely fill up yourwindow throughout the game. The default window size should be 1024 * 768 pixels. The background has already been implemented for you in the skeleton package.MessagesAll messages should be rendered with the font provided in the res folder (FSO8BITR.ttf), in size64 (unless otherwise specified). All messages should be roughly centered both horizontally andvertically (unless otherwisespecified).Hint: The drawString() method in the Font class uses the givencoordinates as the bottomleft of the message. So to center the message, you will need to calculate the coordinates using the Window.getWidth(), Window.getHeight() and Font.getWidth() methods,and also thefont size.3SWEN20003 Object Oriented Software Development Project 1, 2023
5. Game Start
When the game is run, a title message that reads SHADOW DANCE should be rendered in the fontprovided. The bottom left corner of this message should be located at (220, 250).Additionally, an instruction message consisting of 2 lines:PRESS SPACE TO STARTUSE ARROW KEYS TO PLAYshould be rendered below the title message, in the font provided, in size 24. The bottom left ofthe first line in the message should be calculated as follows: the x-coordinate should be increasedby 100 pixels and the y-coordinate by 190 pixels.There must be adequate spacing between the 2 lines to ensure readability (you can decide onthe value of this spacing yourself, as long as it’s not small enough that the text overlaps or too bigthat it doesn’t fit within the screen).To help when testing your game, you can allow the player to pause the game (i.e. everything in thewindow will stop moving) by pressing the Tab key (this is not assessed but will help you whencoding!)World FileThe lanes and the notes will be defined in a world file, describing the type and their positionor time of appearance in the window. The world file is located atres/level1.csv. (For 60Hzscreens, use the provided res/level1-60.csv file which has all the values halved). A world file isa comma-separated value (CSV) file with rows in one of the following formats:Lane, type of lane, coordinate(or)The type of lane refers to the arrow key which it corresponds to, for example: the first entry inthe above example is for the lane corresponding to the left arrow key. The type of note referso whether the note is normal or a hold note, and the frame number is the frame in which thenote starts appearing on screen. For example, the third entry in the above example refers to a leftarrow key note of the normal type that appears from the 398th frame onwards.You must actually load it—copying and pasting the data, for example, is not allowed. You havebeen provided with an extra world file to test on, located at res/test1.csv. Marking will be4SWEN20003 Object Oriented Software Development Project 1, 2023conducted on a hidden different CSV file of the same format. Note: For Project 1, you canassume that there will always be four lanes, and at least one note for each of the four directions.Win ConditionsThe player gains or loses points based on how close the note was to the stationary note when thecorrect arrow key is pressed (howthis is calculated is explained later). When all the notes in theCSV file have fallen, if the player’s score is higher than the target score of 150, this is consideredas a win. A winning message that reads CLEAR! should be rendered as described earlier in theMessages section.
6.Lose Conditions
The game will continue running until all the notes have fallen. After this, the game will end if theplayer’s score is less than the target score of 150. A message of TRY AGAIN should be rendered asdescribed earlier in the Messages section. If the player terminates the game window at any point(by pressing the Escape key or by clicking the Exit button), the window will simply close and nomessage will be shown.Game EntitiesThe following game entities have an associated image (or multiple!) and a starting location (x,y). Remember that all images are drawn from the centre of the image using thesecoordinates.
LaneIn this game, there are four lanes for the four arrow keys (left, right, up and down) representedby the images shown on the next page. The (x, y) coordinate of the centre of each image is asfollows : the x-coordinate is given in the CSV file and the y-coordinate is 384. The position of thelane stays constant throughout the game.SWEN20003 Object Oriented Software Development Project 1, 2023
(a) laneLeft.png (b) laneRight.png (c) laneUp.png (d) laneDown.pngFigure 2: The lane images (note that the size has been reduced to fit on the page)A lane can have a maximum of 100 notes and 20 hold notes. Each lane has a stationary notesymbol at the bottom which is the target. The player needs to press the corresponding arrow keywhen the falling note overlaps with the stationary note to score points. The y-coordinate of thecentre of the four stationary notes is 657.Note(a) noteLeft.png (b) noteRight.png (c) noteUp.png (d) noteDown.pngFigure 3: The note images
There are four types of notes for the four arrow keys represented by the above images. Each notewill descend vertically from the top of the screen in the corresponding lane, for example: a leftnote should descend in the left lane and an up note should descend in the up lane. The starting(x, y) coordinate of the centre of each note image is as follows : the x-coordinate is the same asthe x-coordinate of the lane it corresponds to and the y-coordinate is 100.Each note moves downwards at a speed of 2 pixels per frame (for 60Hz screens, increase thisvalue to 4). The frame number from which the note starts being drawn on screen is given inthe CSV file. The note will continue to be drawn until either it either leaves the window from6SWEN20003 Object Oriented Software Development Project 1, 2023the bottom of the screen or the player presses the corresponding key for the note (anda score iscalculated as described below).Note ScoringThe score for each key press is calculated based on the accuracy of how close the given note wasto the stationary note symbol in the lane when the key was pressed. When the key is pressed, theabsolute distance in pixels between the y-coordinate of the centre of the falling note and the
y-coordinate of the centre of the stationary note is calculated. The method to determine the scorefrom this distance is shown below.
• If distance <= 15, this is a PERFECT score and receives 10 points
• If 15 < distance <= 50, this is a GOOD score and receives 5 points
• If 50 < distance <= 100, this is a BAD score and receives -1 points
• If 100 < distance <= 200, this is a MISS and receives -5 points.
If the note leaves the window from the bottom of the screen without the corresponding key beingpressed, this is considered as a MISS too and receives -5 points.When a score is calculated, the corresponding score message (shown in the list above) must berendered on screen as described in the Messages section. The font size must be set to 40 and themessage must be rendered for 30 frames. For example, when thescore is perfect, the text renderedmust be PERFECT.
WX:codehelp
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。