Skip to main content

This AI tries to code whatever you tell it to, even videogames

robotic hand using laptop
(Image credit: Kilito Chan via Getty Images)

In the ever-increasing list of things that machine learning AI can do in our modern world, there's now a program that will code (or at least, try to code) whatever you tell it to in plain English. Want some flashy banner text that changes color every few seconds? Tell that to OpenAI Codex and it will code it for you in seconds.

The OpenAI Codex beta, currently only available through an online waiting list, is a simple web tool with three windows: one to type in commands, one that shows the code generated by those commands, and one that shows what the code does. You could theoretically use Codex for all sorts of tasks in over a dozen coding languages, but the coolest use I've seen is coding simple Javascript videogames with just a handful of natural language instructions.

Check out the video below from YouTuber Joy of Curiosity to see it in action.

It's pretty wild—the tool can easily handle simple commands like "make a black circle," but it can also correctly interpret commands that require context, like "make it smaller," and even multi-step instructions like "if the rectangle and the circle overlap, make the circle go in the opposite direction." In minutes, Joy of Curiosity has a crude version of Breakout up and running.

That's impressive, but I noticed a few instances where Joy intervened with little tweaks to the AI's attempt to code. OpenAI also made an official live demo of Codex's Javascript skills (zero intervention required) with a little spaceship game. It's cool how the tool leverages the OpenAI platform to have general knowledge about the world, like when the user tells Codex to "set background to the color of space," resulting in black. The commands get even more elaborate in this demo. With the single sentence beginning with "When the rocket is clicked," Codex successfully programs a boost mechanic that accelerates the ship in its current direction. By the end of the eight-minute demo, the game has scoring, a tutorial, and an objective.

I fully expect that the spaceship video is a manicured demonstration that plays toward OpenAI's strengths and avoids its weaknesses, but the magic of watching a simple phrase turn into actionable code seems very real. Now, even a math-averse person like me can be one of those game directors that points over his programmer's shoulder and says "make this faster, that needs more color." For a look at an alternate use of Codex, YouTuber Ania Kubów was able to make a snazzy (if simple) website to showcase her work.

I suspect Codex is still a long way from being useful for projects beyond demonstrations, but it's a fascinating glimpse at a potential future in which telling computers what to do doesn't require fluency in any language other than the one you learned to speak growing up, a la Star Trek. Concurrently, there's a growing interest among Silicon Valley investors in "low-code" or "no-code" tools that aim to make programming faster and simpler, and even accessible to those who aren't fluent in any coding languages.

OpenAI is still hiding Codex behind lock and key for now, but you can sign up for the waitlist for a chance at access. If I get access, my first goal is to instruct the AI to destroy itself. I'll let you know what happens.

Morgan Park

Morgan has been writing for PC Gamer since 2018, first as a freelancer and currently as a staff writer. He has also appeared on Polygon, Kotaku, Fanbyte, and PCGamesN. Before freelancing, he spent most of high school and all of college writing at small gaming sites that didn't pay him. He's very happy to have a real job now. Morgan is a beat writer following the latest and greatest shooters and the communities that play them. He also writes general news, reviews, features, the occasional guide, and bad jokes in Slack. Twist his arm, and he'll even write about a boring strategy game. Please don't, though.