← Code Exchange

Temporal Trivia

An incredibly durable game of multi-player trivia, powered by Temporal. Showcases a human-in-the-loop workflow that uses GenAI for trivia Q&A generation, and workflows to maintain and control the state of the game.


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


Language

Go
💖 Community fungameai

About the Author

Professional man with glasses and beard wearing black suit jacket and red shirt, smiling at camera in modern office setting

Keith Tenzer

Solutions Architect

Professional headshot of a person with short brown hair wearing a blue collared shirt and pearl earrings against a blurred background.

Ci-Ci Thomson

Solutions Architect

Professional headshot of an Asian man wearing black-framed glasses and a gray jacket over a white shirt against a light background.

Anthony Wong

Senior Solutions Architect

Temporal