Onboarding Project: Breakout Game
If children can build, play and understand games that work, it's possible that someday they will understand and design systems that work. And the world is full of complicated systems. —Sara Corbett
Submitting Your Work
You will be provided a GIT repository, breakout_NETID
, hosted in the course's Gitlab group to work on this project (do not fork this repository, just clone it directly). All project submissions for this course will be based on only the version of your files in the provided Gitlab repository by 3:08am in the morning on the day after that given on the course Calendar (effectively a few extra hours grace time past midnight).
As your submission for this project, use GIT to add
, commit
, and push
the following
doc
folder: Markdown files representing your plans and design goals
src/main/java
folder: project code
src/main/resources
folder: images and block configuration files
- top-level (no separate folder): project README (the content of this file is closer to the real-world, so it is different from other CompSci classes)
Your code is expected to follow the course coding conventions and be reasonably commented (full Javadoc comments are encouraged but not required yet).
Specification
Individually, write a Java program using OpenJFX that allows someone to play a multi-level game of Breakout, in which a ball bounces around the window destroying blocks as it hits them, and successive levels represent a different variation of the basic game. Thus, you are expected to go beyond creating a basic version of the game (a common CompSci 101 level assignment).
Focus on the following functionality features:
- Allow the player to control a paddle to keep the ball from moving out of the window
- The ball bounces off blocks, possibly destroying them, releasing a power-up, or some other reaction, and accumulating a score
- The ball bounces off some of the window's sides, but if it moves off a specific side (typically the bottom), the player loses a life, and the ball resets to its starting position
- If the player misses blocking the ball three times, the game ends with a message announcing the player lost
- If all the blocks are cleared from the screen, the level should end and a new variation is loaded (i.e., with a different configuration of blocks and new forms of interactions)
There should be at least three different levels, with each one's configuration of blocks read from a data file
- If all the levels are completed, the game ends with a message announcing the player won
While the exact layout of the game is up to you, it should display at least the following different scenes:
- how many lives the player has remaining, how many blocks have been cleared (i.e., a score), and what level is currently being played
- a "splash screen" at the beginning (and possibly between each level) that explains the rules of the game and stays visible until the user clicks anywhere or presses a key to signal they are ready to start the game
- a "results screen" at the end that shows whether the player won or lost the game
Note, your game should not be so complex to require any buttons, menus, toolbars, or multiple "threads". Drawing and interacting with shapes, images, and text in fixed positions within the scene is completely sufficient for all the requirements. No level needs to be the greatest version created or even have sophisticated graphics — so everyone should be able to create a complete program by picking less complex variations if necessary.
Deliverables
You will submit this project in stages:
Project Goals
This project is intended to be a fun introduction to the procedures and goals for the course and to give us an understanding of your current coding and design level. Its grade will not impact your final grade in the course (unless you make no effort on it).
Specifically, it is intended as a warm-up to help you get used to the software, tools, and policies used throughout the semester
- code a project from scratch (and determine if the course is at the right level for your abilities)
- learn the basics of the OpenJFX framework (you will learn about more it in successive course projects)
- use the programming tools (IntelliJ and Git Version Control)
- follow the policies (submission requirements and the plan, code, reflect assignment cycle)
- try some basic Clean Code design practices to find areas to refactor your code rather than settling for the first draft just because it works
Design Specifications
You are not expected to follow the course's Code Design Habit Checklist yet, instead focus on the topics discussed in class
- Clean code: Use clean coding goals, like those followed by professional coders, to communicate your intentions, such as: standard code formatting, structuring your code in small, single-purpose, methods, and named constants
- Avoid code smells: Start to think about the design of your code, rather than just its functionality, by looking for common issues like: duplicated code, long methods, inappropriate intimacy (public instance variables and global variables)
- Use multiple classes: Divide your code into several classes that each have a useful purpose (i.e., non-get/set methods) to avoid these code smells: large class and data clumps
This is your opportunity (perhaps for the first time) to think beyond the functionality — about how you want to organize a program and how to make your code readable.
CompSci Context
This project highlights the following interesting and foundational Computer Science concepts. You are not expected to write a general or complete version of any of these concepts, but learning about them may help provide a context to begin thinking about some design issues or connect your work in this course to the broader computing community.
- Real-world connection: It is a very common requirement to learn a new coding package primarily on your own. While some basic OpenJFX code will be discussed in class, it is expected you will learn most of the details by reading online examples and documentation.
- The Game Loop, which is not a literal loop since OpenJFX is actually calling your code periodically to make changes before it draws items on the screen, is the heart of a game because it manages the entire game logic from responding to input, to updating the state of the game items, to enforcing the game's rules, to checking if the game's goals are met, to potentially much more. It is called a loop because it is responsible for managing the game actions repeatedly until the user quits. Each iteration, or frame, of the game loop is called on between 60 up to 120 times (frames per second, FPS). Game loops are typically organized around Update Methods to make it easier to add new elements — and, in very complex games, the game loop is factored out into a separate Game Engine so new games can be written by focusing just on the new code specific its characters, rules, and goals without modifying the Engine's game loop itself (there are many popular engines like Unity or Unreal (made in NC!)).
- Graphic processing units, GPUs, are specialized processors for performing math operations in parallel. Originally designed for computing the value of each pixel to render in a game by running all the operations at the same time instead of one after another, GPUs have proven very useful in reducing the training time for machine learning, ML, because they deal with complex operations efficiently, such as matrix manipulation. Currently, the demand is so great that there is a GPU shortage leading to price gouging.
- Games themselves are an increasingly important medium in terms of international use, cultural impact, profitability (it is a bigger industry than Hollywood), and now public Esport leagues and tournaments (with significant prizes). Arguably, gaming has also driven many recent advances in computer hardware and are finally gaining acceptance within the academic community as an area worthy of study. And why not? Games contain all of the basic elements taught in computer science and commercial game engines are becoming increasingly complex software systems.
Resources
Take time now to learn and practice with these tools which will be used throughout the semester
You are welcome to look at the tutorial below (or any other ones you find online to learn about OpenJFX), but it is more complex than required for this project. In any case, your game should be distinctly different from any examples you find (i.e., create your own Breakout game, do not simply copy one).