12.07.2015 Views

Implementation of a Peer-to-Peer Multiplayer Game with ... - DVS

Implementation of a Peer-to-Peer Multiplayer Game with ... - DVS

Implementation of a Peer-to-Peer Multiplayer Game with ... - DVS

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Table 4.2: Message types used by the peer-<strong>to</strong>-peer network engineType Type ID DescriptionPOSITION 0x01 Position update.INTRODUCE 0x04 Introduces a new player that has entered the targetplayer’s vision range.SENSOR_REQUEST 0x08 Sensor node request. Tells the destination node <strong>to</strong>become sensor node for the sender.SENSOR_SUGGEST 0x09 Suggests a node as new sensor node for a particularsec<strong>to</strong>r.FIRE_BULLET 0x81 Indicates a fired missile.IHITYOU 0x82 The destination player is hit by a missile from thesending player.IDIED 0x83 The sending player’s ship explodes.MessagesThe peer-<strong>to</strong>-peer pro<strong>to</strong>col has a binary message format reducing the required bandwidth and processingpower compared <strong>to</strong> the ASCII messages <strong>of</strong> the client-server version. But position update messages containmore fields, allowing for a basic dead reckoning. Besides position and rotation, update messagesalso contain the velocities <strong>of</strong> position and rotation. According <strong>to</strong> these values, the remote player’s shipsare animated in the time period between two update messages, resulting in a much smoother and moreprecise ship movement. Each message has a 4 byte header including two 16 bit fields specifying the size(in bytes) and type type <strong>of</strong> the message. All message types are listed in table 4.2.POSITION messages are sent regularly (every 100 milliseconds) <strong>to</strong> all known peers for which at leas<strong>to</strong>ne <strong>of</strong> the following conditions is met (assume A is the sender and B is the potential receiver):1. B is in A’s vision range.2. A is in B’s vision range. (Position update messages contain a field specifying the sender’s (current)vision range.)3. B is in A’s sensor node list.4. A is sensor node for B.Position update messages have a <strong>to</strong>tal size <strong>of</strong> 64 bytes, containing the following information:• 3-dimensional position (12 bytes)• 3-dimensional rotation (12 bytes)• 3-dimensional direction <strong>of</strong> transla<strong>to</strong>ry motion (12 bytes)• 3-dimensional direction <strong>of</strong> rota<strong>to</strong>ry motion (12 bytes)• Velocity <strong>of</strong> transla<strong>to</strong>ry motion (4 bytes)• Velocity <strong>of</strong> rota<strong>to</strong>ry motion (4 bytes)• Vision radius (4 bytes)60 4.2 Network Models

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!