Files
Cesarus85--ringfall-mjolnir-vr/source/networking/network_server_message_handler.h
T
Jonas VolmanandClaude Opus 5.5 db207ea1a4 Networking: 128 players on up to 128 machines in the native builds
The Xbox game allows 16 players on 4 machines (4 split screen players
each). The native builds raise both limits to 128, keeping 4 players per
machine, and leave the byte-matching build unchanged: every change is
under HALO_LINUX (the MSVC objects compare identical).

- Limits: every local copy of the player and machine limits, and the
  bare 4s and 16s that stood for them, follow halo_port_limits.h. The
  player data array, the machine-to-player table (and its reset) and the
  per-tick update arrays grow with them.
- Records: the copies of struct network_game agree on the larger layout
  and check it against halo_port_limits.h; maximum_player_count becomes
  a byte (128 does not fit a signed char); network_player_is_valid
  checks the machine against the machine limit, not the split screen
  one; a machine's input carries MAXIMUM_LOCAL_PLAYERS actions (16/4
  would have become 128/128).
- Protocol: a message holds at most 4095 bytes (its header has a 12-bit
  length), so the 13 KB game settings record is sent in 3.5 KB pieces
  that clients reassemble; the per-tick update of 128 players (3,857
  bytes) fits. Buffers and the packet codec's limits grow to match, and
  the game search uses protocol version 2 so these builds and the Xbox
  game never see each other's games.
- Connections: the host accepts a client connection per machine (the
  split screen count stood in for it), FD_SETSIZE is 256, stream writes
  send all of a message or drop a peer that stops reading instead of
  corrupting the stream, and the input and update queues are larger.
- Host: lobby changes are sent at most every 250 ms instead of on every
  change (a full lobby would otherwise send ~650 MB), in-game joins wait
  in a queue instead of being dropped, the random name and colour
  pickers stop looping forever once names or colours run out, machines
  get 60 s to load a map, and the debug dump lists only the slots in
  use (128 empty slots took seconds to log).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-26 10:18:07 -07:00

68 lines
1.8 KiB
C

/*
NETWORK_SERVER_MESSAGE_HANDLER.H
header included in hcex build.
*/
#ifndef __NETWORK_SERVER_MESSAGE_HANDLER_H
#define __NETWORK_SERVER_MESSAGE_HANDLER_H
#pragma once
/* ---------- headers */
#include "cseries.h"
/* ---------- constants */
/* ---------- macros */
/* ---------- structures */
struct network_machine;
struct network_game_server;
struct network_game_server_client_machine;
struct network_message;
struct network_player;
struct transport_address;
/* ---------- prototypes/NETWORK_SERVER_MESSAGE_HANDLER.C */
boolean network_game_server_send_message_to_machine(
struct network_game_server *server,
struct network_machine *machine,
struct network_message *message);
boolean network_game_server_send_message_to_all_machines(
struct network_game_server *server,
struct network_message *message);
boolean network_game_server_send_player_joined_info_ingame(
struct network_game_server *server,
struct network_player *player);
boolean network_game_server_send_game_data_pregame(
struct network_game_server *server);
#ifdef HALO_LINUX
/* the native builds send the game settings record in pieces, and send pregame
changes at most four times a second */
boolean network_game_server_send_game_settings_to_all_machines(
struct network_game_server *server,
void const *game,
long game_size);
boolean network_game_server_flush_game_data_pregame(
struct network_game_server *server);
#endif
boolean network_game_server_handle_client_message(
struct network_game_server *server,
struct network_game_server_client_machine *machine,
word *message,
short message_buffer_size);
boolean network_game_server_handle_datagram(
struct network_game_server *server,
word *message,
short datagram_size,
struct transport_address *source_address);
/* ---------- globals */
/* ---------- public code */
#endif // __NETWORK_SERVER_MESSAGE_HANDLER_H