A cute robot coding at an old-fashioned computer terminal. AI code generation is great for making language games!

AI for Language Games : We’re All Developers, Now!

I’ve been developing games for language learners for over two decades now. Learning those programming skills was a labour of love, started when I was still a classroom teacher. Honing my own coding skills took years of practice. But now, thanks to ever-improving generative AI models, you can skip that step.

All it takes to create interactive language games is a good set of prompts!

Generative AI is an uncanny fit for language learners and teachers, who quickly realised how useful it could be for authentic(ish) text creation. But it doesn’t have to be static. By specifying the kind of features you want in a prompt, you can come up with great self-contained digital ‘worksheets’ with self-marking activities.

It’s possible to go well beyond this – into actual interactive gaming. Today’s generation of AI platforms are capable of taking your brief, then coding it up efficiently and intelligently as a working game, without any further input from you.

Now, if you can imagine it, you can make it.

Language Tetris

Let’s take a classic gaming example: a version of Tetris with a language learning twist. Blocks fall from the top of the screen, labelled with a word in either German or English. Students must manoeuvre the blocks with the arrow keys in order to land German-English equivalents together, whereupon they pop and disappear from the stack. The game speeds up as students progress; the aim is to prevent the blocks from stacking to the top for as long as possible.

It’s fun, and fantastic for improving recall with a set of vocab items.

An AI-generated interactive language learning game. Blocks fall from the top of the screen - the student must match them and avoid them piling to the top.

An AI-generated interactive language learning game. Blocks fall from the top of the screen – the student must match them and avoid them piling to the top. (Pictured is a ‘boom’ block that gives the students a lifeline!)

You can play a working version of it here, and you’ll see what I mean: it’s fun, it gets quite fast and furious, and it does a great job of drilling words. It may not look particularly pretty in its current state, but it’s completely playable; with a bit of visual sprucing, it wouldn’t look out of place on any language learning website.

It’s the kind of thing that would make a nice intermediate coding challenge for someone learning web app development. Maybe a weekend project, or something to do across a series of evenings.

But it took just a few minutes with ChatGPT.

Prompting for Language Games

Here’s the prompt I used for the initial version (and you’ll see some similarities with the interactive worksheet prompt, too):

Let’s create a language learning game in JavaScript, completely self-contained on a single HTML page. It will be like Tetris, adapted for language learning as follows:
– blocks will have either a German or an English word on them from a pot of ten vocabulary items on the topic ‘Clothing’
– blocks will descend from the top of the screen
– as they fall, students use the left, right and down arrows to manoeuvre the blocks before they land
– if a matching German block and English block touch (above, below or to the side), they go POP and disappear – and the game speeds up slightly
– ensure that ‘gravity’ is respected, so if there are blocks above one that ‘pops’, they fall into place accordingly
– the aim is to avoid the blocks stacking up to the top
– every few blocks (maybe every 5-10 at random), a ‘boom’ block falls that ‘pops’ every block it touches on landing (just to clear the space and make it a bit easier)

If you pop this into Claude Sonnet 3.5 right now – as long as you have Artifacts turned on – you should be able to play what comes up straight away. If you’re using ChatGPT or another platform, there’s an extra (easy-ish) step to do before you can play: you just need to save your code in some text editor as an HTML file.

Code output from a prompt in ChatGPT

Code output from a prompt in ChatGPT

Live Preview – Without Claude’s Artifacts

In fact, one free editor for coding – Phoenix Code – also shows you a live preview of the page working as you paste the code in, Claude Artifacts-style. If you really get into language games generation with AI, it’s well worth a download.

Using Phoenix to save and preview AI-generated language games

Using Phoenix Code to save and preview AI-generated language games

One important caveat: your game may well not be perfect on the first go. It might have a bug or two – AI might have missed the point occasionally. My initial version of Language Tetris, for example, allowed students to move the block across existing columns, unlike in the classic game.

But by prompting and re-prompting, requesting tweaks and changes as you go along, you can produce some amazing results. Change the styling, add features, include fiendish rules of play.

The sky’s the limit.

Pulling It All Together

Once you’re done with one game, it can serve as a template for others. It’s usually clear in the code where to change the vocabulary items to something else. Just change, Save As… a new filename, and build up a library of topical games.

A snippet of code produced by ChatGPT

It’s usually clear from a glance at the code where you can change the vocabulary.

In terms of styling, these games do tend to be graphically quite simple. That said, you can easily prompt for more visually appealing elements. And why not use a AI image generation tool like Bing to make some more attractive graphics to integrate into your creations?

Finally, you might be wondering if educational games developers like me are feeling a bit… well, put out by all this. My answer is a resounding¬†not at all! If anything, AI code generation is a brilliant proof-of-concept, prototyping tool to try out new gaming ideas before setting fingers to keyboard. It’s incredibly useful to test if something will really work before pouring hours into coding it.

And of course, you can pick up with your own skills where AI leaves off, to create something even more special with that irreplaceable human touch.

Have you been using AI as your own coding assistant? Let us know in the comments what you’ve been creating together!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.