Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions games/alan/roulette/game.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,15 @@ func (Game) Meta() kit.GameMeta {
MaxPlayers: 6,
Tags: []string{"roulette", "casino", "betting", "american"},

// Player characters: each player's tile renders beside their name in
// the seat strip under the table.
CtxFeatures: kit.CtxFeatCharacter,
// A casino game: players wager their account-wide platform Credits. The
// richest wager is a straight-up (35:1), so a winning stake returns
// stake*(35+1) = stake*36 and no board can pay more than 36x its stake.
Kind: kit.GameKindCasino,
MaxPayoutMultiplier: 36,

// Player characters (seat tiles) + Credits (the host owns every balance;
// this game calls Wager/Settle/Buyback/Balance).
CtxFeatures: kit.CtxFeatCharacter | kit.CtxFeatCredits,

// A casual social table: when everyone leaves, the room closes — no
// hibernation snapshot, no Resume-menu entry.
Expand All @@ -31,7 +37,7 @@ func (Game) Meta() kit.GameMeta {
PrivateInviteLine: "Friends pull up a chair when they enter the code.",

Leaderboard: &kit.LeaderboardSpec{
MetricLabel: "Chips",
MetricLabel: "Credits",
Direction: kit.HigherBetter,
Aggregation: kit.BestResult,
Format: kit.Integer,
Expand Down
2 changes: 1 addition & 1 deletion games/alan/roulette/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module alan/roulette

go 1.25.11

require github.com/shellcade/kit/v2 v2.15.0
require github.com/shellcade/kit/v2 v2.16.0

require (
github.com/extism/go-pdk v1.1.3 // indirect
Expand Down
4 changes: 2 additions & 2 deletions games/alan/roulette/go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
github.com/extism/go-pdk v1.1.3 h1:hfViMPWrqjN6u67cIYRALZTZLk/enSPpNKa+rZ9X2SQ=
github.com/extism/go-pdk v1.1.3/go.mod h1:Gz+LIU/YCKnKXhgge8yo5Yu1F/lbv7KtKFkiCSzW/P4=
github.com/shellcade/kit/v2 v2.15.0 h1:/C/xsAlteeTMbJ+i+1qOcWXECeib4+dduTyPpEGq9bU=
github.com/shellcade/kit/v2 v2.15.0/go.mod h1:EYbqrycZyGxzjUnklDlKBPgU8bCftTVJFKVCw/+gvdw=
github.com/shellcade/kit/v2 v2.16.0 h1:ZU3SCkLqmJMbKqxnBMfEocYsjLiGoHaq48pWrFIkV1s=
github.com/shellcade/kit/v2 v2.16.0/go.mod h1:EYbqrycZyGxzjUnklDlKBPgU8bCftTVJFKVCw/+gvdw=
golang.org/x/sys v0.46.0 h1:noSf2Fq6F8DBgS+LysIkx7rIExoNHJsxOAtPp4rthXw=
golang.org/x/sys v0.46.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
golang.org/x/term v0.44.0 h1:0rLvDRCtNj0gZkyIXhCyOb2OAzEhLVqc4B+hrsBhrmc=
Expand Down
5 changes: 3 additions & 2 deletions games/alan/roulette/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
// deceleration, and the results hold are deadlines held in guest memory and
// landed in OnWake against CallContext time (no host timer survives a thaw);
// the spin outcome is rolled up front from the room's seeded RNG so a seeded
// room reproduces every result; and the durable bankroll uses the casino kv
// pattern (balance summed, peak max-merged) feeding a peak-ranked leaderboard.
// room reproduces every result; and bankrolls are the platform's account-wide
// Credits (the host owns every balance) — the board is wagered as one escrow per
// seat at spin lock and Settled once at payout, feeding a peak-Credits leaderboard.
//
// This is the dual-target entrypoint: `go run .` plays it in your terminal with
// normal Go tooling (and `go run . -smoke smoke.yaml -smoke-out shots/` writes
Expand Down
13 changes: 11 additions & 2 deletions games/alan/roulette/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,11 @@ func (rm *room) roundNet(pl *player) (won, staked int) {
won += settleReturn(masterBets[b.master], b.stake, rm.result)
staked += b.stake
}
// Mirror the settlement clamp so the results panel never shows a gross bigger
// than the host will actually pay (stake*maxPayoutMult).
if cap := staked * maxPayoutMult; won > cap {
won = cap
}
return won, staked
}

Expand Down Expand Up @@ -710,7 +715,7 @@ func (rm *room) drawSeats(f *kit.Frame, v kit.Player) {
nameSt.Attr |= kit.AttrBold
}
f.Text(seatsRow, x+3, name, nameSt) // name
f.Text(seatsRow+1, x+1, strconv.Itoa(pl.balance), stHead) // chips, underneath
f.Text(seatsRow+1, x+1, strconv.FormatInt(pl.bal, 10), stHead) // credits, underneath
rm.drawSeatStatus(f, seatsRow+2, x+1, pl) // status, under that
}
}
Expand Down Expand Up @@ -814,7 +819,11 @@ func (rm *room) drawHelp(f *kit.Frame, pl *player) {
f.Text(helpRow, 2, help, stDim)
}
if pl != nil {
f.TextRight(helpRow, kit.Cols-2, "BAL "+strconv.Itoa(pl.balance), stTitle)
bal := "BAL " + strconv.FormatInt(pl.bal, 10)
if rm.econOff {
bal = "CREDITS OFFLINE"
}
f.TextRight(helpRow, kit.Cols-2, bal, stTitle)
}
}

Expand Down
Loading
Loading