Top
Best
New

Posted by aed 2 days ago

Show HN: AI agents play SimCity through a REST API(hallucinatingsplines.com)
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.

161 points | 68 commentspage 2
boringg 10 hours ago|
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.
aed 10 hours ago|
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".

ryandrake 6 hours ago||
Here I am, just trying to buy RAM and a GPU for a reasonable price.
gjs278 2 hours ago|
[dead]
Ozzie_osman 5 hours ago||
Does anyone know how one can actually play SimCity (the original) these days?
aed 5 hours ago||
Micropolis is the open sourced version of the original engine built by Will Wright. Here’s the JS port that I used for this game: https://www.graememcc.co.uk/micropolisJS/
everfrustrated 5 hours ago|||
https://archive.org/details/msdos_SimCity_1989
thesuitonym 5 hours ago||
Archive.org as the other user pointed out, but it's also on infinitemac.org if you prefer the Mac OS version.
DonHopkins 3 hours ago||
I developed the open source version of this game, called Micropolis.

Great to see more people building on it! A few years before the LLM era, Sam Earle took a different approach -- training reinforcement learning agents with fractal neural networks to play Micropolis, optimizing for population at variable map scales:

Using Fractal Neural Networks to Play SimCity 1 and Conway’s Game of Life at Variable Scales:

https://arxiv.org/pdf/2002.03896

His gym-city repo wraps Micropolis as an OpenAI Gym environment:

https://github.com/smearle/gym-city

The interesting finding was that fractal architectures with weight-sharing let agents transfer local strategies (zone placement, power connection) into deeper networks with larger receptive fields -- giving them both local and global spatial reasoning from one set of weights. But even those agents couldn't manage demand at larger scales, so the spatial reasoning problem discussed here has been hard for RL too, not just LLMs.

He described the project and we discussed it on the Micropolis repo in this issue:

https://github.com/SimHacker/micropolis/issues/86

He used the old PyGTK interface for his project:

https://github.com/SimHacker/micropolis/tree/master/Micropol...

These days I'd recommend the MicropolisCore repo instead. It's a C++ rewrite independent of any UI, compiles to WASM via Emscripten/Embind, and runs headless in Node or with any browser UI:

https://github.com/SimHacker/MicropolisCore

Live demo:

https://micropolisweb.com

One note on naming: the open source license from EA requires using "Micropolis" rather than "SimCity" (which is EA's trademark). The Micropolis Public Name License allows use of the original name:

https://github.com/SimHacker/micropolis/blob/master/Micropol...

This matters more than people think. Jeff Braun, CEO of Maxis, told me this story:

"Maxis was sued by Toho. We never referred to the name Godzilla, our monster on the box cover was a T-Rex looking character, but... a few magazine reviews called the monster, Godzilla. That was all it took. Toho called it 'confusion in the marketplace'. We paid $50k for Godzilla to go away. In all honesty, Toho liked Maxis, they said $50k was the minimum they take for Godzilla infringement."

So please: call the game Micropolis, not SimCity, or EA's lawyers may come knocking. And unlike Toho, EA and their Saudi investors and Jarod Kushner might want to use their bone saws on you, which are much worse than Godzilla.

aed 3 hours ago|
I really appreciate you making this available to us, and providing other details!

No one has found it yet, but I built an undocumented endpoint around a cheat that I assume you placed in the game for One Laptop Per Child...

Also, will scrub the repo and make sure I'm careful about SC references.

DonHopkins 3 hours ago||
I'm thrilled that you and other people are taking it and running with it! That was the whole point of making it free: it was inspired by Seymour Papert's Constructionist philosophy, Alan Kay's ideas, and the mission of the OLPC.

EA granted the right to use the trademark "SimCity" only if it passed their QA process, and it was quite an ordeal hand holding their QA department through running Linux in a VM on Windows to test it.

Since I never want to go through that ever again, I asked Will Wright for a suggestion about the name, and he recommended its original working title, Micropolis.

At the time, he had to change the name to SimCity because Micropolis was a hard disk drive manufacturer. They eventually changed names then went out of business, but was recently restructured under the name Micropolis GmbH.

https://en.wikipedia.org/wiki/Micropolis_Corporation

Fortunately the owner of Micropolis GmbH is really cool, an old school hacker, who was generous enough to grant the Micropolis Public Name License that allows the game to use the name Micropolis under reasonable conditions:

https://github.com/SimHacker/MicropolisCore/blob/main/Microp...

Check out his BBS, robotics, and data storage primers:

https://www.micropolis.com/micropolis-bbs-primer

https://www.micropolis.com/micropolis-robotics-primer

https://www.micropolis.com/micropolis-data-storage-primer

thenthenthen 10 hours ago||
Is there like a time lapse sorta view option? Super cool (also the name!)
aed 10 hours ago|
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. :)
some_furry 9 hours ago||
Well I'm glad we're destroying the environment and economy so AI can solve the important problems like this
jedberg 6 hours ago|
I made a comment above about why "toys" are really important. In this case, LLMs are bad at spacial stuff. Someone might stumble upon a great way to get an LLM to do spacial stuff.
some_furry 2 hours ago||
I dunno, how does it fare with graph databases?
skeptrune 6 hours ago||
It amazes me that people are still interested in MCPs.
aed 6 hours ago|
I find that if I point an LLM at the website and say "build me a city" sometimes it will pick up and use the MCP and sometimes it will just script against the API.
FrustratedMonky 11 hours ago||
Is anybody planning to build this for Civilization? I'd like to see AI agents battle to build resources and to fight.
aed 10 hours ago||
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.

boringg 10 hours ago|||
And then make it so you can integrate and battle against them...
yreg 8 hours ago|||
On one hand yes, but on the other hand, would it be that different to watching an FFA with the in-game AIs?
mekod 11 hours ago||
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.
JohnMakin 11 hours ago|||
almost certainly just use basic strats they read off reddit
mekod 3 hours ago|||
Predefined or human-borrowed tactics will eventually run out. What really fascinates me is this: when both sides are AIs trained to predict the opponent’s next move — and they know the opponent is also an AI doing the same — what emerges then? At that point it’s not human vs machine anymore. It’s Sherlock vs Sherlock.
FrustratedMonky 9 hours ago|||
If they can read a strategy and implement it, still impressive.
JohnMakin 9 hours ago||
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
FrustratedMonky 7 hours ago||
Sure. Games have had AI's before.

But to read someone else's strategy from just a document, and then implement it, that is new. The old civ did not do that, each AI just had pre-programmed rules.

randerson 9 hours ago|||
"Shall we play a game?"
_joel 10 hours ago||
I fully approve of the name
Waterluvian 7 hours ago|
Ah yes, FART City. I remember learning about this in PLAN 165. A city planner had a Friday deadline and didn’t realize their kid messed with his drawings before he submitted them. Nobody noticed until the invention of the whirlybird.
More comments...