How AI Plays Chrome Dino (And Beats You at It)

The Chrome Dino game is one of the most-studied targets for machine-learning experiments in browser games. It has clear inputs, clear failure states, and a continuous score signal — the three things a reinforcement-learning algorithm needs. Neural networks have been trained to play it indefinitely, beating any human’s possible reaction-time-limited score. Here’s how the AI actually works, what techniques have been applied, and why this particular game became the canonical demo of the “teach a neural network to play X” genre.
Key takeaways
- Chrome Dino is well-suited to AI because it has simple inputs, fast feedback, and a clear reward signal.
- The NEAT algorithm (NeuroEvolution of Augmenting Topologies) was the technique used in Code Bullet’s famous 2018 viral video.
- Reinforcement-learning approaches (deep Q-learning, policy gradients) have also been applied with strong results.
- The AI usually outperforms humans by exploiting precise reaction timing that human nervous systems can’t match.
- Two main approaches exist: vision-based AIs that read pixels, and direct-state AIs that read the game’s internal variables.
Why Chrome Dino is a perfect AI target
Three properties make the game unusually friendly to machine learning. First, the input space is tiny — two buttons (jump and duck) and a do-nothing default. A neural network doesn’t need to learn a complex action space. Second, the feedback is dense — the score increments every frame, and the death event is unambiguous. The agent gets continuous reward signal with rare but clear punishment. Third, the state can be represented compactly — the position and velocity of the next few obstacles, the player’s vertical position, and the current speed. A small input vector captures essentially everything that matters.
Compare this to games where AI is harder. StarCraft has thousands of simultaneous units, fog of war, and a sparse reward signal. Even Atari games have richer state spaces. Chrome Dino is at the simple end of the spectrum, which is exactly why it became the canonical introductory machine-learning game.
The NEAT algorithm
The most famous Chrome Dino AI demonstration — Code Bullet’s 2018 YouTube video — used NeuroEvolution of Augmenting Topologies (NEAT). NEAT is a genetic algorithm developed by Kenneth Stanley and Risto Miikkulainen in 2002. It evolves neural networks over generations: many random networks play the game, the best ones survive and reproduce with mutations, and over enough generations the population converges on networks that play well.
The mechanics: each generation, a population of (say) 100 neural networks each plays the game. Their scores are recorded. The top-scoring networks “reproduce” by mixing their structure and weights, with random mutations introducing variation. The worst networks are discarded. Repeat for many generations.
NEAT’s twist is that the topology of the network — how many neurons, how they connect — evolves alongside the weights. Most neural-network approaches fix the topology and only learn weights; NEAT lets the algorithm discover good architectures as part of the search. The Code Bullet video shows the population learning to jump cacti within a few generations, then to handle pterodactyls after a few hundred more.
The reason NEAT works well for Chrome Dino is that the optimal network is small. The agent only needs to learn “if obstacle distance < X and obstacle is low, jump; if obstacle is high, duck." A handful of neurons can express this rule, and NEAT finds it through evolutionary search.
Reinforcement learning approaches
The other major family of Chrome Dino AIs uses reinforcement learning (RL) — particularly deep Q-learning (DQN) and policy-gradient methods. Where NEAT evolves networks across generations, RL trains a single network through gradient descent on its actual game-playing experience.
The DQN approach: the agent takes an action, observes the result, and updates its policy to favor actions that led to higher cumulative reward. Over many thousands of game-playing episodes, the network converges on a policy that jumps cacti, ducks pterodactyls, and accumulates score indefinitely.
RL implementations of Chrome Dino bots have been published in many academic and hobbyist projects since 2018. The training time varies — a vision-based DQN reading raw pixels takes many hours of training; a state-based DQN reading the game’s internal variables converges in minutes. Both approaches reach superhuman performance.
Vision-based versus state-based AIs
The two main implementation choices for Chrome Dino AIs:
Vision-based AIs read the pixels of the game canvas, just as a human would. They use computer vision (often a convolutional neural network) to detect the player, obstacles, and their relative positions, then feed that information to a decision network. This is the more impressive demo because the agent learns to “see” the game without being given access to its internal state. It’s also slower to train.
State-based AIs read the game’s internal variables directly — the dinosaur’s position, the next obstacle’s distance and type, the current speed. This is faster to implement and trains much more quickly, since the network doesn’t need to learn perception. It’s also less impressive as a public demo, because the agent is being handed information that humans have to extract from the screen.
Both approaches produce agents that outperform humans by a large margin. The vision-based approach is more general (the same framework would work on other games); the state-based approach is more efficient.
The 2018 viral video, in context
Code Bullet’s “I Created an AI to Beat Chrome’s Dino Game” video, posted in 2018, was the breakthrough moment for AI-plays-Chrome-Dino as a content genre. The video walks through a NEAT implementation in a friendly, accessible style — generations of networks evolving, failing comedically at first, then gradually learning to jump cacti and duck pterodactyls. The video crossed many millions of views and inspired a wave of follow-up implementations in different frameworks.
The cultural significance is that the video made machine-learning concepts (genetic algorithms, neural networks, evolutionary search) accessible to a general audience using a game everyone recognized. The Chrome Dino game became the “Hello World” of game-AI demonstrations — the example that countless tutorials, university coursework projects, and YouTube videos have used since.
Why the AI beats humans
Three reasons. First, reaction time. The AI’s reaction time is essentially zero — it can make a decision in one frame (about 16ms). Human reaction time to a visual stimulus is around 200ms minimum, more like 300ms in practical play. As the game speed increases, the human’s reaction window shrinks below their reaction time. The AI has no equivalent limit.
Second, consistency. The AI doesn’t get tired, distracted, or impatient. A human can play perfectly for a minute or two; the AI can play perfectly indefinitely. The game’s design assumes human-scale endurance, so the AI’s perfect consistency lets it run essentially forever.
Third, optimal action. A trained network has learned the precise jump timing and duck-versus-jump decision boundaries. A human player’s decisions are approximate, governed by judgment under uncertainty. The AI’s decisions are crisp.
The combined effect: AI agents demonstrate indefinite play with scores far beyond what verified human runs have achieved. This isn’t competitive with humans — they’re in different categories.
How the source code structure supports AI experiments
The Chrome Dino game’s source code is publicly available — it lives at github.com/wayou/t-rex-runner under a BSD-3 license. The clean separation between the game state and the rendering code makes it straightforward for an AI researcher to hook into the game’s internal variables, run the game in headless mode at high speed, and feed the state directly to a neural network.
This is part of why so many AI implementations exist. The game is open-source, well-structured, and simple enough that anyone with intermediate programming skills can write the integration layer between a machine-learning framework and the game logic. For more on the code itself, see our Chrome Dino source code explained piece.
What this teaches about AI more broadly
The Chrome Dino case illustrates several broader points about machine learning. First, simple problems get solved by simple networks. The optimal Chrome Dino policy is a small network — a handful of neurons can express it. Many machine-learning successes have similar structure: the right model is much smaller than people expect when the problem itself is well-defined.
Second, training stability matters more than architecture. Whether you use NEAT, DQN, or policy gradients, you end up with similar performance on Chrome Dino. The choice of algorithm is much less important than getting the training loop right.
Third, the input representation is half the battle. Pixel-based agents need to learn perception; state-based agents are handed it for free. The right preprocessing can collapse weeks of training into minutes.
For more on the game’s history and design that makes it so AI-friendly, our analysis of Chrome Dino’s appeal covers the human side of the same phenomenon.
Frequently asked questions
Who made the famous Chrome Dino AI video?
Code Bullet’s 2018 YouTube video, which used the NEAT genetic algorithm to evolve a neural network to play Chrome Dino, is the canonical viral piece of AI-plays-Chrome-Dino content. The video has many millions of views and inspired a wave of follow-up implementations.
What algorithm did the Code Bullet video use?
NEAT (NeuroEvolution of Augmenting Topologies) — a genetic algorithm that evolves both the weights and the topology of neural networks across generations. The video walks through the algorithm visually as the population learns to play.
How long does it take to train an AI to play Chrome Dino?
It depends on the approach. State-based agents (reading the game’s internal variables directly) can train in minutes. Vision-based agents (reading pixels) take hours to many hours depending on hardware. NEAT and reinforcement-learning approaches have similar training times within each category.
Can the AI play forever?
Yes, in principle. Trained agents have demonstrated indefinite play in academic and hobby experiments. The combination of zero reaction time, perfect consistency, and optimal actions removes the failure modes that end human runs.
Are AI runs counted in Chrome Dino speedrun records?
No. Human-record categories on speedrun.com and community trackers explicitly exclude AI-assisted runs. AI demonstrations are tracked informally as a separate category when tracked at all.
The takeaway
Chrome Dino is a near-perfect test bed for machine-learning experiments because its inputs are simple, its reward signal is dense, and its state is compact. NEAT and reinforcement-learning approaches both produce agents that easily outperform humans. The Code Bullet video made the genre famous in 2018, and the implementations have multiplied since. If you want to try the human side of the same game, the original T-Rex Runner is one tab away — and the AI agents will still beat your high score.








