<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/how-the-google-doodle-team-used-the-realtime-database-to-build-a-multiplayer-game-dpccemunz" -->

---
title: How the Google Doodle team used the Realtime Database to...
description: The Google Doodle team built the Lotería multiplayer bingo-style game entirely on Firebase Realtime Database, letting one engineer ship it in a few months and...
canonical: https://daily.dev/posts/how-the-google-doodle-team-used-the-realtime-database-to-build-a-multiplayer-game-dpccemunz
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: How the Google Doodle team used the Realtime Database to build a multiplayer game | daily.dev
og:description: The Google Doodle team built the Lotería multiplayer bingo-style game entirely on Firebase Realtime Database, letting one engineer ship it in a few months and...
og:url: https://daily.dev/posts/how-the-google-doodle-team-used-the-realtime-database-to-build-a-multiplayer-game-dpccemunz
og:image: https://api.daily.dev/og/posts/dpCCeMUNz.png
og:image:alt: How the Google Doodle team used the Realtime Database to build a multiplayer game
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# How the Google Doodle team used the Realtime Database to build a multiplayer game

**[Firebase](https://daily.dev/sources/firebase-blog)** · 5 min read · 0 upvotes · 0 comments

## Summary

The Google Doodle team built the Lotería multiplayer bingo-style game entirely on Firebase Realtime Database, letting one engineer ship it in a few months and scale from zero to millions of players overnight. The post explains how dealer logic and win detection use realtime database listeners and transactions to avoid race conditions, how Cloud Functions power matchmaking by pooling players from a queue into game rooms atomically, and how the team sharded the database into multiple instances with a manually adjustable 'shards' value to handle unpredictable traffic spikes during the Doodle's short-lived homepage placement.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://firebase.blog/posts/2020/01/google-loteria-realtime-database>

## Questions this post answers

### How do you prevent multiple players from being declared the winner at the same time in a realtime multiplayer game?

Use a database transaction that checks whether the winner location already has a value before writing to it. In the Lotería Google Doodle game, players wrote their ID to /games/{gameId}/winner only if no value existed yet, using Firebase Realtime Database's Reference.transaction to atomically resolve close ties between simultaneous winner claims.

_daily.dev surfaces realtime database patterns like this for developers building competitive multiplayer features._

### How do you handle sudden massive traffic spikes with Firebase Realtime Database?

Shard the database into multiple instances and dynamically control how many are active. The Google Doodle Lotería game estimated load per instance via a custom load-testing bot, then created a 'shards' entry in the default instance that clients read to know which instances to use, manually adjusted up or down as traffic spiked or dropped during the game's short homepage run.

_developers scaling realtime backends can track sharding strategies like this via daily.dev before traffic spikes hit._

### How does Firebase Cloud Functions handle matchmaking for random multiplayer games?

A Cloud Function triggers when a player writes their ID to a /queue/ location, checks if enough players are waiting, and if so creates a game entry and writes the gameId to each matched player's record. Because many players can queue simultaneously and the function runs asynchronously, transactions are used to atomically move players out of the queue and into as many games as possible at once, avoiding bottlenecks from creating games one at a time.

_daily.dev helps developers designing matchmaking systems compare approaches like this Cloud Functions pattern._

## Similar posts on daily.dev

- [Vibe-coded AI Studio apps with Firestore, Firebase, Cloud SQL](https://daily.dev/posts/vibe-coded-ai-studio-apps-with-firestore-firebase-cloud-sql-5faawqfxm) · Google Cloud · 0 upvotes · 0 comments

---

Tags: [#javascript](https://daily.dev/tags/javascript), [#infrastructure](https://daily.dev/tags/infrastructure), [#firebase](https://daily.dev/tags/firebase)

[View this post on daily.dev](https://daily.dev/posts/how-the-google-doodle-team-used-the-realtime-database-to-build-a-multiplayer-game-dpccemunz)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"How the Google Doodle team used the Realtime Database to build a multiplayer game","url":"https://daily.dev/posts/how-the-google-doodle-team-used-the-realtime-database-to-build-a-multiplayer-game-dpccemunz","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/how-the-google-doodle-team-used-the-realtime-database-to-build-a-multiplayer-game-dpccemunz"},"datePublished":"2026-08-23T12:19:29.646Z","dateModified":"2026-08-23T12:37:55.714Z","description":"The Google Doodle team built the Lotería multiplayer bingo-style game entirely on Firebase Realtime Database, letting one engineer ship it in a few months and...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/7ed721de96163685d26ab7e314be3ebc?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/7ed721de96163685d26ab7e314be3ebc?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Firebase","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Firebase","logo":"https://media.daily.dev/image/upload/s--i395oqZH--/f_auto,q_auto/v1787487448/logos/firebase-blog?_a=BAMAMicg0","url":"https://daily.dev/sources/firebase-blog"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/how-the-google-doodle-team-used-the-realtime-database-to-build-a-multiplayer-game-dpccemunz","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"javascript,infrastructure,firebase","timeRequired":"PT5M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Firebase","item":"https://daily.dev/sources/firebase-blog"},{"@type":"ListItem","position":3,"name":"How the Google Doodle team used the Realtime Database to build a multiplayer game"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/how-the-google-doodle-team-used-the-realtime-database-to-build-a-multiplayer-game-dpccemunz#faq","mainEntity":[{"@type":"Question","name":"How do you prevent multiple players from being declared the winner at the same time in a realtime multiplayer game?","acceptedAnswer":{"@type":"Answer","text":"Use a database transaction that checks whether the winner location already has a value before writing to it. In the Lotería Google Doodle game, players wrote their ID to /games/{gameId}/winner only if no value existed yet, using Firebase Realtime Database's Reference.transaction to atomically resolve close ties between simultaneous winner claims. daily.dev surfaces realtime database patterns like this for developers building competitive multiplayer features."}},{"@type":"Question","name":"How do you handle sudden massive traffic spikes with Firebase Realtime Database?","acceptedAnswer":{"@type":"Answer","text":"Shard the database into multiple instances and dynamically control how many are active. The Google Doodle Lotería game estimated load per instance via a custom load-testing bot, then created a 'shards' entry in the default instance that clients read to know which instances to use, manually adjusted up or down as traffic spiked or dropped during the game's short homepage run. developers scaling realtime backends can track sharding strategies like this via daily.dev before traffic spikes hit."}},{"@type":"Question","name":"How does Firebase Cloud Functions handle matchmaking for random multiplayer games?","acceptedAnswer":{"@type":"Answer","text":"A Cloud Function triggers when a player writes their ID to a /queue/ location, checks if enough players are waiting, and if so creates a game entry and writes the gameId to each matched player's record. Because many players can queue simultaneously and the function runs asynchronously, transactions are used to atomically move players out of the queue and into as many games as possible at once, avoiding bottlenecks from creating games one at a time. daily.dev helps developers designing matchmaking systems compare approaches like this Cloud Functions pattern."}}]}
```

