How AI can help you make a computer game without knowing anything about coding

Just as calculators took over the tedious number-crunching in maths a few decades ago, artificial intelligence (AI) is transforming coding. Take Kyo, an eight-year-old boy in Singapore who developed a simple platform game in just two hours, attracting over 500,000 players.

Author


  • Daniel Zhou Hao

    School of Computing and Mathematical Sciences, University of Leicester

Using nothing but simple instructions in English, Kyo brought his vision to life leveraging the coding app Cursor and also Claude, a general purpose AI. Although his dad is a coder, Kyo didn’t get any help from him to design the game and has no formal coding education himself. He went on to build another game, an animation app, a drawing app and a chatbot, taking about two hours for each.

This shows how AI is dramatically lowering the barrier to software development, bridging the gap between creativity and technical skill. Among the range of apps and platforms dedicated to this purpose, others include Google’s AlphaCode 2 and Replit’s Ghostwriter.

In another example of the power of these apps, an eight-year-old American girl called Fay built a chatbot that purported to be Harry Potter. She had it up and running in just 45 minutes, at which point it asked if she had heard the rumours about the Deathly Hallows and suggested they discuss it over a butterbeer at the Three Broomsticks.

For those that already know how to code, numerous AI apps have become incredibly helpful too. At the other extreme from the natural language coding apps described above, tools like Tabnine and GitHub Copilot act as intelligent assistants, predicting and autocompleting code as you type.

Alternatives such as Sourcery and DeepCode go a step further, offering real-time code cleanup, suggesting improvements and fixing vulnerabilities. New tools are emerging weekly, such as OpenAI’s GPT Canvas, a new GPT version designed to help with sophisticated coding. Many of these tools can also translate code from one programming language to another, say from JavaScript to Python.

The productivity gains that these tools offer are revolutionising the software industry. As many as 70% of companies have already adopted the likes of GitHub Copilot, with coders reporting that AI is enabling them to write software that is more reliable and bug free.

By removing the need to spend so many hours ironing out human errors, coders are able to spend more time focusing on higher value tasks such as designing system architecture and collaborating with colleagues.

It is also changing the game for university educators like myself as we race to keep up. We’ve been having to rethink teaching materials and also assessment methods, wrestling with how exactly to grade a student’s coding in situations where AI tools are doing much of the work.

Today’s limitations

As exciting as all this is, AI coding is still in its infancy. At this stage it can only help non-coders to build simple applications or games. It can’t yet oversee big complex IT projects by understanding the big picture in a way that a human coder would.

It can’t yet invent new ways to solve problems either, and is still more likely to lag in areas like, say, spacecraft navigation that require highly specialised knowledge.

Many tools also don’t write perfect code: a program will often work but won’t be efficient or secure enough for use in the real world. Similarly, AI tools don’t inherently understand the context of the data they process, so may mishandle sensitive information or perpetuate biases present in the data on which they were trained.

For all these reasons, in professional situations there’s still a need for a coder to make sure that everything is meeting the necessary standards. No doubt in future we may see AI coding tools designed to handle everything from security issues to highly specialised subject matter. Their ability to help non-coders to build apps will also only improve. For now at least, however, AI coding is still amplifying the skills of coders rather than replacing them altogether.

How to build your own game

All the same, it’s incredible what you can do with these tools as a non-coder already. Here’s a quick guide to making a simple platform game:

Step 1: Sign up for an AI tool: Create an account with, say, Cursor or AlphaCode 2 and follow the setup instructions. Depending on which tool you choose, you may need to do a quick install. You may also need to install a programming language such as Python, as well as a source code editor such as VS Studio Code 2 – the coding platform will keep you right on this.

Step 2: Start your game: Open a new project in the tool. Into the prompt, type: “Create a simple platform game where the platforms are made of sweet treats”.

Step 3: See what it’s like: Click “run” or “preview” to see what you’ve created (depending on which system you are using, you may have to do this in the source code editor). You should see platforms made of candy or cakes.

Step 4: Make some changes: Let’s say we change the main character into a parrot. Simply type into the prompt: “Make the avatar a green parrot”.

Step 5: Add features: Now type into the prompt: “Let the parrot be controlled by the cursor arrows, insert some sweets for it to collect and add a score counter for how many it has collected”.

Step 6: Test and tweak: Click “run” or “preview” again to test the updated game. Make changes by typing things like, “Insert a black crow that will chase the parrot around the screen. If the crow touches the parrot, freeze the screen and display a message in the middle of the screen saying ‘Too Bad!!!'”. Keep repeating these steps until you’re happy with the results.

Step 7: Get it out there: You might now want to share your game with friends or online via an app store. It must be said that AI coders are not yet doing this well, so you may find this trickier without prior knowledge. One option is to deploy the game online via a free platform such as Zeabur, as explained here.

The Conversation

/Courtesy of The Conversation. View in full here.