Replaced the 'Turn' protocol by the Update' protocol.

Bumped the UQM and netplay protocol versions.
Some cleanups.



git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@3537 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
Meep-Eep
2010-04-24 20:59:07 +00:00
parent 91fde6f5e7
commit e4886e60ee
32 changed files with 835 additions and 535 deletions
+141 -26
View File
@@ -1,63 +1,178 @@
NetState_unconnected is the initial state. When a connection attempt is made,
the state is set to NetState_connecting.
The state field of a NetConnection is NULL.
== Any connected state ==
Some packets may be sent and received in any state except
NetState_unconnected.
These are: PING, ACK, ABORT, RESET
These are not listed below at each individual state.
NetState_connecting indicates a connection is in progress.
When the connection is established, an INIT packet is sent, the state
is changed to NetState_init and InputFunc is set to DoNetworkInit.
The state field of a NetConnection is a ConnectStateData structure.
Whenever a connection is aborted, the state is returned to
NetState_unconnected. This state transition is not listed below at each
individual state.
== NetState_unconnected ==
NetState_unconnected is the initial state.
NetConnection.state: NULL
Packets ok to send: none
Packets ok to receive: none
Next state:
NetState_connecting -- connection attempt in progress
== NetState_connecting ==
NetState_connecting indicates that a connection is in progress.
When the connection is established, the state is changed to NetState_init
and InputFunc is set to DoNetworkInit.
NetConnection.state: instance of ConnectStateData
Packets ok to send: none
Packets ok to receive: none
Next state:
NetState_init -- connection established
== NetState_init ==
NetState_init is for initialising the connection before actual game
information is sent. When an INIT packet is received, the state is set
to NetState_inSetup and InputFunc is set to DoMelee.
The state field of a NetConnection is a BattleStateData structure.
information is sent.
As this state is entered, an INIT packet is sent. When an INIT packet
has also been received, the state is set to NetState_inSetup and
InputFunc is set to DoMelee.
NetConnection.state: instance of BattleStateData
Packets ok to send: INIT
Packets ok to receive: INIT
Next state:
NetState_inSetup -- received an INIT packet
== NetState_inSetup ==
NetState_inSetup is the state in which the fleet configuration is negotiated.
Only the side who has myTurn set may send this ship information, by means
of FLEET and TEAMNAME packets.
The Turn negotiation is used to change myTurn.
This does not necessarilly mean that the fleet setup screen is visible;
this state is also held after a battle when the battle outcome is still
displayed.
Each side may send fleet configuration changes to the other side, by means of
FLEET and TEAMNAME packets. Agreement on configuration settings is provided
through the Update negotiation.
The Confirm negotiation is used to end this state and go to
NetState_preBattle. At this time InputFunc is set to DoPreMelee.
The state field of a NetConnection is a BattleStateData structure.
NetConnection.state: instance of BattleStateData
Packets ok to send: FLEET, TEAMNAME, HANDSHAKE0, HANDSHAKE1,
HANDSHAKECANCEL, HANDSHAKECANCELACK
Packets ok to receive: FLEET, TEAMNAME, HANDSHAKE0, HANDSHAKE1,
HANDSHAKECANCEL, HANDSHAKECANCELACK
Next state:
NetState_preBattle -- configuration has been confirmed
== NetState_preBattle ==
NetState_preBattle is used for non-interactive battle negotiations.
One side sends the random seed; the other receives it.
Both sides send their input delay value.
The Ready negotiation is used to end this state and go to
NetState_interBattle.
The state field of a NetConnection is a BattleStateData structure.
NetState_interBattle is used to allow either side to do some local
NetConnection.state: instance of BattleStateData
Packets ok to send: SEEDRANDOM, INPUTDELAY, READY
Packets ok to receive: SEEDRANDOM, INPUTDELAY, READY
Next state:
NetState_interBattle -- ready to continue
== NetState_interBattle ==
NetState_interBattle is used to allow each side to do some local
initialisations before moving on.
The Ready negotiation is used to end this state and go to
NetState_selectShip, or if there are no more ships to be selected,
to NetState_inBattle.
The state field of a NetConnection is a BattleStateData structure.
NetState_selectShip, or if all sides have selected a ship, to
NetState_inBattle, or if there are no more ships in a fleet,
to NetState_inSetup.
NetState_selectShip is where a side may select his ship. The other
If there are no more ships, the the Ready negotiation is used to
enter NetState_inSetup.
NetConnection.state: instance of BattleStateData
Packets ok to send: READY
Packets ok to receive: READY
Next state:
NetState_selectShip -- ready to select the next ship
NetState_inBattle -- ready to start the battle
NetState_inSetup -- no more ships; game over
== NetState_selectShip ==
NetState_selectShip is where a side may select their ship. The other
side is waiting for notice of this selection.
As soon as the selection has been sent or received, the state is changed
back to NetState_interBattle.
The state field of a NetConnection is a BattleStateData structure.
NetConnection.state: instance of BattleStateData
Packets ok to send: SELECTSHIP
Packets ok to receive: SELECTSHIP
Next state:
NetState_interBattle -- a selection has been made
== NetState_inBattle ==
NetState_inBattle is where the actual melee takes place.
Both sides send their input until the game is over, at which point
the Ready negotiation is used to end this state and go to
the NetState_endingBattle state. Until the Ready negotiation has been
completed, the simulation is continuing.
The state field of a NetConnection is a BattleStateData structure.
NetConnection.state: instance of BattleStateData
Packets ok to send: BATTLEINPUT, READY
Packets ok to receive: BATTLEINPUT, READY
Next state:
NetState_endingBattle -- ready to end the battle
== NetState_endingBattle ==
NetState_endingBattle is where the local side waits for the remote
battle frame count, after it has sent its own. When it arrives,
the state changes to NetState_endingBattle2.
The state field of a NetConnection is a BattleStateData structure.
NetConnection.state: instance of BattleStateData
Packets ok to send: BATTLEINPUT, FRAMECOUNT
Packets ok to receive: BATTLEINPUT, FRAMECOUNT
Next state:
NetState_endingBattle2 -- we know when to end the battle
== NetState_endingBattle2 ==
NetState_endingBattle2 is where the side with the lowest battle frame count
catches up with the other other side, while the other side waits.
The Ready negotiation is used to signal that each side is ready,
and the state changes back to NetState_interBattle.
The state field of a NetConnection is a BattleStateData structure.
and the state changes to NetState_interBattle.
NetConnection.state: instance of BattleStateData
When a connection is aborted, the state is returned to NetState_unconnected.
Packets ok to send: BATTLEINPUT, READY
Packets ok to receive: BATTLEINPUT, READY
Next state:
NetState_interBattle -- get ready for the next ship