Raise online play to 16-player lobbies and 8-player games

Lobbies hold 16 players and the sandbox 16 fighters, games up to 8. The arena
gets spawns 5-8 (outer ledges and middle platforms) and the race start eight
places. The sandbox adds eight more spawns, each the open spot farthest from
the rest. Rival cards wrap into rows of four, the lobby's player list goes to
two tiny columns when crowded, and the server keeps frame packets to one
datagram. Formatted with clang-format.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shweetandClaude Opus 5.5 committed 2026-11-08 02:33:20 -05:00
1 parent 56af1c357c
commit 6003175173
19 files changed
+247 -140

No files matched your search

+19 -10
View File
@@ -23,6 +23,7 @@ constexpr float HUD_HOVER_FADE = 0.15f;
constexpr float RIVAL_PADDING = 2;
constexpr int RIVAL_COLUMNS_MAX = 3;
constexpr int RIVAL_FULL_SLOTS = 4;
constexpr int RIVALS_PER_ROW = 4;
constexpr float COOLDOWN_SLOTS = 2;
constexpr float MINI_ICON_SCALE = 0.5f;
constexpr float MINI_SLOT = 16;
@@ -490,7 +491,8 @@ void Ui::race_draw(Game& game)
for (int i = 0; i < game.sim.fighterCount; i++)
{
Fighter& fighter = game.sim.fighters[i];
float progress = game.sim.match.finishTimes[i] >= 0 ? 1 : std::clamp(fighter.center_get().x / length, 0.0f, 1.0f);
float progress =
game.sim.match.finishTimes[i] >= 0 ? 1 : std::clamp(fighter.center_get().x / length, 0.0f, 1.0f);
float x = std::round(left + progress * TRACK_WIDTH - TRACK_DOT / 2);
Rect dot = {x, std::round(y - TRACK_DOT / 2), TRACK_DOT, TRACK_DOT};
game.renderer.rect_draw(dot, game.color_get(i));
@@ -2192,11 +2194,12 @@ void Ui::spectate_draw(Game& game)
text_center_draw(game, text, y + LINE_HEIGHT, 1, shade);
}
// Lays out the other fighters' windows in a row along the bottom right, never left of the screen's middle (nor over the
// local hotbar and cooldowns). A window is as wide as its icon row, but no wider than one holding two weapons and two
// trinkets at full size: past that, or when the row doesn't fit, icons shrink to small, then tiny. Each kind wraps onto
// more rows past three across, and tiny icons wrap further if they still don't fit. Names and health use the small
// font, or the tiny one for every window if any doesn't fit.
// Lays out the other fighters' windows in rows of up to four along the bottom right (more rows stacking upwards, as
// even as they go), never left of the screen's middle (nor over the local hotbar and cooldowns). A window is as wide as
// its icon row, but no wider than one holding two weapons and two trinkets at full size: past that, or when the row
// doesn't fit, icons shrink to small, then tiny. Each kind wraps onto more rows past three across, and tiny icons wrap
// further if they still don't fit. Names and health use the small font, or the tiny one for every window if any doesn't
// fit.
RivalLayout Ui::rivals_layout(Game& game)
{
RivalLayout layout;
@@ -2212,6 +2215,8 @@ RivalLayout Ui::rivals_layout(Game& game)
}
if (layout.count == 0)
return layout;
int cardRows = (layout.count + RIVALS_PER_ROW - 1) / RIVALS_PER_ROW;
int perRow = (layout.count + cardRows - 1) / cardRows;
float step = SLOT_SIZE + SLOT_GAP;
float left =
@@ -2241,7 +2246,7 @@ RivalLayout Ui::rivals_layout(Game& game)
width = std::ceil(std::max(icons, minimum));
layout.size = (IconSize)size;
layout.rows = rows;
bool isFit = icons <= widthMax && layout.count * width + (layout.count - 1) * RIVAL_GAP <= room;
bool isFit = icons <= widthMax && perRow * width + (perRow - 1) * RIVAL_GAP <= room;
if (isFit)
size = ICON_SIZE_COUNT;
if (size == ICON_SIZE_COUNT)
@@ -2261,10 +2266,14 @@ RivalLayout Ui::rivals_layout(Game& game)
float healthHeight = game.sim.match.is_racing() ? 0 : layout.line + RIVAL_PADDING;
float icons = layout.rows * (ICON_PIXELS[layout.size] + RIVAL_ICON_GAP) - RIVAL_ICON_GAP;
float height = inset + layout.line + RIVAL_PADDING + healthHeight + icons + inset;
float x = CANVAS_WIDTH - HOTBAR_MARGIN - layout.count * width - (layout.count - 1) * RIVAL_GAP;
for (int k = 0; k < layout.count; k++)
layout.cards[k] = {std::round(x + k * (width + RIVAL_GAP)), CANVAS_HEIGHT - HOTBAR_MARGIN - height, width,
height};
{
int row = k / perRow;
int inRow = std::min(perRow, layout.count - row * perRow);
float x = CANVAS_WIDTH - HOTBAR_MARGIN - inRow * width - (inRow - 1) * RIVAL_GAP;
float y = CANVAS_HEIGHT - HOTBAR_MARGIN - height - row * (height + RIVAL_GAP);
layout.cards[k] = {std::round(x + (k % perRow) * (width + RIVAL_GAP)), y, width, height};
}
return layout;
}