Start

v3 · Preview

Framework v3 is an opt-in preview available to everyone. New games use the stable framework by default.

Build a game

Follow these steps in order.

Read How a game works first. It defines the words these steps use: seat, view, offer, intent, step, decision, draft, reveal.

1. Create the game

Call create_game with frameworkMajor: 3. Pass the new gameDefinitionId to every docs call from now on, so you get these sections.

The new game starts as Hexbloom, a two-player card game with hidden hands, secret goals, bots and a responsive client. Read /src/README.md for its source map. /src/lib.rs holds the game functions, and /src/frontend.tsx composes the client.

2. Read the seed

Call get_example with name: "hexbloom" for the guide and file list. Pass a listed path, such as /src/turn.rs or /src/transitions.ts, to read one file.

Use Hexbloom for how the parts connect. Choose your game's own decisions, hidden information, board shape and look.

3. Model the state

Map the design onto the state: one space for each area of the board, hand, deck or pile, one piece for each card, token or tile, and maps for the rest. List the spaces, pieces and maps each rule reads.

Give each space and piece its owner. Ownership decides who sees its private parts.

References: The state, Hidden information.

4. Write setup and the offers

Write setup (Set up a game). Then write offers: for every situation, every legal move of the seat, each with its intent. A move that needs several values is several steps, one value each.

Keep both rules of Intents. Mark each reveal with .revealing().

References: The game functions, Offers, intents and decisions.

5. Write the moves, the scores and the end

Write apply_action, scores and is_game_over. Change the state only through Table. Write each step's log lines with table.log.

Replace the seed's Hexbloom tests in /src/tests.rs with a #[test] for each rule you write. Rewrite or remove the seed's bots in /src/bots.rs (Bots).

Run validate_code until it answers no errors and its tests counts a passed test for each rule. The error codes are in Builds, limits and errors.

Then play a session with start_game and apply_action at each seat count the game allows. Play each session to the end of the game.

References: Changing the state, Randomness and determinism, Testing a game, Playing a session.

6. Write the client

Change /src/frontend.tsx to draw this game's board, offers, draft, undo, failures and scores, and its end.

Follow What the client must draw, Client structure and Layout.

Run validate_code until it answers valid: true. Run the client checks. Then call commit.

References: The React client, Step time, boardweaver/react reference.

7. Play it

Ask a person to play the game on its beta channel, which plays the newest commit. Follow Playing on the beta channel.

8. Add the pages and the theme

Write the rules pages, the marketing page and the theme. Run validate_code until it answers valid: true, then call commit.

References: Write the rules pages, Write the marketing page, Design the theme.

Need a hand with this?

Join our Discord