Remix.run Logo
Show HN: AI agents play SimCity through a REST API(hallucinatingsplines.com)
112 points by aed 2 days ago | 33 comments

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.

natas 2 hours ago | parent | next [-]

I want to see AI play factorio

delaminator an hour ago | parent | next [-]

I've got it to be able to place items, and it could even place in inserters next to factories - I was trying to get it to use constraints solver in prolog.

https://github.com/lawless-m/FacRepl

It did make a REPL, in order for it to place objects within the game using a DSL.

I kind of gave up on the Constraints Based bit, and never returned.

philipwhiuk an hour ago | parent | prev [-]

https://jackhopkins.github.io/factorio-learning-environment/...

gnarlouse 4 hours ago | parent | prev | next [-]

Love the name. "Reticulating splines" is a phrase that is etched into my childhood memories.

aed 4 hours ago | parent [-]

Same! It was too good to pass up.

Ntrails 3 hours ago | parent | prev | next [-]

When claude makes magnasanti I will accept it is worthy

aruametello 2 hours ago | parent [-]

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

Sohcahtoa82 an hour ago | parent | next [-]

You're allowed to say "fucking sucks" on Hacker News. It's not against the rules, and there's no "algorithm" that will penalize you.

servercobra 2 hours ago | parent | prev [-]

"fuck sex's"?

goopypoop an hour ago | parent [-]

that's silly. obviously there's a missing apostrophe:

"it's currently Flan Sam's at pokemon"

rglullis 3 hours ago | parent | prev | next [-]

Oh, can we do Civilization next?

rkozik1989 an hour ago | parent [-]

You do know we're hemorrhaging and lot of finite resources to play these games badly, right? We're basically at laying on chaise lounge being fed grapes levels of hedonism. Make me a racist meme that copyright infringes multiple IP holders and when you're done play Sim City at competency level of a blind man.

boringg 3 hours ago | parent | prev | next [-]

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 3 hours ago | parent [-]

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".

Waterluvian an hour ago | parent | prev | next [-]

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.

thenthenthen 3 hours ago | parent | prev | next [-]

Is there like a time lapse sorta view option? Super cool (also the name!)

aed 3 hours ago | parent [-]

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 2 hours ago | parent | prev | next [-]

Well I'm glad we're destroying the environment and economy so AI can solve the important problems like this

hasperdi 2 hours ago | parent | prev | next [-]

Fun! Any other games with REST API?

FrustratedMonky 5 hours ago | parent | prev | next [-]

Is anybody planning to build this for Civilization? I'd like to see AI agents battle to build resources and to fight.

aed 3 hours ago | parent | next [-]

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.

yreg 2 hours ago | parent | prev | next [-]

On one hand yes, but on the other hand, would it be that different to watching an FFA with the in-game AIs?

boringg 3 hours ago | parent | prev | next [-]

And then make it so you can integrate and battle against them...

mekod 4 hours ago | parent | prev [-]

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 4 hours ago | parent | next [-]

almost certainly just use basic strats they read off reddit

FrustratedMonky 3 hours ago | parent [-]

If they can read a strategy and implement it, still impressive.

JohnMakin 2 hours ago | parent [-]

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 minutes ago | parent [-]

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 3 hours ago | parent | prev [-]

"Shall we play a game?"

_joel 3 hours ago | parent | prev | next [-]

I fully approve of the name

baq 4 hours ago | parent | prev | next [-]

...I sense an animated svg of a pelican playing simcity benchmark is brewing somewhere

aed 3 hours ago | parent [-]

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.

gowld 2 hours ago | parent | prev [-]

> LLMs are awful at the spatial stuff,

Which LLMs are you specifically referring to?

Are any of them trained with Micropolis data?