Skip to content
Aditya edited this page Oct 5, 2013 · 1 revision

Multi-player Networking

This section contains a brief description of the various network signals in SwiftTyper and their meaning.

Networking in SwiftTyper is done by encoding the various phases of the game in string messages and then decoding them.

The client sends signals to the server after an interval of 1 sec. The signal sent by the client depends on the state of the game, the various signals are listed below:

  • Initially when the server is started, it waits for a "1000" signal from all the users. When the signal is received, the server interprets that the users sending the signal have joined the game. Until all users don't send "1000" signal, the server sends "1000 0" back to the users who have already joined, and the client interprets that the server is waiting for other players. After all the users send the signal, the server then sends the signal "1000 1 "+paragraph in response to "1000" from users. Client programs then print paragraph in the text-box.

  • When the paragraph is received, the client programs send their respective wpm (words per minute ). The server program calculates their rank and sends it to clients.

  • When the paragraph is typed, the client programs send a "1009 "+string signal to server where string contains all data of user. Server responds by sending the "1009 "+rankstring to the client, and the client displays the ranks which are sent to it in rankstring

Clone this wiki locally