Build Your Own AI‑Powered Quiz Game with Google Assistant and Firebase

Google has open‑sourced a complete AI quiz‑game framework that lets developers create voice‑interactive trivia apps for Google Assistant, Android, iOS and smart speakers using API.AI, Cloud Functions, and Firebase with minimal effort.

21CTO
21CTO
21CTO
Build Your Own AI‑Powered Quiz Game with Google Assistant and Firebase

Resource Pack

This open‑source quiz‑game system includes all features developers need and is fully customizable.

API.AI: import your own agent to handle natural‑language understanding.

Complete game flow implementation logic.

Three characters: Teacher, Queen, Robot, with 750 unique lines designed by Google VUI team.

Lines are grouped into 44 categories such as greetings, correct‑answer responses, help prompts, etc.

Audio tracks for each character (opening music, correct/incorrect sounds, calculation sounds, final round sounds) – 43 distinct sound files stored as OGG/WAV.

Basic Principles

The quiz logic runs on Cloud Functions for Firebase, the simplest way to deploy game logic according to Google.

Cloud Functions for Firebase offers a free tier, allowing developers to quickly create their own quiz games.

When a user starts the quiz, Google Assistant loads the program, uses API.AI to process intents, and then triggers the Cloud Functions implementation.

The "game.choice.answer" intent handles answers using an "answer" entity.

Questions and answers are stored in Firebase Realtime Database as JSON; the logic is written in Node.js, and the Actions on Google client library also supports Node.js.

The implementation provides handlers for all intents defined in the API.AI agent.

The app uses Firebase Hosting to serve audio resources.

Create a Personalized Game

Use a Node.js script to load questions and answers into the database: edit a questions.json file and run the script, or edit directly via Firebase’s web console.

Then choose a character; for example, the Queen.

After configuring the selected character in code, the corresponding lines are set; the Queen may say “Look! A winner” or “A brave attempt, but useless”.

In the Actions Console (https://console.actions.google.com/) create a project and link it to API.AI. Import TriviaGame.zip to obtain all intents.

Deploy the logic with the Firebase CLI to get a hosted URL.

Point the API.AI agent URL to the Cloud Function and test with the Actions on Google web simulator.

When satisfied, submit the game for review via the Actions Console.

Start Playing

In short, creating a quiz game for Google Assistant is now extremely easy. Google provides sample games such as “Talk with the US President”, “Guess the Founder”, and “Chatting with Seven of Nine Trivia”.

Even if you don’t want to develop a quiz game, you can reuse the design and resources from this open‑source system.

Related Links

GitHub repository:

https://github.com/actions-on-google/apiai-trivia-game-nodejs

Quiz game template:

https://triviatemplate.com/

Source: 量子位
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Cloud Functionsvoice interactionfirebaseGoogle AssistantAI Quiz GameDialogflow
21CTO
Written by

21CTO

21CTO (21CTO.com) offers developers community, training, and services, making it your go‑to learning and service platform.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.