Diagrid

The Evolution of AI Agents · Chapter 3 of 7 · Stage 3 — The game loop · 1990s

The Game Loop: When State Started Carrying Forward

Mark Fussell

Mark Fussell

Co-Founder & CPO, Diagrid · September 3, 2026

The game loop at a glance · 1990s

What owns the control flow
The application, running continuously
What it added
Continuously evolving state carried from iteration to iteration
What it could not do
Survive the process - the world model lived in memory
Agent equivalent
A conversation with accumulating context and no persistence

Game Loop Added Continuously Evolving State

Games took the idea in another direction in the 90s. Games took the idea in another direction in the 90s. A game cannot simply wait for the next event because the world keeps moving even when the player does nothing. Physics advances, animation continues, timers expire, characters move, invaders shoot, mushrooms explode, and computer-controlled actors make decisions.

So the loop becomes continuous. A simple game loop might look like this:

while game_is_running:
process_input()
update_world()
render_frame()

A more explicit version might include physics, character updates, AI, collisions, and rendering:

while game_is_running:
read_player_input()
update_physics()
update_characters()
update_ai()
resolve_collisions()
render_world()

The important thing here is that the game maintains a model of the world, and each iteration transforms one version of that world into the next.

The game loop as a continuous cycle: process input, update state, render, wait or sync, then repeat - with world state carried forward into the next iteration.
The game loop as a continuous cycle: process input, update state, render, wait or sync, then repeat - with world state carried forward into the next iteration.

This introduces something that becomes particularly interesting when we get to discussing agents: State carries forward from one iteration to the next. The loop is not just responding to isolated events. It is maintaining continuity. What happens now depends on what happened before. Previous events affect future events.

Why this matters if you are building agents

Agent context is a world model. Every tool result, every observation, every revised plan is an update to it - and, exactly as in a game loop, the next iteration depends entirely on the accumulated one before it.

Which raises the obvious operational question for anyone doing AI agent state management: a game loses its world when the process exits, and everybody accepts that. Does your refund agent get the same deal, forty-five minutes into a customer dispute?

Frequently asked questions

About the author

Mark Fussell — Co-founder and Chief Product Officer of Diagrid and co-creator of Dapr. He was a Windows 3.0 developer in the early nineties — the message loop in Chapter 2 is his, not a history lesson — and has spent the three decades since on distributed systems, most recently making them durable for agents.

LinkedIn

Read next

Chapter 4 heads to Unix and Linux, where the loop learned to spend most of its life doing nothing at all - efficiently.

Chapter 4: The Unix & Linux event loop

All seven chapters are live.

Read The Evolution of AI Agents end to end, or get the next special project when it ships.