CNetwork
Header: include/network.hpp
Implementation: src/network.cpp
CNetwork wraps DirectPlay (DirectX 3) session management.
It handles the multiplayer lobby: creating and browsing game sessions, connecting
players, and sending/receiving NetPacket data each game tick.
In-game synchronization is handled in src/decnet.cpp (part of CDecor).
src/decnet.cpp is incomplete.
DirectPlay support through Free Direct / Free API is unverified.
Do not expect multiplayer to work in the current build.
Overview
Free Eggbert supports up to 4 simultaneous network players. Networking is built on DirectPlay from DirectX 3, which provides session browsing over IPX, TCP/IP, and modem transports.
Session Lifecycle
The multiplayer flow is driven by game phases in CEvent:
WM_PHASE_SERVICE— select DirectPlay transport (IPX, TCP/IP, modem)WM_PHASE_SESSION— browse available sessions or create a new oneWM_PHASE_MULTI— pre-game lobby; wait for all players to joinWM_PHASE_PLAY— synchronized gameplay begins
Methods
Full signatures from include/network.hpp:
// Session management
BOOL EnumProviders();
int GetNbProviders();
char* GetProviderName(int index);
BOOL CreateProvider(int index); // selects IPX, TCP/IP, modem
void FreeProviderList();
BOOL EnumSessions();
int GetNbSessions();
char* GetSessionName(int index);
BOOL JoinSession(int index, char* pPlayerName);
BOOL CreateSession(char* pSessionName, char* pPlayerName);
void FreeSessionList();
BOOL Close();
BOOL IsHost();
// Raw packet I/O (called by decnet.cpp each tick)
BOOL Send(LPVOID lpData, DWORD dwDataSize, DWORD dwFlags);
BOOL Receive(LPVOID pDest, DWORD dwDataSize, LPDWORD lpdwPlayer);
NetPlayer Struct
Tracks one remote player's connection state, stored in m_players[MAXNETPLAYER]:
typedef struct {
char bIsPresent; // slot occupied
char ready; // player ready to start
char unk_2;
char unk_3;
DPID dpid; // DirectPlay player ID
short team;
char name[22]; // player name string
} NetPlayer;
Packet Types (PK_*)
| Constant | Value | Description |
|---|---|---|
PK_LEAVE | 8 | Player left the session |
PK_LOST | 9 | Player lost (game over) |
PK_DIE | 10 | Player died |
PK_PAUSE | 12 | Game pause toggled |
In-Game Synchronization
Actual in-game synchronization is implemented in src/decnet.cpp, which is
part of the CDecor class. Each game tick, every player sends a
NetPacket containing their current input, position, animation state,
and up to 5 NetMessage game events.
See Network System for the full packet structure,
MESS_* constants, and personal bomb types.
See Data Structures for
the NetPacket and NetMessage struct layouts.
Session Limits
| Constant | Value | Description |
|---|---|---|
MAXNETPLAYER | 4 | Maximum simultaneous network players |
MAXTEAM | 4 | Maximum teams |
MAXSESSION | 100 | Max sessions shown in browser UI |
MAXNETMESSAGE | 20 | Max pending network messages |
MAXMESSAGEPERPACKET | 5 | Max game events per packet |