COSC 3P91

Assignment 4

Instructor: Michael Winter, Office J323, email: mwinter@brocku.ca


RoboRace (Part 4)

In this assignment we are going to add some sounds and music to the program, and our game will go online.

Sounds & music

In this assignment your are supposed to play some sounds while executing certain GameEvents (BumpEvent, DestroyedEvent, VictoryEvent). No modification, i.e., sound filter, is needed. In addition, during the game you have to play a midi-file provided below. You may use the SoundManager and the MidiManager provided in the COSC3P40 package, of course. Notice that you should use the methods setSoundPath(...) and setMidiPath(...) of the managers at the beginning of your program.

Communication

In the previous two assignments communication between the players and the GameMaster class was done by using a bidirectional queue. In this assignment you must replace this queue by suitable classes establishing a connection via the internet. Since the information transmitted is text you have to use appropriate Reader and Writer objects. In order to indicate the end of a message you should use a special character symbol, e.g., '\0'.

The server

Provide one program that acts as the server. This program should do the following:
  1. It asks for the number n of players.
  2. It accepts the given number of player, i.e., it waits for n clients to establish a connection to the server.
  3. Receives name of each Player.
  4. It runs the GameMaster .
  5. After the game it shuts down all connections and then terminates.

The clients

Another program should act as a client. This program should do the following:
  1. It asks for the player's name.
  2. It connects to the server.
  3. It runs a Player.
  4. After the game it disconnects and then terminates.

Remarks

  1. Use "localhost" whenever an IP address is required so that the clients and the server may run together on a single computer.
  2. You find a project folder to start here.

COSC Home Page
COSC 3P91 Home Page
© M. Winter, 2017