Wednesday, 9 July 2025

Noughts and Crosses - simple JavaScript game created with AI

Your turn (X)





Development Notes


Gotta start small, right? So I started with the smallest game project I could think of - noughts and crosses, or "Tic-Tac-Toe", if you prefer. Since the visuals are extremely basic and the game logic is about as simple as it gets, not to mention that AI knew the rules without me having to tell it, getting an initial mockup was ridiculously easy. What took a little more effort was fine-tuning the AI opponent - even though (apart from the "unbeatable" level - draw on that to see a quote from War Games, an 80s movie I love) , it was basically a case of combining randomn placement and probability weighting to make the best moves (obviously, the easier the opponent, the lower the probability of it choosing the best move).

Then things like adding choices (difficulty level, who goes first) and how the game responds to game-ending events. It's very simple, but quite playable. I was glad I started with this as it was easy but also very informative as to how to structure the next, more ambitious project.

This game took 8 prompt iterations to reach the final stage. With prompting, testing and thinking time, I guess it took about an hour to put together. There is scope to expand it but I'm not really planning to (although I may possible get it updated to work better on mobile devices) as this was absolutely just a learning project and the real fun will be trying to create a game with a unique ruleset. 

About my experiment to make simple JavaScript games using AI tools

 In case anyone’s thinking that using AI tools to help create games is just a case of typing into ChatGPT “make me a game like Tetris, but better”, it isn’t. (Well, I guess in truth I haven’t actually tried that, but…) The thing with AI is that the quality of output you get is very much dependent on the quality of input you give it. Also, don’t expect that you can get what you’re looking for on the first go – you can try to front-load the first prompt with context and information, but that will still only get you so far.

So why did I want to experiment with using AI to make simple JavaScript games in the first place?

·         I have no interest in actually learning to code JavaScript – I simply don’t have the time. It took me long enough to learn AGS script (which is very similar to C++) which means I can usually follow what’s happening in JS due to similarities in the two languages structures, but I can’t code it. (I did code HTML many years ago, but really even back a couple of decades ago, most people were using a visual editor rather than hand-coding it anyway.)

·         I use AI quite extensively in my day job and have become fascinated by the possibilities. Like most people who have actually spent significant time learning about and using AI, I see it as simply a tool that can be used, and rather than deskilling it can be used to help people in certain professions focus on what their jobs actually should be, rather than spending most of their time on repetitive documentation tasks. I do appreciate that there are specific use cases where use of AI is highly controversial – art generation for instance – and I fully understand that viewpoint.

·         Linked to that, it seems to me that AI has been trained on coding that has been intentionally made publicly available. My goal is to leverage the strengths of AI – which is in producing clean, usable boilerplate code and implementing simple game logic – while avoiding trying to get it to do anything too complex. That’s where a real coder is still (from my understanding, at least) miles ahead of what a GPT can do.

·         Given that, I’m using an AGILE methodology – my process is a very simple three-tiered loop:

o   Think about what I want to achieve on this iteration

o   Create a prompt that explains this to the GPT as clearly as possible

o   Test the results, and go on to the next iteration (unless I feel the game has already reached its target state)

o   This is very small-scale stuff, just me working with AI, so I’m not bothering with even thinking of anything in terms of “sprints” etc.

What’s required from me in this case, since I’m not doing any of the actual coding? Well, first of all, I need the original idea. (My very first project was a simple noughts-and-crosses game, just as proof of concept, but my plan is to create some small but unique games.) Then it’s a case of knowing how to write high-quality AI prompts, and how to give it comprehensive, clear instructions that are not open to AI hallucinations. Along with this, understanding how the game should work at a fundamental level is required – if you’re just remaking noughts and crosses then yeah, no specific knowledge is needed, but if you want to create something unique, you need to first understand yourself exactly how it should work “under the hood” and then how to get that across to the GPT.

In theory, each iteration should take you nearer to the goal. In practice, I have found that whilst this is usually the case if my prompts are very precise, there is still room for the GPT to misinterpret what I’ve asked it to do (the blame for this can be shared between me and the GPT!)

 I’ve set certain limitations for myself – I only want to create something in vanilla JavaScript (with a little HTML / CSS thrown in for the page design), so no libraries allowed, it must be either a single player or player vs AI opponent, and it must run within a Blogger post (so I can put it here along with a short explanation of how the game was designed). I will also be using only the free Chat-GPT model, and (potentially barring some very small modifications to the HTML components) not directly editing the code myself.

My goals with this are simply to have a bit of fun seeing what I can come up with and learn a bit more about the possibilities and limitations of current free GPT models. I also needed something a little different to kick-start my brain – with what time I have available, hand-crafting games in AGS is still my main focus. When all’s said and done, there’s nothing quite like solving a tricky coding problem yourself!

Okay this post ended up being quite a bit longer than I thought it would be and I’ve probably missed out some things that had been in my mind, but anyway… I’ll start posted the results of my experiment soon.

Tuesday, 8 July 2025

Development Updates

Progress on Captain Disaster and the Two Worlds of Riskara has been slowly progressing. I've had a struggle with certain elements of it and a few setbacks, but it's still getting ever closer to a release candidate for the final big round of testing. 

Unfortunately, I have the type of brain that really struggles to stay on one project at a time - sometimes this is helpful, sometimes not, and I'm sure a few people reading this will be wondering what on earth I'm talking about, whilst others will be nodding sympathetically because that's how their brain works too. Anyway, the long and short of it is that I've gone back to Flow Problem, done a heap of code optimisation and added some music and sound effects, and will probably release a big update to that game soon.

Last but potentially not least, I've decided to investigate the feasibility of using AI to create simple JavaScript games. I'll post a bit more on this later. I'm only doing it for fun, to see if I can create some quick fun puzzle games that you can play free in a browser, but my early experiments are very possible. It does make me think of the joke "Make my game" button older AGS editors used to have, but that's not how it works in real life! I'll do a post on my methodology soon. 

(I'm not planning on using AI to make anything in AGS btw!!! Just in case anyone wondered.) 

Thursday, 3 July 2025

Steam Summer Sale!

 It's that time again - the weather causes prices to melt, or something.

Anyway, all three of my games on Steam are a massive 75% off for the duration of the sale:


Sunday, 23 February 2025

Captain Disaster and the Two Worlds of Riskara - in 15 seconds!

Well, this "My indie game in 15 seconds" thing has been trending on social media for a while now, so I thought I'd better get in on the act - then I also realised it's been ages since I updated this blog!

So here we are: