Difference between revisions of "Network protocol (Worms 2)"
From Worms Knowledge Base
m (Add parent article link) |
m (Reorganize sections and reword a bit. Data is also always textual.) |
||
Line 16: | Line 16: | ||
== Server communication == | == Server communication == | ||
− | The server hosting the user, room, and game lists | + | The server hosting the user, room, and game lists communicates with packets in the following format: |
=== Packet format === | === Packet format === | ||
Line 23: | Line 23: | ||
! Offset !! Type !! Size !! Name !! Description | ! Offset !! Type !! Size !! Name !! Description | ||
|- | |- | ||
− | | 0 || uint32 || 4 || Code || Determines the type of packet. Known | + | | 0 || uint32 || 4 || Code || Determines the type of packet. Known packets are listed [[#Packet contents|below]]. |
|- | |- | ||
− | | 4 || uint32 || 4 || Flags || A bitset determining which | + | | 4 || uint32 || 4 || Flags || A bitset determining which of the following fields will be available. |
|- | |- | ||
| ? || uint32 || 4 || Value 0 || If bit 0 is set in '''Flags'''. | | ? || uint32 || 4 || Value 0 || If bit 0 is set in '''Flags'''. | ||
Line 41: | Line 41: | ||
| ? || uint32 || 4 || Data Length || If bit 5 is set in '''Flags'''. | | ? || uint32 || 4 || Data Length || If bit 5 is set in '''Flags'''. | ||
|- | |- | ||
− | | ? || | + | | ? || char[DataLength] || Data Length || Data || If bit 5 is set in '''Flags''', stores textual data like an IP string or full chat message. |
|- | |- | ||
| ? || uint32 || 4 || Error || If bit 7 is set in '''Flags'''. Returns a Windows error code from the server, like E_FAIL for when the name of a room to create contains a bad word. | | ? || uint32 || 4 || Error || If bit 7 is set in '''Flags'''. Returns a Windows error code from the server, like E_FAIL for when the name of a room to create contains a bad word. | ||
|- | |- | ||
− | | ? || char[20] || 20 || Name || If bit 8 is set in '''Flags''' | + | | ? || char[20] || 20 || Name || If bit 8 is set in '''Flags''', stores a session name. Unused bytes are 0. |
|- | |- | ||
− | | ? | + | | ? || [[#Session info|Session info]] || 50 || Session || If bit 9 is set in '''Flags'''. Unused bytes are 0. |
|} | |} | ||
− | === | + | ==== Session info ==== |
− | + | Several packets identify a user, room, or game with the '''Name''' and '''Session''' fields. The latter provides the following information: | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | Several packets identify a user, room, or game with the '''Name''' and '''Session | + | |
{| class="wikitable" | {| class="wikitable" | ||
Line 174: | Line 78: | ||
|} | |} | ||
− | + | Passing other or invalid combinations (like "passworded user") will display a French flag with the default state or a question mark in the UI. | |
The Worms 2 1.0.1.1 Demo uses significantly different values compared to the full version 1.0.1.5 patch, causing said question marks to appear. However, interactions with full version users still work. | The Worms 2 1.0.1.1 Demo uses significantly different values compared to the full version 1.0.1.5 patch, causing said question marks to appear. However, interactions with full version users still work. | ||
− | ==== Nation / Flag ==== | + | ===== Nation / Flag ===== |
− | + | Determines which flag is displayed with the user, room, or game. Two flags are custom (Skull and Team17) and are not normally selectable. [[Des patch]] can unlock the selection of them, and adds another entry for an "invalid" country code, creating an empty flag. | |
{| class="wikitable sortable mw-collapsible mw-collapsed" | {| class="wikitable sortable mw-collapsible mw-collapsed" | ||
Line 288: | Line 192: | ||
|} | |} | ||
− | ==== Game release ==== | + | ===== Game release ===== |
− | + | Becomes 50 if CD detection failed. The CD detection consists of the following tests: | |
* Find CD drive, where drives A: and B: are ignored - a found drive letter is stored in the registry under HKCU\SOFTWARE\Team17SoftwareLTD\Worms2\CD. (error 2 otherwise) | * Find CD drive, where drives A: and B: are ignored - a found drive letter is stored in the registry under HKCU\SOFTWARE\Team17SoftwareLTD\Worms2\CD. (error 2 otherwise) | ||
* Check the CD being "Worms 2" or "WORMS2". (error 1 otherwise) | * Check the CD being "Worms 2" or "WORMS2". (error 1 otherwise) | ||
* Check if the CD has no free space to ensure it being a CD-ROM. (error 3 otherwise) | * Check if the CD has no free space to ensure it being a CD-ROM. (error 3 otherwise) | ||
* Check if the CD stores an "autorun.inf" file. (error 4 otherwise) | * Check if the CD stores an "autorun.inf" file. (error 4 otherwise) | ||
+ | |||
+ | === Packet contents === | ||
+ | |||
+ | As specified above, the '''Code''' of a packet determines the '''Action''' to take on either the server or client side and in effect which fields are used. Some codes are reused for multiple occassions, and some are unused in the 1.0.1.5 patch. | ||
+ | |||
+ | Client query packets are also used for server notices, represented by the '''Type''' column in the following table: | ||
+ | * Query: A client query to execute an action on the server, always getting a reply (even codes only). | ||
+ | * Reply: A server reply to a client query, always reporting back an '''Error''' code, 0 for success (odd codes only). | ||
+ | * Notice: Same as query, but coming as an out-of-bound server packet to update the state on the client, like when another user joins or creates a game. | ||
+ | |||
+ | Note that the same ID counter is incremented for users (UID), rooms (RID), and games (GID). If a user logs in with UID 3 and immediately creates a room, the RID will be 4. | ||
+ | |||
+ | {| class="wikitable sortable" | ||
+ | ! Code !! Action !! Type !! Value 0 !! Value 1 !! Value 2 !! Value 3 !! Value 4 !! Value 10 !! Data !! Name / Session | ||
+ | |- style="background:#FFF" | ||
+ | | 50 || ''not used'' || Query || || || || || ? || || || | ||
+ | |- style="background:#FFF" | ||
+ | | 51 || ''not used'' || Reply || || || || || ? || || || | ||
+ | |- style="background:#FFFFCD" | ||
+ | | 200 || List Rooms || Query || || || || || 0 || || || | ||
+ | |- style="background:#FFFFFF" | ||
+ | | 300 || ''not used'' || Query || || || || || 0 || || || | ||
+ | |- style="background:#FFFFCD" | ||
+ | | 350 || List Item || Reply || || UID / RID / GID || || || || || user / room / host IP || user / room / host | ||
+ | |- style="background:#FFFFCD" | ||
+ | | 351 || List End || Reply || || || || || || || || | ||
+ | |- style="background:#FFFFCD" | ||
+ | | 400 || List Users || Query || || || UID || || 0 || || || | ||
+ | |- style="background:#FFFFCD" | ||
+ | | 500 || List Games || Query || || || UID || || 0 || || || | ||
+ | |- style="background:#FFE6CD" | ||
+ | | 600 || Login || Query || || 0 || || || 0 || || || local user | ||
+ | |- style="background:#FFE6CD" | ||
+ | | 600 || Login || Notice || || remote UID || || || 0 || || || remote user | ||
+ | |- style="background:#FFE6CD" | ||
+ | | 601 || Login || Reply || || local UID || || || || || || | ||
+ | |- style="background:#FFCDCD" | ||
+ | | 700 || Create Room || Query || || 0 || || || 0 || || creator IP || room | ||
+ | |- style="background:#FFCDCD" | ||
+ | | 700 || Create Room ||Notice || || new RID || || || 0 || || creator IP || room | ||
+ | |- style="background:#FFCDCD" | ||
+ | | 701 || Create Room || Reply || || new RID || || || || || || | ||
+ | |- style="background:#FFCDEF" | ||
+ | | 800 || Join Room / Game || Query || || || joined RID / GID || || || local UID || || | ||
+ | |- style="background:#FFCDEF" | ||
+ | | 800 || Join Room / Game || Notice || || || joined RID / GID || || || remote UID || || | ||
+ | |- style="background:#FFCDEF" | ||
+ | | 801 || Join Room / Game || Reply || || || || || || || || | ||
+ | |- style="background:#EFCDFF" | ||
+ | | 900 || Leave Room || Query || || || left RID || || || local UID || || | ||
+ | |- style="background:#EFCDFF" | ||
+ | | 900 || Leave Room || Notice || || || left RID || || || remote UID || || | ||
+ | |- style="background:#EFCDFF" | ||
+ | | 901 || Leave Room || Reply || || || || || || || || | ||
+ | |- style="background:#CDCDFF" | ||
+ | | 1000 || Disconnect User || Query<ref name=NotUsed>Only ever sent as a notice by the server, clients disconnect without any query and awaited reply.</ref> || || || || || || local UID || || | ||
+ | |- style="background:#CDCDFF" | ||
+ | | 1000 || Disconnect User || Notice || || || || || || remote UID || || | ||
+ | |- style="background:#CDCDFF" | ||
+ | | 1001 || Disconnect User || Reply<ref name=NotUsed/> || || || || || || || || | ||
+ | |- style="background:#CDD6FF" | ||
+ | | 1100 || Close Room || Query || || || || || || RID || || | ||
+ | |- style="background:#CDD6FF" | ||
+ | | 1100 || Close Room || Notice || || || || || || RID || || | ||
+ | |- style="background:#CDD6FF" | ||
+ | | 1101 || Close Room || Reply || || || || || || || || | ||
+ | |- style="background:#CDEFFF" | ||
+ | | 1200 || Create Game || Query<ref name=BadIP>Since the host reports its incorrectly detected NAT IP here, [[Worms 2 Memory Changer]] has to be used to inject the actual IP address into Worms 2 before creating a room.</ref> || || || RID || || GID? || || host IP || host | ||
+ | |- style="background:#CDEFFF" | ||
+ | | 1200 || Create Game || Notice || || || RID || || GID? || || host IP || host | ||
+ | |- style="background:#CDEFFF" | ||
+ | | 1201 || Create Game || Reply || || GID || || || || || || | ||
+ | |- style="background:#CDFFEF" | ||
+ | | 1300 || Room Chat || Query || local UID || || || receiver RID / UID || || || "GRP:[ UserName ] Message" / "PRV:[ UserName ] Message" || | ||
+ | |- style="background:#CDFFEF" | ||
+ | | 1300 || Room Chat || Notice || remote UID || || || receiver RID / UID || || || "GRP:[ UserName ] Message" / "PRV:[ UserName ] Message" || | ||
+ | |- style="background:#CDFFEF" | ||
+ | | 1301 || Room Chat || Reply<ref name=ReturnsEFail>Original server always reports E_FAIL in error code, even though messages were sent.</ref> || || || || || || || || | ||
+ | |- style="background:#FFFFFF" | ||
+ | | 1320 || ''not used'' || Query || ? || || || || || || ? || | ||
+ | |- style="background:#FFFFFF" | ||
+ | | 1321 || ''not used'' || Reply || || || || || || || || | ||
+ | |- style="background:#FFFFFF" | ||
+ | | 1322 || ''not used'' || Query || ? || || || || || || ? || | ||
+ | |- style="background:#FFFFFF" | ||
+ | | 1323 || ''not used'' || Reply || || || || || || || || | ||
+ | |- style="background:#FFFFFF" | ||
+ | | 1324 || ''not used'' || Query || ? || || || || || || || | ||
+ | |- style="background:#FFFFFF" | ||
+ | | 1325 || ''not used'' || Reply || || || || || || || ? || | ||
+ | |- style="background:#CDFFCD" | ||
+ | | 1326 || Connect Game || Query || GID || || || || || || || | ||
+ | |- style="background:#CDFFCD" | ||
+ | | 1327 || Connect Game || Reply || || || || || || || host IP || | ||
+ | |} | ||
+ | <references /> | ||
== Game room communication == | == Game room communication == | ||
The players are connected via P2P using DirectPlay. This means the ports 47624 (for the lobby connection itself) and 2300 to 2400 (for each player connection) should be forwarded in any router. The fact that each player is connected to another means that the host can leave the game at any time, the remaining players can continue playing without dropping, unlike in [[Worms Armageddon]] or [[Worms World Party]]. | The players are connected via P2P using DirectPlay. This means the ports 47624 (for the lobby connection itself) and 2300 to 2400 (for each player connection) should be forwarded in any router. The fact that each player is connected to another means that the host can leave the game at any time, the remaining players can continue playing without dropping, unlike in [[Worms Armageddon]] or [[Worms World Party]]. |
Revision as of 20:39, 9 July 2020
The Worms 2 servers host rooms in which users can meet to then connect to each other's PCs for playing games.
Contents
Official servers
The following servers are hosted by Team17:
Name | IP address | Port | Notes |
---|---|---|---|
Worms2 Server (UK) | uk1.servers.worms2.com | 17000 | "The Team17 Server". Started to reject new connections in July 2020, shortly after some Worms enthusiasts played on it. Unclear whether the sudden activity downed it, it did not immediately break. The client will display "Unable to create new player..." when attempting to connect to it. |
Worms2 Demo Server (UK) | uk1.servers.worms2.com | 17171 | Server for Worms 2 demo. Allows full versions to connect aswell. Did not go down in July 2020. |
Server communication
The server hosting the user, room, and game lists communicates with packets in the following format:
Packet format
Offset | Type | Size | Name | Description |
---|---|---|---|---|
0 | uint32 | 4 | Code | Determines the type of packet. Known packets are listed below. |
4 | uint32 | 4 | Flags | A bitset determining which of the following fields will be available. |
? | uint32 | 4 | Value 0 | If bit 0 is set in Flags. |
? | uint32 | 4 | Value 1 | If bit 1 is set in Flags. |
? | uint32 | 4 | Value 2 | If bit 2 is set in Flags. |
? | uint32 | 4 | Value 3 | If bit 3 is set in Flags. |
? | uint32 | 4 | Value 4 | If bit 4 is set in Flags. Never used other than client-side? |
? | uint32 | 4 | Value 10 | If bit 10 is set in Flags. |
? | uint32 | 4 | Data Length | If bit 5 is set in Flags. |
? | char[DataLength] | Data Length | Data | If bit 5 is set in Flags, stores textual data like an IP string or full chat message. |
? | uint32 | 4 | Error | If bit 7 is set in Flags. Returns a Windows error code from the server, like E_FAIL for when the name of a room to create contains a bad word. |
? | char[20] | 20 | Name | If bit 8 is set in Flags, stores a session name. Unused bytes are 0. |
? | Session info | 50 | Session | If bit 9 is set in Flags. Unused bytes are 0. |
Session info
Several packets identify a user, room, or game with the Name and Session fields. The latter provides the following information:
Offset | Type | Size | Value |
---|---|---|---|
0 | uint32 | 4 | Always 0x17171717 |
4 | uint32 | 4 | Always 0x02010101 |
8 | uint8 | 1 | Nation / Flag |
9 | uint8 | 1 | Game version, always 49 |
10 | uint8 | 1 | Game release (same as Game version, 50 if CD check failed) |
11 | uint8 | 1 | Type (1=room, 4=game, 5=user) |
12 | uint8 | 1 | State (1=default, 2=passworded room) |
13 | uint8 | 1 | Always 1 |
14 | uint8 | 1 | Always 0 |
15 | gap | 35 | Unused, all 0. |
Passing other or invalid combinations (like "passworded user") will display a French flag with the default state or a question mark in the UI.
The Worms 2 1.0.1.1 Demo uses significantly different values compared to the full version 1.0.1.5 patch, causing said question marks to appear. However, interactions with full version users still work.
Nation / Flag
Determines which flag is displayed with the user, room, or game. Two flags are custom (Skull and Team17) and are not normally selectable. Des patch can unlock the selection of them, and adds another entry for an "invalid" country code, creating an empty flag.
Value | Flag |
---|---|
1 | United Kingdom |
2 | Argentinia |
3 | Australia |
4 | Austria |
5 | Beglium |
6 | Brazil |
7 | Canada |
8 | Croatia |
9 | Bosnia and Herzegovina (old flag) |
10 | Cyprus |
11 | Czech Republic |
12 | Denmark |
13 | Finland |
14 | France |
15 | Georgia |
16 | Germany |
17 | Greece |
18 | Hong Kong SAR |
19 | Hungary |
20 | Iceland |
21 | India |
22 | Indonesia |
23 | Iran |
24 | Iraq |
25 | Ireland |
26 | Israel |
27 | Italy |
28 | Japan |
29 | Liechtenstein |
30 | Luxembourg |
31 | Malaysia |
32 | Malta |
33 | Mexico |
34 | Morocco |
35 | Netherlands |
36 | New Zealand |
37 | Norway |
38 | Poland |
39 | Portugal |
40 | Puerto Rico |
41 | Romania |
42 | Russian Federation |
43 | Singapore |
44 | South Africa |
45 | Spain |
46 | Sweden |
47 | Switzerland |
48 | Turkey |
49 | United States |
50 | Skull image |
51 | Team17 logo |
Game release
Becomes 50 if CD detection failed. The CD detection consists of the following tests:
- Find CD drive, where drives A: and B: are ignored - a found drive letter is stored in the registry under HKCU\SOFTWARE\Team17SoftwareLTD\Worms2\CD. (error 2 otherwise)
- Check the CD being "Worms 2" or "WORMS2". (error 1 otherwise)
- Check if the CD has no free space to ensure it being a CD-ROM. (error 3 otherwise)
- Check if the CD stores an "autorun.inf" file. (error 4 otherwise)
Packet contents
As specified above, the Code of a packet determines the Action to take on either the server or client side and in effect which fields are used. Some codes are reused for multiple occassions, and some are unused in the 1.0.1.5 patch.
Client query packets are also used for server notices, represented by the Type column in the following table:
- Query: A client query to execute an action on the server, always getting a reply (even codes only).
- Reply: A server reply to a client query, always reporting back an Error code, 0 for success (odd codes only).
- Notice: Same as query, but coming as an out-of-bound server packet to update the state on the client, like when another user joins or creates a game.
Note that the same ID counter is incremented for users (UID), rooms (RID), and games (GID). If a user logs in with UID 3 and immediately creates a room, the RID will be 4.
Code | Action | Type | Value 0 | Value 1 | Value 2 | Value 3 | Value 4 | Value 10 | Data | Name / Session |
---|---|---|---|---|---|---|---|---|---|---|
50 | not used | Query | ? | |||||||
51 | not used | Reply | ? | |||||||
200 | List Rooms | Query | 0 | |||||||
300 | not used | Query | 0 | |||||||
350 | List Item | Reply | UID / RID / GID | user / room / host IP | user / room / host | |||||
351 | List End | Reply | ||||||||
400 | List Users | Query | UID | 0 | ||||||
500 | List Games | Query | UID | 0 | ||||||
600 | Login | Query | 0 | 0 | local user | |||||
600 | Login | Notice | remote UID | 0 | remote user | |||||
601 | Login | Reply | local UID | |||||||
700 | Create Room | Query | 0 | 0 | creator IP | room | ||||
700 | Create Room | Notice | new RID | 0 | creator IP | room | ||||
701 | Create Room | Reply | new RID | |||||||
800 | Join Room / Game | Query | joined RID / GID | local UID | ||||||
800 | Join Room / Game | Notice | joined RID / GID | remote UID | ||||||
801 | Join Room / Game | Reply | ||||||||
900 | Leave Room | Query | left RID | local UID | ||||||
900 | Leave Room | Notice | left RID | remote UID | ||||||
901 | Leave Room | Reply | ||||||||
1000 | Disconnect User | Query[1] | local UID | |||||||
1000 | Disconnect User | Notice | remote UID | |||||||
1001 | Disconnect User | Reply[1] | ||||||||
1100 | Close Room | Query | RID | |||||||
1100 | Close Room | Notice | RID | |||||||
1101 | Close Room | Reply | ||||||||
1200 | Create Game | Query[2] | RID | GID? | host IP | host | ||||
1200 | Create Game | Notice | RID | GID? | host IP | host | ||||
1201 | Create Game | Reply | GID | |||||||
1300 | Room Chat | Query | local UID | receiver RID / UID | "GRP:[ UserName ] Message" / "PRV:[ UserName ] Message" | |||||
1300 | Room Chat | Notice | remote UID | receiver RID / UID | "GRP:[ UserName ] Message" / "PRV:[ UserName ] Message" | |||||
1301 | Room Chat | Reply[3] | ||||||||
1320 | not used | Query | ? | ? | ||||||
1321 | not used | Reply | ||||||||
1322 | not used | Query | ? | ? | ||||||
1323 | not used | Reply | ||||||||
1324 | not used | Query | ? | |||||||
1325 | not used | Reply | ? | |||||||
1326 | Connect Game | Query | GID | |||||||
1327 | Connect Game | Reply | host IP |
- ↑ 1.0 1.1 Only ever sent as a notice by the server, clients disconnect without any query and awaited reply.
- ↑ Since the host reports its incorrectly detected NAT IP here, Worms 2 Memory Changer has to be used to inject the actual IP address into Worms 2 before creating a room.
- ↑ Original server always reports E_FAIL in error code, even though messages were sent.
Game room communication
The players are connected via P2P using DirectPlay. This means the ports 47624 (for the lobby connection itself) and 2300 to 2400 (for each player connection) should be forwarded in any router. The fact that each player is connected to another means that the host can leave the game at any time, the remaining players can continue playing without dropping, unlike in Worms Armageddon or Worms World Party.