| CompSci 308 Spring 2021 |
Advanced Software Design and Implementation |
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
Back in the 1980s, video arcade games were in their prime. Local restaurants, pubs, and arcades lured customers with all of the latest titles: Pac-man, Galaxian, Donkey Kong, Tempest, Centipede, Defender, and more. (Un)fortunately, the rise of home video game systems and home computers relegated these gems to the back storage rooms of many establishments (although tiny and big versions seem to be making a comeback). They are not forgotten, however — even today, arcade cabinets are collected by enthusiasts and arcade ROM emulation systems such as MAME allow a new generation to experience these relics first-hand on modern hardware (including, briefly, the iPad).
Breakout, designed by Steve Jobs and Steve Wozniak (the founders of Apple, Inc.), is a popular extension to the first cabinet arcade game, Pong. It was such a big hit that, to this day, it is still spawning additional game spin-offs in the form of the game Arkanoid and, like many other games, it has been conquered by AI! These games build on the basic premise of Breakout, clearing a field of bricks, but add elements of every other game imaginable. Here is a (long) video of the original Arkanoid game play and here is an entire YouTube channel devoted to it.
The basic version of this game have been used as a programming assignment in CompSci 101 and more generally as an assignment that is highly regarded by educators as "nifty" because it is a fun way to use 2D collections, but part of its continuing appeal is how easily the game supports complex variants, such as:
Study these for their ideas, not their appearance or level of sophistication.
Individually, write a Java program, using OpenJFX, to play variations of the 2D game of Breakout, in which a ball bounces around the screen and destroys blocks as it bounces into them. The player controls a paddle to keep the ball from moving off the screen. The ball may bounce off of some sides of the screen; however, if the ball moves off a specific area of the screen (typically the bottom), the player loses a life and the ball is reset to its starting position. If the player misses the ball too many times, the game should end and display a message that the player lost. If all the blocks are cleared from the screen, the level should end and a new one loaded with a different configuration of blocks. If the player clears all the levels, the game ends with a message declaring the player won.
You are welcome to look at the tutorial in the Resources below or any other ones you find online to learn about OpenJFX, but your game should be distinctly different from any given examples you find (i.e., create your own Breakout game, do not simply copy one). Your game does not need to be the greatest version created, or even have sophisticated graphics, but it must include multiple levels, each of which is a different variation with different "kinds" of blocks, power ups, and game features — so everyone should be able to create a complete program by picking less complex variations if necessary.
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 heart of a game is its conceptual 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, 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!)).
You are not expected to write an actual Game Engine for this project, but it does provide a context to begin thinking about issues of design and coding style:
This project is intended as a warm-up to introduce you to