Porting Pokemon GBA C code to Typescript
A year ago I tried to use LLMs to render the pokemon yellow overworld but they struggled with the way the assembly had very efficiently packaged the tileset - Pokemon Yellow had a ROM size of 1 megabyte (MB)! Peter Hajas has a great blogpost about how this works. So the pokemon yellow overworld was very much a manual attempt.
Fast forward one year, I’ve been able to port, from GBA c code, to typescript a large chunk of Pokemon Emerald. I’m not building an emulator but a fully native version of the game. This means you can do things like render the gameplay in a much larger viewport than GBA ever allowed. It’s runnning with WebGL support to should be very smooth.
Building a game is also a great way to test coding CLIs to their limits - it’s very visual and since it’s for personal use you get to see how much of the porting can be one-shotted. They do pretty well when the task is defined but Codex still struggled when trying to implement the water reflection - i had to dig up the specific gba c code file to have it perfectly reproduce it.
LLMs playing Pokemon have long been a fun benchmark but now we’ve beaten that our next benchmark will be to see if they can fully port old pokemon code!
Have a go below: