A2: Networked Game

In this assignment, you are to create a simple networked game that satisfies the requirements below.  The basic game should use the authoritative server model implemented by the sample code on github.

The basic design of the game is as follows:

  1. You should have a reasonably large play area, with no platforms.   The area should have high enough walls that the player cannot accidentally leave the area.
  2. Each player should be similar to the player in Assignment 1:  a character controller with a collection of Game Objects attached to it to facilitate simple player “animation”.  Only the top level Game Object (with the Character Controller) should be networked.  The animations on the parts of the character are created locally in each client.
  3. The player should have a single jump behavior, with some maximum height JH, where JH is at least 4 times the size of the player.
  4. The player movement can be similar to Assignment 1, or you can modify it.  The only requirement is a single jump, and that the player’s influence over their motion in the air is significantly less than if they are on the ground.
  5. Each time they spawn, the player starts at one of  12 fixed,  equally spaced positions on the edge of the game board (randomly selected each time).
  6. There is a “target object” that the players are trying to get.  It is moving around the game board at a height of (3/4)*JH above the game board.  It starts in the center of the board.  The server picks a target location for the object (new x/z position;  the height never changes) and the object moves towards that position at a constant speed.  When it reaches that position, the server picks a new position.  The object keeps moving until it is captured by a player.
  7. A player captures the target object by colliding with it.  When a player captures the object, he/she gets one point, and the object respawns at the center of the game board.
  8. If two players collide, the respawn at the one of the 12 player spawn points around the edge.
  9. A player sees their score at the top of the screen, and the other players scores above their head.
  10. The first player to 5 points wins.

The technical requirements of the game are as follows:

  1. For this assignment, you may use the scripts the sample project, but you should not start with the networking project.  (The intent of this requirement is to make sure you understand how a networked game like this is put together.)  You might want to start with A1, add networking to it, and then modify it as needed.
  2. The motion of the player and the target object should be done with dead reckoning techniques.
  3. The data sent between server and client for the target object should be the start position and time, the end position, and the speed.  The server will send new data when the target changes direction, or is captured and respawned.
  4. The data sent from the client to the server should be the player input.  The data sent from the server to the client for the character should include the position/orientation and velocity as of some time (which will be in the past by the time it reaches the players).  If a player is falling or coasting, nothing will be sent, and the client and server should compute the same position value using the starting inputs.  NOTE: you must compute the position/orientation of the player absolutely using the start time/position and a fixed gravity acceleration, using simple physics computations of motion (e.g., see the wikipedia page http://en.wikipedia.org/wiki/Projectile_motion).  (Obviously, the greater the amount of control you give the player in the air, the more often this data will be sent, but in the worst case it will be approximate the same amount of data as updating the position absolutely each frame as is done in the network same.)
  5. When the server detects collisions and updates the game state, it should send messages to the clients to respawn the players or targets and update the score.

 

Grading Scheme

Game:

  • 1.5 – can’t leave area, play area setup, target starts at center, height, players spawns from 12 fixed positions
  • .5 – player jump motion, 4 times player size
  • 1 – collision, walls, updating score/respawning boxes (client side)
  • .5 – individual gui display
  • .5 – 1st to 5 wins, game stops
  • .5 – animation on player
  • .5pt – score networking (other players scores abover their head)

Networking (2 points for capture box, 3 points for player)

  • 50% points for sending data for dead reckoning
  • 50% points for doing dead reckoning properly (item moves smoothly even under network lag, and adjusts position accounting for time delay between client and server)
  • 0 points if networking is done just like the provided github example

Bonus:

  • 1pt – networking improvements(something interesting to make local player respond even more quickly; ex: starting as soon as key is pressed; doing linear interpolation for smoothing jitter)
  • 1pt – above and beyond on gameplay