← Code Exchange

Temporal Trivia

A trivia game built durably on Temporal. This multi-user trivia-game was demoed at Replay 2023 to show off Multi-Region Namespaces. It is a very unique use of Temporal that uses GenAI and workflows to maintain and control the state of the trivia-game.

Players can create or join a game. Category, number of players, number of questions and even a challenge mode are all configurable. Once the game starts, players are presented with questions and multiple choice answers (generated by ChatGPT). They submit their answers and results are shown including a final score once the game completes.

This demo primarily shows a fun way to see the human interaction features of Temporal, demonstrating developer velocity by delivering a lot of scalability and features by leveraging Temporal features.

Our design goals:

  • Scale to millions of users
  • Support multiplayer and unlimited number of games
  • Build using polyglot
  • Maintain game state and durability when things break
  • Timeout mechanism for questions
  • Single source of truth for game logic
  • Do it all in a few hundred lines of code!

Problems Solved:

  • State Management
  • Entity Pattern (Player/Game)
  • Controller (Game Loop)
  • Durability

Workflow Design

Temporal Trivia Workflow Design

💖 Community fungameai

About the Author

Keith Tenzer Headshot

Keith Tenzer

Solutions Architect

Ci-Ci Thomson

Ci-Ci Thomson

Solutions Architect

Anthony Wong Photo

Anthony Wong

Senior Solutions Architect

Temporal