6.11.0.4

Week 13 Set b

home work!

Programming Language ISL+

Due Date Wed at 9:00pm (Week 13)

Purpose Modern games are distributed, and so is our turkey-gobble game. Let’s practice client design one more time.

Finger Exercises

None.

Graded Exercises

Exercise 1 The software architect of ApperGamer has produced a protocol design for a distributed, multi-player version of the gobbler game.

The multi-player game has three phases:
  1. In the waiting phase, the server is waiting for clients to sign up for a game. Clients will receive a WaitingMessage once they have joined successfully and thereafter whenever there are any other changes.

  2. Once enough players have signed up and the waiting time has expired, the countdown phase begins. During this phase, at least two waiting players are selected to play, and they receive the initial state, including how much time is left in the countdown. This CountdownMessage is sent on each clock tick.

    Unselected players may observe the game.

  3. Finally, the server transitions to the playing phase. This phase is similar to the single-player game. Instead of AI turkeys, however, the other turkeys are now manually controlled by other players, and it is the server that maintains their state.

The changes to the client software are substantial. On each clock tick, the server calculates the next state and sends it to the clients, which must render it in an appropriate manner for its player.

When a client detects a mouse click during the playing phase, it must send a waypoint to the server. As food gets eaten, the server adds new food at random places on the grid.

The game ends when time runs out. At that point, a GameOverMessage is sent. The client must render this last message and shut down.

Your client’s main function must consume two arguments: (1) an Image that represents your own avatar and (2) a name for your avatar. Its result is the list of strings conveyed by the GameOverMessage message. Document how you prefer to call the main function.

Any player that sends messages at the wrong point or ill-formatted messages will be kicked out of the game.

Graphics You are free to render other players with any shape you want. We will award 20% extra points for really cool avatar designs that interact well with the rest of the graphics. The graders will nominate the best design, and the TAs will vote on the nominations, with Becca playing tie breaker.

Hint Once you have completed the design of the client software, you way wish to play with two clients simultaneously. You may wish to read up on launch-many-worlds and experiment with an appropriate start function. – We will use your players with our own start function and a local server.