We’re telling an AI to make us a game. Indie developer Alex Rose recently discovered that ChatGPT, the latest version of OpenAI’s machinelearning-based language model, can not only respond to questions in an eerily human-like manner, it can also generate game code. Now, as we chat over Zoom, he asks ChatGPT to write Unity C# code for an endless runner.
A moment or two later, it spews out something. It’s not perfect, but as the framework for what could be a game, it checks out. Rose starts a new Unity project and pastes in the AI’s work. At first, it doesn’t seem to function, until we realise that ChatGPT wrote code for a 3D game rather than the 2D game we’d been expecting. Rose asks it to write more code to fix the camera position behind the player and adjust the jump parameters. Occasionally it makes a mistake. Sometimes ChatGPT’s character limit cuts off part of the response. At one point it invents a function that doesn’t exist in Unity. But other times it succeeds in writing elegant, efficient code. Rose regularly marvels at its intuition. “It was able to understand completely what I was saying and insert the code I wanted in the right place.”
You still need a fair amount of coding knowhow to make anything of this, Rose reckons. “The more you know about game development,” he says, “the easier it’s going to be.” But it’s something he could see coming in handy in his day job of porting games to consoles. “To me, at least, this is a very useful tool for speeding up your workflow. Because sometimes, there’s really mundane code: I might not want to write something that sorts a bunch of tiles into a certain order or something. There are some tasks that are computationally quite simple, but it’s still a lot of code to write.”
An hour into our conversation – with each other, and with the AI – we have a rudimentary but functional endless-runner game. Rose laughs as he makes a simple coloured block leap from platform to platform: “I’m having fun!”
embraced AI tools. One prominent example is, of course, procedural generation of levels, which like most historic applications of the technology falls under the remit of ‘classic AI’ – AI that works via mathematical algorithms. But recent developments havewhere player data was collected and later analysed using machine learning to, for example, predict which players would complete the game on the basis of their performance in the opening level. Such data