Skip to content

The Sharing Tab#5704

Draft
keithharvey wants to merge 6 commits into
beyond-all-reason:masterfrom
keithharvey:sharing_tab
Draft

The Sharing Tab#5704
keithharvey wants to merge 6 commits into
beyond-all-reason:masterfrom
keithharvey:sharing_tab

Conversation

@keithharvey

@keithharvey keithharvey commented Aug 19, 2025

Copy link
Copy Markdown
Collaborator

Related work

📚 Stacked split— review bottom-up

Each PR merges into the one below it; together they reproduce the sharing_tab branch (bar one intentional change — index.lua lazy-loads the mode helpers).

The idea

Full architecture & rationale — controllers, policies, the Waterfill solver, and the policy DSL it unlocks — is written up in Beyond-All-Reason#8018: Game Controllers & Policies. Short version:

The engine stops being the economy authority and becomes the economy data plane for team redistribution. It keeps measuring (income, pull, expense, per-frame excess) and exposes that state through an API. A registered synced-Lua controller pulls a snapshot on its own cadence, runs redistribution, and writes back its own economy stats directly. Unit transfers, team giveaways (GiveEverythingTo), and /take are replaced by game-side gadgets; native overflow sharing is the one piece behind a flag — nativeExcessSharing = false hands it to the Lua controller.

On top of that boundary, sharing is configured by modes — named presets that set, lock, and hide the individual modoptions. The lobby (Chobby) presents them; the game enforces them. Each modoption stays cardinal (one knob, one behavior) so modes compose them freely.

Modes

Enabled (default) — all sharing on, no tax. Today's game, unchanged.
image

Disabled — no unit or resource sharing
image

Easy Tax — anti-co-op preset. Taxes resource sharing, assist, and resurrection; gifted eco buildings are stunned and mobile constructors build-delayed, so you can't dodge the tax by handing over production. /take runs on a stun delay.
image

Tech Core — tech levels gate what you can build; you raise your level by constructing Keystone buildings. Unit sharing and resource tax both scale with tier (e.g. constructors become shareable at T2; tax eases as you climb). /take runs on a 60s delay for Resource buildings (the Take Delay Category in the screenshot below).
image

Customize — every knob editable; roll your own policy.

Note: This is the one mode that preserves the previous mode's values when switching to it, so you can switch from tech core to customize and customize will behave exactly like tech core.

For players and mode developers, Customize provides a lot of benefits for this design:

  1. Removes a lot of complexity from the other modes, allowing us to hide/lock the opinionated mode without impacting customization of any new capabilities those modes may bring to the table.
  2. Lets people roll their own fully customizable mode, if they want.
  3. Gives us all the knobs needed to prove that each diverse mod option is actually orthogonal during testing.
  4. Lets users intuitively understand how this works under the covers and that the individual mod options are the implementation details for each top-level mode.
image

Other changes

  • Geo/Mex upgrades fixed (credit Hobo): the unit-sharing filter now lets "Utility" (resource) buildings transfer, so you can upgrade an ally's mex. Could become its own toggle later (Try to merge master into gl4cus #1040), out of scope here.
  • /take moved into the game (was engine-native), which is what enables the delay/category take modes above.
  • Invalid-unit feedback: units a mode disallows show in tooltips and highlight when you hover an ally in the player list.

Demos

LLM usage

Tons of AI usage, but this started on much earlier models so I really had to beat it into shape and the code is clearly my style of decompositional functional programming, and that doesn't happen accidentally.

@keithharvey keithharvey force-pushed the sharing_tab branch 2 times, most recently from 42072dd to 6eca7f7 Compare August 20, 2025 00:05
@keithharvey keithharvey force-pushed the sharing_tab branch 3 times, most recently from 6c721e6 to 1069815 Compare August 24, 2025 06:40
@keithharvey keithharvey marked this pull request as draft October 6, 2025 23:12
@keithharvey

keithharvey commented Oct 6, 2025

Copy link
Copy Markdown
Collaborator Author

I'm going to move this one back to draft because in a downstream branch I moved all of this to lua and simplified some things to make testing sharing_modes easier. Will backport isolated bits of that PR if it fails to merge. That approach has some downsides (like a lack of a schema validation in the CI), but those are compensated for with types and specs.

@keithharvey keithharvey changed the title Add declarative sharing modes system Add The Sharing Tab Oct 24, 2025
@keithharvey keithharvey changed the title Add The Sharing Tab he Sharing Tab Oct 24, 2025
@keithharvey keithharvey changed the title he Sharing Tab The Sharing Tab Oct 24, 2025
@keithharvey keithharvey marked this pull request as ready for review October 24, 2025 05:17
@keithharvey keithharvey marked this pull request as draft October 25, 2025 18:04
@github-actions

github-actions Bot commented Nov 5, 2025

Copy link
Copy Markdown
Contributor

Test Results

20 tests  +4   10 ✅ +3   17s ⏱️ +14s
 1 suites ±0    9 💤 ±0 
 1 files   ±0    1 ❌ +1 

For more details on these failures, see this check.

Results for commit ce774d4. ± Comparison against base commit cf64f44.

♻️ This comment has been updated with latest results.

@keithharvey keithharvey force-pushed the sharing_tab branch 9 times, most recently from c819af1 to a29702b Compare November 11, 2025 00:57
@keithharvey keithharvey force-pushed the sharing_tab branch 5 times, most recently from 273e15a to 461310e Compare March 14, 2026 09:10
@github-actions

github-actions Bot commented Mar 19, 2026

Copy link
Copy Markdown
Contributor

Integration Test Results

18 tests  +4   9 ✅ +3   20s ⏱️ +17s
 1 suites ±0   8 💤 ±0 
 1 files   ±0   1 ❌ +1 

For more details on these failures, see this check.

Results for commit 53d8685. ± Comparison against base commit 7403bb8.

♻️ This comment has been updated with latest results.

@Jinxer128

Copy link
Copy Markdown

Taking is not supported, regardless of whether sharing is enabled or not.
Sending resources doesn't cost any resources, both when taxes are on or off.
Sharing slider bar doesn't continually update with the teammate's available storage.

@keithharvey

Copy link
Copy Markdown
Collaborator Author

@Jinxer128 should be sorted. Tried an ambitious refactor and it didn't work out. Went back to the known-working solution.

@Jaedrik

Jaedrik commented Jun 24, 2026

Copy link
Copy Markdown

bugs

☑️ When using other sharing modes (not the default Enabled), Transfer units requires very inconsistent amounts of clicks on the ui (rather than double click as the UI indicates). Sometimes, there's a transfer delay even after successful double click.
☑️ Transfer units chat message has the wrong color of the target teammate.
☑️ When Tech Core is enabled, box select doesn't discriminate between constructors and fighting units like the base game does and instead grabs all of them.

ts fixed good jqob 👍

@keithharvey

keithharvey commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator Author

To test SPADS locally, from BAR-Devtools, check out the fix_wsl branch and run:

just chobby::dev-mode on
just chobby::server local
just spads::export-modes
just services::up

just bar::launch

# get a regular user to login with the default password to join the lobby so votes trigger
just tei::add-user bob
just tei::join-battle bob

The repos.local.conf to test this from BAR-Devtools:

cat > repos.local.conf <<'EOF'
@local_root ~/code

bar_debug_launcher  https://github.com/keithharvey/bar_debug_launcher.git cli
RecoilEngine        https://github.com/keithharvey/RecoilEngine.git resource-excess-callin-stats
BYAR-Chobby         https://github.com/keithharvey/BYAR-Chobby.git sharing_tab
Beyond-All-Reason   https://github.com/keithharvey/bar.git sharing_tab
EOF

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants