Making a game using ChatGPT AI and GameMaker
So firstly for those are not aware GameMaker Studio (GMS) is a game development platform that allows users to create 2D games using a simple drag-and-drop interface. It features a built-in programming language called GML, which can be used to add more advanced features and gameplay mechanics to games. GMS is popular among both experienced game developers and those new to game development, as it provides a user-friendly way to create games without the need for extensive programming knowledge. You can use a single code base and output to various different platforms including Android, iPhone and Windows which will save alot of time and money.
Discover the secrets of game development and start creating your own fun and exciting games today with this comprehensive GameMaker course book.
ChatGPT GML Code
So it turns out ChatGPT is familiar with GMS which is Game Maker Studio’s native language. Great! So to start with I asked for some simple scripts like “extract all symbols from a string given” which it coded quite well. I then decided to ask it to code a single script that can be placed in an objects step event to allow movement control using keyboard and also add jump and fire bullets. I had problems as it started to use functions not actually in the GMS manual. Then it would leave code uncompleted.
So the end script had to be tweaked and checked over. I created a room and 3 objects; Player, Ground_Obj and Bullet and setup the room. And as i expected it did not actually work. I could move the Player left or right, but when I pressed Jump it kept moving up. Also initially it did not write the code to detect collision with the solid Ground_Obj which to be honest is the most crucial part of a platformer code! So I asked it to add that code but still i had to edit it and it did not account for horizontal collisions.
To be fair though it would have taken me longer to write all that code myself so it was time saving, but then again if i coded this from scratch I would have done things differently so that it was much more smoother and spread over different events in the object.
My game using chatGPT:
Have a look at this video which shows the very simple Game Maker game using ChatGPT. I can move the player left and right, press W to jump up and Space to fire bullets in direction im moving in. I could definitely expand and work forward using this as a starting point and maybe going back to the AI for specific code pieces as it remembers things like object names and variables it defined.
@rizbituk Can you #code a simple 2d platform #game with one character using #chatGPT and #gamemakerstudio2 #gamemaker #makegames #openAI #aigames
♬ Lagu Piala Dunia Qatar Word Cup (Cover) – Onel1443
Conclusions
So can I make a game using ChatGPT and Game Maker? The simple answer has to be yes, but you are going to have to be very precise with your instruction to ChatGPT and also be prepared to do some editing, checking and writing code around it to make it work. Also because of the way Game Maker Studio is structured unlike say Python it isnt really possible to put all the code for a simple game into one script. For example with this code the AI gave me, the variables it defined had to actually be placed in the Create event in order to make the game work, otherwise it was defining the variable in each step giving them back their default values.
Many people on social media are making claims that AI tools like this will replace developer and marketer jobs but my experience has been that AI is going to be more of a good companion for developers to assists in saving time and writing fixed pieces of code. In terms of innovation, QA and getting the perfect end result that will still be in the hands of the developer (human).