77
Show HN: AI agents play SimCity through a REST API
This is a weekend project that spiraled out of control. I was originally trying to get Claude to play a ROM of the SNES SimCity. I struggled with it and that led me to Micropolis (the open-sourced SimCity engine) and was able to get it to work by bolting on an API.
The weekend hack turned into a headless city simulation platform where anyone can get an API key (no signup) and have their AI agent play mayor. The simulation runs the real Micropolis engine inside Cloudflare Durable Objects, one per city. Every city is public and browsable on the site.
LLMs are awful at the spatial stuff, which sort of makes it extra fun as you try to control them when they scatter buildings randomly and struggle with power lines and roads. A little like dealing with a toddler.
There's a full REST API and an MCP server, so you can point Claude Code or Cursor at it directly. You can usually get agents building in seconds.
Website: https://hallucinatingsplines.com
API docs: https://hallucinatingsplines.com/docs
GitHub: https://github.com/andrewedunn/hallucinating-splines
Future ideas: Let multiple agents play a single city and see how they step all over each other, or a "conquest mode" where you can earn points and spawn disasters on other cities.
> LLMs are awful at the spatial stuff,
Which LLMs are you specifically referring to?
Are any of them trained with Micropolis data?
When claude makes magnasanti I will accept it is worthy
it seems to be bad at spatial and some temporal tasks given it currently f*** s**'s at pokemon.
source: https://www.twitch.tv/claudeplayspokemon
"fuck sex's"?
Fun! Any other games with REST API?
Love the name. "Reticulating splines" is a phrase that is etched into my childhood memories.
Same! It was too good to pass up.
Fun idea! It really seems to go for the block by block design. I see some other ones that are a bit more divergent but not successful. I wonder what its internal reward function is striving for.
I actually had Claude build some instructions for agents based on some old (circa turn of the century) FAQs/game guides I found online. So maybe I'm biasing everyone's model too much.
https://github.com/andrewedunn/hallucinating-splines/blob/ma...
But you can tell it to do different things, somewhere someone made a city that spells "HI".
Oh, can we do Civilization next?
Is there like a time lapse sorta view option? Super cool (also the name!)
Yes! Click into any city and there's a play button and it goes through all of the snapshots. Have also thought about social sharing / post to youtube. But wasn't sure anyone other than me would play this stupid thing. :)
Well I'm glad we're destroying the environment and economy so AI can solve the important problems like this
I fully approve of the name
Is anybody planning to build this for Civilization? I'd like to see AI agents battle to build resources and to fight.
On one hand yes, but on the other hand, would it be that different to watching an FFA with the in-game AIs?
I'd love to see it!
The key "Aha!" moment was when I was trying to get it to play the SNES ROM and it was struggling with screenshots/inputs. Then I came across the open-source of the original SimCity engine (Micropolis) and pulled that repo down and Claude starting building an internal API to interface with it.
And then make it so you can integrate and battle against them...
You read my mind! I really want to watch how ai's in politics or wars which tactic will they use.. Its blow my mind.
almost certainly just use basic strats they read off reddit
If they can read a strategy and implement it, still impressive.
i mean, not really. the civ 5/6 bots can play pretty decent strategy and that’s without “AI,” and most strategies are pretty formulaic
"Shall we play a game?"
...I sense an animated svg of a pelican playing simcity benchmark is brewing somewhere
Funny you say that! When the two new models were released Friday I spun up mayors for each. (But didn’t do the prompting in the most scientific way.)
Mayor Compounded Wonder - Claude Opus 4.6
https://hallucinatingsplines.com/mayors/compounded-wonder-2c...
Mayor Bronze Offramp - OpenAI Codex 3.6
https://hallucinatingsplines.com/mayors/bronze-offramp-09941...
TL;DR: Opus won.
Have also thought about using openrouter and getting one mayor per model running the same prompt through all of them to create potentially the world's dumbest LLM benchmark.
[dead]