logo

Babylon.js Market

By Lawrence

5 minutes

The bus already tracks stacks, antes, and a pot. But the chips just pile up, and nothing decides who wins them. When betting ends, no code knows that a flush beats two pair. Nothing can break a tie between two players holding the same straight. The game moves money around, but no part of it picks a winner.

PokerHandEval is the part that picks the winner. It takes seven card ids and ranks the hands. It works with data only. It never touches the DOM or the 3D scene. It is fully deterministic, so the same cards always score the same way.

Five face-up community cards laid in a row on emerald felt with a glowing holographic readout above them highlighting the winning combination — a flush of matching suits lit in luminous gold — fainter ranked hand tiers ghosted behind, cream-white cards with crimson and gold accents on near-black, precise and dramatic.

Add PokerHandEval to the Table entity

Add PokerHandEval to the existing Table entity. It already holds PokerBetting from Lesson 2:

"Table": {
  "components": {
    "PokerBetting": { "playerIds": ["player","npc0","npc1","npc2"], "humanPlayerIds": ["player"], "startingStack": 500, "ante": 5, "minBet": 10 },
    "PokerHandEval": { "emitResults": true }
  }
}

emitResults: true makes the resolved event carry more detail. It sends the full per-seat result map, with hand names and descriptions. Without it, you only get the winner list.

Continue reading

Unlock the Full Course

Every lesson, the runnable examples, and the finished build — yours to keep.

$9one-time

Was this page helpful?

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

↑↓ NavigateEnter SelectEsc CloseCtrl+K Open Search