The goal of this assignment is to produce a two-person, networked version of the Atari game Breakout using the C programming language using the ncurses library.
The goal of this assignment is to produce a two-person, networked version of the Atari game Breakout using the C programming language using the ncurses library.
A detailed grading rubric will be provided.
IP address:port number format will be used to describe the network parameters on the command line. The program mode (host mode or client mode) and supplied IP:PORT information is displayed at the top center of the screen upon startup.
Each player paddle, ball, and current score is displayed in a matching color.
For example, in the sample solution, the green player’s paddle can hit only the green ball but the blue ball passes right through the green paddle with no impact on its trajectory.
Either ball of either color can knock out a block and accumulate score for the corresponding player. The scores for the two players appear in the top left and top right corners withing the border area.
The paddle is 9 characters wide and 1 character tall
The blocks (bricks) are 3 characters wide and 1 character tall.
When a ball hits a block/brick, the entire block should be removed and the corresponding player score should be incremented by one. Note that the sample solution does not yet remove the entire block.
The paddles can move left to right across the enter screen bounded only by the border on each side
The paddles can move up and down bounded below by the border along the bottom of the screen. Upward movement is restricted to the bottom 30% of rows
Use a READABLE color scheme that does not cause eyestrain
The map files describe the locations of the blocks/bricks and optionally the starting locations of the player paddles. The player paddle information may appear anywhere within the map file or be omitted completely as in one of the example map files — in that case, the paddles are drawn in the indicated default positions.
As in the sample solution, the starting positions of the balls are on opposite sides of the screen
Input file format consists of char int int triples where the ints represent the row, col position of the center of the block and the char describes the type of game item to add to the window. The B, G, X rows may appear in any ordering within the file. If
B 40 20 <== B = blue player centered at row 40, col 20
G 40 60 <== G = green player
X 18 28 <== X = target block/brick
Required Command Line Interface
./breakout map-file-name-goes-here s IP:PORT <== No timeout
./breakout map-file-name-goes-here s IP:PORT t <== With timeout
./breakout map-file-name-goes-here c IP:PORT <== No timeout
./breakout map-file-name-goes-here c IP:PORT t <== With timeout
where the arguments, when present, always appear in the order listed (Note – IP:PORT is a single C-style string)
t represents the timeout immediately option. If present, the t option is always in the position indicated.
s specifies the IP and Port # of the game host (player1)
c specifies the IP and Port # of the game client (player2)
Sample Solution and Map Access
An incomplete prototype sample solution with sample map files is available. At present there are five map files available. Below is an example showing how to execute the partial sample solution with one of the provided maps.
Networking has NOT been implemented yet in this sample solution so one player uses WASD and the other IJKL controls.
Your final product should support BOTH players using all three sets of controls: WASD, IJKL, and arrow keys.
Collision detection in the sample solution is also incomplete. The ball collision with a block only removes a piece of the block at a time not the entire block as it should.
NOTE: Since the game is built using ncurses, no need to redirect your X11 display to view the game.
/home/work/cpe455/breakout /home/work/cpe455/maps/multiblocks1.txt s 127.0.0.1:5678
/home/work/cpe455/breakout /home/work/cpe455/maps/multiblocks1.txt c 127.0.0.1:5678
/home/work/cpe455/breakout /home/work/cpe455/maps/multiblocks1.txt s 127.0.0.1:5678 t
/home/work/cpe455/breakout /home/work/cpe455/maps/multiblocks1.txt c 127.0.0.1:5678 t
HINTS
The ncurses Tutorial code is a good framework to build upon
Networking is always challenging so a subset of your team should immediately start on the networking component. No need for a fancy game lobby.
The time( ) function from time.h may be useful implementing the automatic timeout option. I recommend defining the timeout interval with a constant set to 1 sec. We will discuss why this is needed at a later time.
You may find that representing row, col positions as floating point values beneficial in terms of smoothing the animation since you can add fractional velocity vector components so the ball trajectory wasn’t constrained to + or – one character position. (The floats do get coerced to integers eventually but it does make the animation a little smoother).
Because of the speed of execution of the main loop, I increment by small fractions of a row or column position at a time.
You may use TCP or UDP networking. There are many examples of C-language network socket code online that you can use for reference.
Collepals.com Plagiarism Free Papers
Are you looking for custom essay writing service or even dissertation writing services? Just request for our write my paper service, and we'll match you with the best essay writer in your subject! With an exceptional team of professional academic experts in a wide range of subjects, we can guarantee you an unrivaled quality of custom-written papers.
Get ZERO PLAGIARISM, HUMAN WRITTEN ESSAYS
Why Hire Collepals.com writers to do your paper?
Quality- We are experienced and have access to ample research materials.
We write plagiarism Free Content
Confidential- We never share or sell your personal information to third parties.
Support-Chat with us today! We are always waiting to answer all your questions.