代做SWEN20003、代写Python/Java编程

2023-09-06 代做SWEN20003、代写Python/Java编程
SWEN20003 Object Oriented Software Development Project 1, 2023The University of MelbourneSchool of Computing and Information SystemsSWEN20003 Object Oriented Software DevelopmentShadowDanceProject 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!OverviewWelcome 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 universityaccount. 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 thedevelopment 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, 2023Game Overview“The aim is simple : the player has to hit the corresponding musical notes that appear on screenin 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 that require the player to hold down the key. To win, the playerneeds to beat the target score when all the notes have fallen. If the player’s score is lower, thegame ends.Figure 1: Completed Project 1 Screenshot2SWEN20003 Object Oriented Software Development Project 1, 2023The Game EngineThe 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 these coordinates is called apixel. The Bagel Point class encapsulates this.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 some devices 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 before submitting, as your code will be marked on120Hz screens.The Game ElementsBelow 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 otherwise specified).Hint: The drawString() method in the Font class uses the given coordinates 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, 2023Game StartWhen 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 at res/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, x-coordinate(or)Type of lane, type of note, frame-numberAn example of a world file:Lane,Left,282Lane,Right,742Left,Normal,398Down,Hold,1262The 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 refersto 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 (how this 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.Lose ConditionsThe 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 these coordinates.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.5SWEN20003 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 imagesThere 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 (and a 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 they-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 the score is perfect, the text renderedmust be PERFECT.Figure 4: ScoreThe player’s current total score must also be rendered on screen. Thescore is rendered in the top left corner of the screen in the format of"SCORE k" where k is the current score. The bottom left corner of thismessage should be located at (35, 35) and the font size should be 30.Hold NoteA hold note is a special type of note, where the player has to hold down the corresponding arrowkey for the duration in which the falling hold note overlaps with the stationary note in the lane.Once again, there are four types of hold notes for the four arrow keys shown in the figure below.The starting (x, y) coordinate of the centre of each image is as follows : the x-coordinate is thesame as the x-coordinate of the lane it corresponds to and the y-coordinate is 24. The speed isthe same as for a normal note and the frame number is also given in the CSV file.7SWEN20003 Object Oriented Software Development Project 1, 2023(a) holdNoteLeft.png(b) holdNoteRight.png (c) holdNoteUp.png(d) holdNoteDown.pngFigure 5: The hold note imagesHold Note ScoringFor hold notes, the scoring is calculated in a similar manner but the difference is that two scoresare calculated - first when the hold is started and the second when the hold is released. Hint:To check if a hold has been released, you will find the wasReleased() method in the Input classhelpful.When the hold starts, the y-coordinate at the bottom of the image of the holding note needs to beused to calculate the distance (instead of the centre of the image like in a normal note). Likewisewhen the hold is released, the y-coordinate at the top of the image needs to be used. Hint: Tocalculate the y-coordinate at the bottom of the hold note image, add 82 to the centre y-coordinate,and for the y-coordinate at the top of the image, subtract 82.The method of determining the score from the distance is the same as given in the Note Scoringsection (bottom of page 6). If the hold note leaves the window from the bottom of the screenwithout the hold starting, this is considered as a MISS and receives -5 points. If the hold wasreleased at a distance greater than 200 pixels, this is a MISS too.Similar to normal notes, the score messages should also be rendered on screen and the scores fromhold notes, need to be added to the total score too.SoundNote that this section is optional and you will not be assessed on this.This game wouldn’t be a correct representation of Dance Dance Revolution without any music8SWEN20003 Object Oriented Software Development Project 1, 2023right? You will be given a separate file called musicDemo.zip which contains a demo using thejavax package, on how to add sound to your project. The code has a class called Track whichencapsulates all the logic related to creating, playing and pausing a sound. If you want to addsound, use this class in your project. The code currently uses a demo sound track - you may addany sound you want as long as the track is a .wav file. You can add more than one sound, bycreating multiple Track objects and passing the file paths for the sounds in the constructor. (Notethat if you add several sounds, it may cause gameplay delays on computers with low resources).We hope you have fun with this!Your CodeYou must submit a class called ShadowDance that contains a main method that runs the game asprescribed above. You may choose to create as many additional classes as you see fit, keeping inmind the principles of object oriented design discussed so far in the subject. You will be assessedbased on your code running correctly, as well as the effective use of Java concepts. As always insoftware engineering, appropriate comments and variables/method/class names are important.Implementation ChecklistTo get you started, here is a checklist of the game features, with a suggested order for implementingthem:• Draw the title and game instruction messages on screen• Draw the lanes on screen• Read the world file, and draw the notes on screen• Implement movement logic for the notes• Implement the scoring behaviour when a key is pressed for a note• Draw the corresponding scoring messages• Implement the same behaviour as above for the hold notes• Implement win detection and draw winning message on screen• Implement lose detection and draw losing message on screenSupplied PackageYou will be given a package called project-1-skeleton.zip that contains the following: (1)Skeleton code for the ShadowDance class to help you get started, stored in the src folder. (2) Allgraphics and fonts that you need to build the game, stored in the res folder. (3). The pom.xmlfile required for Maven. Here is a more detailed description:9SWEN20003 Object Oriented Software Development Project 1, 2023• res/ – The graphics and font for the game (You are not allowed to modify any of the files inthis folder).– background.png: The image to represent the background.– laneLeft.png: The image to represent a lane for the left arrow key.– laneRight.png: The image to represent a lane for the right arrow key.– laneUp.png: The image to represent a lane for the up arrow key.– laneDown.png: The image to represent a lane for the down arrow key.– noteLeft.png: The image to represent a note for the left arrow key.– noteRight.png: The image to represent a note for the right arrow key.– noteUp.png: The image to represent a note for the up arrow key.– noteDown.png: The image to represent a note for the down arrow key.– holdNoteLeft.png: The image to represent a hold note for the left arrow key.– holdNoteRight.png: The image to represent a hold note for the right arrow key.– holdNoteUp.png: The image to represent a hold note for the up arrow key.– holdNoteDown.png: The image to represent a hold note for the down arrow key.– FSO8BITR.ttf: The font to be used throughout this game.– level1.csv: The world file for the first level.– level1-60.csv: Same file as above but for 60Hz screens.– test1.csv: A test file for you to try.– test1-60.csv: Same file as above but for 60Hz screens.– track1.wav: Sample music track which is the same as the file in musicDemo.zip (youcan ignore this file if you’re not adding music).– resources.txt: The file containing credit for the font and music (you can ignore thisfile).• src/ – The skeleton code for the game.– ShadowDance.java: The skeleton code that contains entry point to the Game, a readCSV()method and an update() method that draws the background.• pom.xml: File required to set up Maven dependencies.10SWEN20003 Object Oriented Software Development Project 1, 2023Submission and MarkingInitial SubmissionTo ensure you start the project with a correct set-up of your local and remote repository, youmust complete this Initial Submission procedure on or before Thursday, 31st August 2023 at4:30pm.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.4. Move the contents of the unzipped folder to the [user-name]-project-1 folder in yourlocal machine.5. Add, commit and push this change to your remote repository with the commit message"initial submission".6. 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 requirements of this specification. Please remember to add, commit and push your code regularly withmeaningful commit messages as you progress.You must complete the Initial Submission following the above instructions by the due date. Notdoing this will incur a penalty of 3 marks for the project. It is best to do the Initial Submission before starting your project, so you can make regular commits and push to Gitlab since thevery start. However, if you start working on your project locally before completing Initial Submission, 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.Technical requirements• The program must be written in the Java programming language.• Comments and class names must be in English only.• The program must not depend upon any libraries other than the Java standard library andthe Bagel library (as well as Bagel’s dependencies).• The program must compile fully without errors.Submission will take place through GitLab. You are to submit to your <username>-project-1repository. At the bare minimum you are expected to follow the structure below. You can createmore files/directories in your repository if you want.11SWEN20003 Object Oriented Software Development Project 1, 2023username -project-1resresources used for project 1srcShadowDance.javaother Java filesOn 8th September 2023 at 4:30pm, your latest commit will automatically be harvested from GitLab.CommitsYou are free to push to your repository post-deadline, but only the latest commit on or before 8thSeptember 2023 4:30pm will be marked. You must make at least 5 commits (excluding the InitialSubmission commit) throughout the development of the project, and they must have meaningfulmessages (commit messages must match the code in the commit). If commits are anomalous (e.g.commit message does not match the code, commits with a large amount of code within two commitswhich are not far apart in time) you risk penalization.Examples of good, meaningful commit messages:• implemented movement logic• fix the note’s scoring behaviour• refactored code for cleaner designExamples of bad, unhelpful commit messages:• fesjakhbdjl• yeah easy finished the logic• fixed thingzZZZGood Coding StyleGood coding style is a contentious issue; however, we will be marking your code based on thefollowing criteria:• You should not go back and comment your code after the fact. You should try to commentas you go. (Yes, we can tell).• You should be taking care to ensure proper use of visibility modifiers. Unless you have a verygood reason for it, all instance variables should be private (apart from constants).• Any constant should be defined as a final static variable (Note: for Image and Font objects,use only final). Constants can be public depending on usage. Don’t use magic numbers!• Think about whether your code is written to be easily extensible via appropriate use of classes.12SWEN20003 Object Oriented Software Development Project 1, 2023• Make sure each class makes sense as a cohesive whole. A class should have a single well-definedpurpose, and should contain all the data it needs to fulfil this purpose.Extensions and late submissionsIf you need an extension for the project, please complete the Extension form in the Projectsmodule on Canvas. Make sure you explain your situation with some supporting documentationsuch as a medical certificate, academic adjustment plan, wedding invitation, etc. You will receivean email saying if the extension was approved or if we need more information.The project is due at 4:30pm sharp. Any submissions received past this time (from 4:30pmonwards) will be considered late unless an extension has been granted. There will be no exceptions.There is a penalty of 1 mark for a late project, plus an additional 1 mark per 24 hours. If yousubmit late (either with or without an extension), please complete the Late form in the Projectsmodule 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.MarksProject 1 is worth 10 marks out of the total 100 for the subject. Although you may see howinheritance can be used for future extensibility, you are not required to use inheritance in thisproject.• NOTE: Not completing the Initial Submission (described in the Submission and Markingsection here) before beginning your project will result in a 3 mark penalty!• Features implemented correctly – 6 marks– Starting screen is implemented correctly: (0.5 marks)– The lanes’ images are implemented correctly: (0.5 marks)– The notes’ images and movement (including hold notes) are implemented correctly: (1.5marks)– The scoring of notes (including hold notes) is implemented correctly: (1.5 marks)– Player’s total score is implemented correctly: (1 mark)– Win detection is implemented correctly with winning message rendered: (0.5 marks)– Loss detection is implemented correctly with game-over message: (0.5 marks)• Code (coding style, documentation, good object-oriented principles) – 4 marks– Delegation and Cohesion – breaking the code down into appropriate classes, each beinga complete unit that contain all their data: (1.5 marks)– Use of Methods – avoiding repeated code and overly long/complex methods: (1 mark)– Code Style – visibility modifiers, consistent indentation, lack of magic numbers, commenting, etc. : (1.5 marks)13