Enable BARONY_SUPER_MULTIPLAYER and remove remaining 4-player assumptions#940
Enable BARONY_SUPER_MULTIPLAYER and remove remaining 4-player assumptions#940sayhiben wants to merge 101 commits intoTurningWheel:masterfrom
Conversation
Added a section about the mod's purpose and status.
This change cleans up the 8-player branch for upstream review by removing hardcoded
8-slot switch blocks, documenting/standardizing player theme reuse behavior, and
consolidating repeated player-slot validity checks.
Player mapping and list cleanup
- Replace repeated switch statements with MAXPLAYERS-driven mapping tables in:
- src/actplayer.cpp (ghost model selection)
- src/interface/interface.cpp (world icon palette)
- src/interface/playerinventory.cpp (loot bag image selection)
- src/ui/GameUI.cpp (XP bar theme selection)
- Preserve legacy ordering for early players while making overflow behavior explicit
and consistent for higher indices.
- Add comments that explain why repeats begin at the first overflow slot and how the
fallback/cycle works when art/theme variants are limited.
Network and player-slot validation cleanup
- Introduce small local helpers to centralize player-slot validation where we had
repeated ad-hoc checks:
- src/interface/drawstatus.cpp
- src/entity.cpp
- src/net.cpp
- Remove redundant conditional checks in net message paths after introducing shared
validation helpers.
- Keep behavioral guards intact while making intent clearer (local-only UI state vs
remote packet forwarding, connected/usable slot checks, etc.).
UI and readability fixes
- src/ui/MainMenu.cpp
- Normalize indentation in touched lobby helper blocks.
- Shorten the experimental >4 players warning prompt lines to avoid dialog
formatting issues.
- Auto-focus the ready-up page based on joining player index so players >= 4 land
on the correct page.
- Adjust paperdoll paging bounds to avoid left-edge clipping during page animation.
- Improve lobby browser player-count rendering: keep icon variants for 0-4 players
and switch to "X/MAXPLAYERS" text when the lobby exceeds 4 players.
- Add clarifying comment for fixed 2x2 save thumbnail layout break condition.
- src/player.cpp
- Clean up indentation/formatting in getAccountName() and extract direct-connect
name selection into a clearer helper.
Build system cleanup (macOS)
- src/CMakeLists.txt
- Use find_package(PNG REQUIRED) on macOS as well.
- Remove direct inclusion/linking of a repo-staged libpng16.16.dylib for barony
and editor targets.
- Link PNG via ${PNG_LIBRARY} and include ${PNG_INCLUDE_DIR} consistently across
platforms.
Validation
- cmake -S . -B build-mac
- cmake --build build-mac -j8
Refactor 8p player mapping logic and clean macOS PNG linking
Replace TOOL_PLAYER_LOOT_BAG switch-based player mapping in src/items.cpp with MAXPLAYERS-driven lookup tables that preserve the legacy ordering and overflow cycling behavior.\n\nSimplify serverUpdatePlayerSummonStrength() in src/net.cpp by removing a redundant explicit MAXPLAYERS guard now covered by hasUsablePlayerSlot().\n\nRestore README.md to upstream content so the 8-player branch header is not included in the upstream PR diff.
|
@WALLOFJUSTICE @SheridanR - Hey, so I bought this game for a group of friends, but we usually end up having 5p for game night lately. I found the linked attempts to expand to 8p and ran with them. I tried to find everything with lists of players or max player assumptions and then adapt without changing 1-4p. It's not a small change, but it feels fairly cohesive to me, and I think it would be cool to see more 5+ player groups get to play Barony. Happy to change whatever. This is hard for me to test, but maybe y'all have some suggestions. Thanks! |
|
I messaged the Barony community discord about this and immediately got an ask for 12p support, so I'm bumping the max to 16p and making some adjustments. Will add some more commits today, but the general approach won't change, so feel free to review whenever you get the itch |
|
Just a quick update here - I'm going through and doing a balancing/tuning pass, then I'll wrap around and do some code cleanup. There are a large number of added lines at the moment due mostly to automated testing harnesses that I'll remove or pull into a separate PR in case anyone finds them useful. I'll also aim to split this into bite-sized PRs in the long run to remove 4p-max assumptions from the main build and slowly move closer to this full support implementation In the meantime, I plan to use this branch to update CrabNicholson-Ba/Barony-8-Player and the associated Steam Workshop "mod" so that we can get extended multiplayer back into the hands of players who are willing to install the alternate binaries |
* offhand items with no AC dont add to AC effectiveness * debug doors check key locks * map hash update * remove double sfx deface spell
* ensemble channels configure at end of game files loading
Signed-off-by: SheridanR <sheridan.rathbun@gmail.com>
Summary
This PR re-enables
BARONY_SUPER_MULTIPLAYERand removes remaining hardcoded 4-player assumptions in multiplayer-facing systems, while preserving existing 1–4 player behavior where possible.Goal: make 4+ player lobbies practical and upstream-reviewable without changing core gameplay intent for current 4-player flows.
Prior work and borrowed approaches
Make BARONY_SUPER_MULTIPLAYER functional)MAXPLAYERSHELO payloads.lobbyPlayerJoinRequest(... lockedSlots[MAXPLAYERS])direction for join-slot handling.master(24 commits / 8 files in the compare snapshot)BARONY_SUPER_MULTIPLAYERthrough build/config wiring (CMake + platform project defines).MAXPLAYERSlogic in touched networking/UI/save-load paths.What Changed
Build and config
BARONY_SUPER_MULTIPLAYERoption/define wiring across build configs.NET_PACKET_SIZEto2048.chunk_size = 6 + 32 + 6 * 10):static_assert(8 + MAXPLAYERS * chunk_size <= NET_PACKET_SIZE).chunk_size = 6 + 32):static_assert(8 + MAXPLAYERS * chunk_size <= NET_PACKET_SIZE).find_package(PNG REQUIRED)instead of a repo-staged dylib.Shared player-slot mapping
Networking and slot safety
MAXPLAYERSin touched networking paths.lockedSlots[MAXPLAYERS].Lobby/UI updates for >4 players
Kickconfirmation button.# Playersto avoid overflow in the lobby settings card.REDYpackets.Page X/YJoined: I/Total PlayersX/MAXPLAYERS) when icon variants run out.+Nwhen additional players are connected.Overflow-player gameplay scaling (>4 players)
Save/load and local constraints
players_connected.MAX_SPLITSCREEN(4) while keepingMAXPLAYERSarray handling safe.GameUI status-effect queue initialization
StatusEffectQueuearray initialization with dynamic initialization based onMAXPLAYERS.Validation
I made these changes on a Macbook, so apply whatever build process you usually use. Mine's:
cmake -S . -B build-maccmake --build build-mac -j8Then, try manual smoke checks on touched lobby/ready/state-sync/player-index mapping flows.
Helpful testing script
Things to test manually with 5p+
# Playerssettings label + dropdown layout does not overflow the settings card.Page X/YandJoined: I/Total Playersremain visible and correct regardless of current page.X/MAXPLAYERStext for >4 players.Player 5,Player 6, etc.).+N) as expected.players_connecteddata and verify continue-card rendering stays sane./splitscreenwith values above 4 and verify it caps toMAX_SPLITSCREENwithout affectingMAXPLAYERSsafety.Checked items above are backed by smoke artifacts captured on February 10, 2026 and tracked in
docs/multiplayer-expansion-verification-plan.md(notably:tests/smoke/artifacts/churn-ready-sync-20260209-212709-p8-c3x2-r2,tests/smoke/artifacts/churn-ready-sync-20260209-213532-p16-c3x4,tests/smoke/artifacts/account-label-coverage-20260209-223536-p8-r5,tests/smoke/artifacts/account-label-coverage-20260209-223827-p16-r1,tests/smoke/artifacts/mapgen-full-v2-complete,tests/smoke/artifacts/churn-20260209-174003-p8-c5x2).Known limitations
5+ player mode remains experimental and may desync (though, perhaps less so with this PR); lobby flow now warns before enabling it.