Structures in Network.inc

All structures owned by Ryan Sawatzky

; ---- Network Message Types & Formats ---
 
 

HELLO EQU 33 ; Message Format Constants

UPDATE EQU 21

GOODBYE EQU 22

HELLOREPLY EQU 23

START EQU 24

FIRE EQU 25

FULL EQU 42
 
 

GenericMsg STRUC ; Generic Message Structure

MsgType db ? ; 1-byte packet type identifier (See types below)

ShipID db 63 ; Player that transmitted the message

GenericMSG ENDS
 
 

; This is the generic message format that all messages follow
 
 

HelloMsg STRUC ; Hello Message

MsgType db HELLO

ShipID db 63 ; Sender's IDnum

HelloMsg ENDS
 
 

; The Hello message is sent when the player first attempts to join the game.

; The purpose of this message is to tell all the other players currently in

; the game that there is a new player.
 
 

HelloReplyMsg STRUCT ; Reply to Hello Message

MsgType db HELLOREPLY

ShipID db 63 ; Sender's IDnum

NumPlayers db ? ; Number of active players in the game

HelloReplyMsg ENDS
 
 

; The HelloReply message is sent by player number one to the player who just

; sent a hello message. This message is sent while the game is waiting for

; players to join. It tells the player that just joined which player number

; he is.
 
 

FullMsg STRUC ; Game is Full

MsgType db FULL

ShipID db ? ; Sender's IDnum

FullMsg ENDS
 
 

; The Full Message is sent by the first player to any players who attempt to

; join the game when either the number of players has already reached its max

; or when the game is already underway. It tells the player that he can not

; join the current game.
 
 

UpdateMsg STRUC ; Update Message

MsgType db UPDATE

ShipID db 63 ; Unique ship number (1-4)

XPosE dw ? ; Position of ship - X

YPosE dw ? ; Position of ship - Y

OrientE db ? ; Orientation of ship

;FireE db ? ; Will perhaps hold status of any fire on ship

UpdateMsg ENDS
 
 

; The Update message is sent by any ship whenever its position or orientation

; changes. The fire data member might be used to display fire in certain

; compartments of the ship. The other players who receive this information

; will update their enemy ship structs accordingly.
 
 

FireMsg STRUC ; Ship fires projectile message

MsgType db FIRE

ShipID db 63 ; Sender's IDnum

MunitionP db ? ; What kind of shot - bullet or torpedo

XposP dw ? ; X coord of shot

YposP dw ? ; Y coord of shot

XOffsetP db ? ; movement in X direction

YOffsetP db ? ; movement in Y direction

SpeedP db ? ; Speed of projectile

TargetP db ? ; Target ship

HitProbabilityP db ? ; Probability of hitting target

FireMsg ENDS
 
 

; The Fire message is sent by any ship whenever it fires a projectile (either

; a bullet or a torpedo. This message contains important information such

; as the starting position, direction, target, and speed, so that all other

; ships can calculate the movements of the projectile on their own, instead

; of having to be sent update messages by the firing ship.
 
 

StartMsg STRUC ; Start Game Message

MsgType db START

ShipID db ? ; Sender's IDnum

StartMsg ENDS
 
 

; This message will be sent by player number one, when he clicks on the GO

; button on the main menu. This button will only be activated after enough

; players have joined the game. This message tells everyone to start the

; actual game
 
 

GoodByeMsg STRUC ; GoodBye Message

MsgType db GOODBYE

ShipID db 63 ; Sender's IDnum

GoodByeMsg ENDS
 
 

; The Goodbye message is sent by any ship who is either sunk or quits the

; game, right now by pressing the ESC key. This message tells all the other

; players that this ship is now out of play. As such, the other players will

; update their enemy ship structs appropriately.