logo

Babylon.js Market

PokerAISurge

tabletop-casino · poker-ai

PokerAISurge

1
Surge the Loose CannonBonus figureSurge the Loose Cannon
Unlock

Install with the CLI:

bjs download PokerAISurge

PokerAISurge

The loose-aggressive poker personality — bets and raises wide, bluffs often, and leans into pressure instead of away from it.

What it does

surge is one concrete NpcStrategy callback the betting director can drop onto a seat. It reads the same numbers every poker brain reads — starting-hand tier pre-flop, made-hand equity post-flop, weighted action choice — from the PokerAI substrate, then tilts every marginal decision toward aggression.

Two table reads scale that tilt into one boost:

  • Position. Acting late in the round — roundActions.length >= activePlayers / 2, so half the table has already acted — is worth a fixed 0.15, since others' actions are cheap information.
  • Pressure. A pot larger than half this seat's stack (pot / playerStack > 0.5) is worth another 0.15. The more chips on the line, the harder Surge pushes. A zero stack reads as no pressure rather than dividing by zero.

The boost lifts the raise/bet weights:

  • Pre-flop, premium and strong tiers almost always raise; a moderate tier raises ~60% of the time (boosted) and calls otherwise; weak hands check for free or split call/fold; trash checks for free, folds to a bet.
  • Post-flop, a TwoPair-or-better (equity ≥ 0.50) always value-raises; a single pair (equity ≥ 0.30) semi-bluffs raise/call; air (equity < 0.30) bluff-raises about a quarter of the time and checks or folds the rest.

The decision is stateless — no memory between hands, so the same context and the same rng always return the same action. The only randomness is the weighted draw, and its generator is injected.

Use it in a scene

A scene is just data — a list of entities, each with its components. At startup the SceneLoader turns this JSON into a live world; edit the file and reload to rebuild it.

Fastest path

bjs download scene PokerAISurge

Pulls this exact scene into your project and runs it — no copy-paste. Add --all to grab the components and assets it needs too.

Or build it from scratch with the bjs CLI:

  1. 1Scaffold a project
    npm create @babylonjsmarket/arcade@latest my-game

    World, renderer, and dev server — ready to run.

  2. 2Install dependencies
    cd my-game && npm install
  3. 3Add PokerAISurge
    bjs download PokerAISurge

    Copies its source into src/ so the scene resolves.

    First time? Run bjs login once.

  4. 4Paste the scene into src/scenes/arcade-room.ts and run
    npm run dev

    SceneLoader builds the world from the JSON; reload to rebuild.

JSON
{
  "Surge": {
    "components": {
      "PokerAISurge": {
        "seatIds": ["npc0", "npc1"]
      }
    }
  }
}

PokerAISurgeSystem registers the surge callback into the PokerBetting director's per-seat strategy table on init, and again whenever a brain or director enters the world, so scene attachment order doesn't matter. With an empty seatIds, it claims every NPC seat (the director's non-human ids). On the next deal, PokerBetting hands Surge the action menu for each owned seat.

Or import the callback and call it directly to seed a deterministic table:

TypeScript
import { makeSurge } from './PokerAISurge'

const seeded = makeSurge(makeSeededRng(42))
const action = seeded('npc0', availableActions, context)

Props

PropTypeDefaultMeaning
seatIdsstring[][]Seats this personality plays. Empty means every NPC seat the director offers.

The System also carries an rng field (default Math.random) — set it to a seeded generator to pin the weighted draws.

Events

None. Surge is a strategy callback the director invokes, not an event emitter. It writes its reasoning ({ hand, tier | equity, notes }) onto the NpcContext passed in, for a HUD to read; the notes record which boosts fired (late pos, pressure↑) and the line taken (value raise, semi-bluff, bluff, free check).

Dependencies

  • PokerAI — supplies classifyStartingHand, estimateEquity, pickAction, weightedPick, and shortHand, plus the re-exported ActionType / NpcContext / NpcStrategy vocabulary.
  • PokerBetting — owns the strategy table Surge registers into and the action menu it answers.
  • PokerHandEval — the evaluator equity reads through (via PokerAI).

Notes

  • One Surge brain per table: the System binds the first entity carrying a PokerAISurge instance to the first active PokerBetting director.
  • Registration overwrites the same strategy entries each time it runs, so re-registering is harmless.
  • With no context on the menu, surge falls back to a uniform random pick over the available actions — a legal action even before the director wires a table snapshot.
  • Mix personalities by giving each its own seat list: one PokerAISurge on ["npc0"] and a different brain on ["npc1"] populate distinct entries in the one strategy table.

More like this

PokerAI
PokerBetting
PokerHandEval
AIGoalSeek
AIKick
AIZone
AiPilot
BallPossession
BallPursuit
CardFan
DeckDealer
Enemy
EnemySpawner
FreighterChain
LineOfSight
PokerAIBill
PokerAICali
PokerAIRandy
PokerAIShark
PokerAITilt
PokerHUD
PokerInput
PokerMultiplayer
PokerSeating
PokerTableCards
PokerTableDirector
TurnPacer
WaveDirector

Was this page helpful?

We read every note — tell us what's working and what isn't.

↑↓ NavigateEnter SelectEsc CloseCtrl+K Open Search