5 minutes
A poker table needs two things before any card is dealt. It needs chips, and it needs a way to track whose turn it is. So we start there. PokerBetting handles both jobs. It keeps track of the chips, and it is the state machine that moves around the table and stops on you. The rest of the game is built on top of it.

How to pick the build order
This game is made of fourteen components. We don't pick the build order by feel. Each component lists two things in its meta.json file. It lists the components it depends on. It also lists the events it emits and listens for. We sort by those two things:
- A component comes after everything in its
dependencies. It also comes after every component whose events itlistensfor. - So a component with no dependencies that emits events others wait on comes early.
- The director depends on all of them and connects every event. So it comes last.
When you run that sort, PokerBetting comes first among the game pieces. It has zero dependencies. It never imports the deck, the cards, or an opponent. But it emits the turn, action, and chip events. The HUD, the keyboard, the pacer, and all three AIs listen for those events. So you build the thing everyone needs first. Then you build the things that depend on it. You can use this same sort on any library game to find its build order.
There is one exception at the end of this lesson. The HUD is a view with no dependencies. We add it early so you can watch the money move.
Continue reading
Unlock the Full Course
Every lesson, the runnable examples, and the finished build — yours to keep.