51 Networking: Overview
This tour explores how DOOM implements multiplayer networking: the shared protocol in the core engine, the Unix UDP backend, and the DOS IPX and serial transport layers.
51.0.2 Engine Logic
File: linuxdoom-1.10/d_net.c
- Implements:
- Building tic commands
- Sending/receiving packets:
HSendPacket
,HGetPacket
- Processing incoming data:
GetPackets
- Tick broadcast:
NetUpdate
- Tick execution control:
TryRunTics
- Startup arbitration:
D_ArbitrateNetStart
- Game exit:
D_QuitNetGame
51.0.3 Unix Networking Backend
File: linuxdoom-1.10/i_net.h
- Declares:
I_InitNetwork()
for startupI_NetCmd()
for send/receive
File: linuxdoom-1.10/i_net.c
- UDP socket implementation:
- Parses
-net
args - Opens nonblocking sockets
- Serializes
doomdata_t
forPacketSend()
/PacketGet()
- Dispatches
doomcom->command
viaI_NetCmd()
- Parses
51.0.4 DOS IPX Transport
File: ipx/README
- Describes IPX driver integration for DOOM multiplayer.
File: ipx/DOOMNET.C
LaunchDOOM()
:- Initializes
doomcom.id
- Hooks interrupt
- Spawns DOOM executable
- Initializes
File: ipx/IPXNET.C
- IPX backend:
- Interrupt 0x2f interface
InitNetwork()
,SendPacket(dest)
,GetPacket()
- ECB-based async receive
File: ipx/IPXSETUP.C
- Broadcast-based peer discovery
- Assigns player numbers
- Calls
LaunchDOOM()
51.0.5 DOS Serial Transport
File: sersrc/README.TXT
- Describes serial networking fallback
File: sersrc/DOOMNET.C
- Similar to IPX launcher
- Hooks interrupt, appends
-net
, spawns DOOM
File: sersrc/PORT.C
- UART setup:
- Detects I/O address and IRQ
- Hooks interrupt
- APIs:
read_byte()
/write_byte()
File: sersrc/SERSETUP.C
- Packet framing, modem config (via
modem.cfg
) Connect()
handshake- Starts game with
LaunchDOOM()
51.0.6 Summary
This concludes the overview of DOOM’s networking architecture: - Shared protocol: d_net.*
- Unix: i_net.*
- DOS IPX: ipx/
- DOS Serial: sersrc/