I used GPT4 to build two new video games after ChatGPT helped me write a children's book. It makes coding approachable — even if it seems like it's only half-listening.
- Ammaar Reshi a self-described "novice coder" used GPT-4 to code two games in JavaScript.
- He said GPT-4 makes coding more approachable even if it requires some trial and error.
- Reshi previously used ChatGPT to write a children's book in 72 hours.
This as-told-to essay is based on a conversation with Ammaar Reshi, a design manager at Brex. It has been edited for length and clarity.
I want to start with a disclaimer: I have a degree in computer science.
I still tell friends, though, that if you let me code it'll be a complete hazard. I went to college in the UK, where computer science is a rigorous yet very theoretical degree. You aren't taught many practical skills.
That's why I pivoted towards design. I work now at the fintech startup Brex, where I manage a team of designers who work on user experience. Despite that, I never lost hope that one day I'd learn how to code my own games.
I've toyed with no-code tools in the past like Webflow and Framer, that are mostly for building websites, but I felt they weren't that advanced.
Over the past couple of weeks, though, I've coded two games in JavaScript using OpenAI's newly released GPT-4. The technology is next-level.
Building a game just takes imagination and a prompt
The first game I built was a snake game, which is a sort of classic arcade game. It took me less than 20 minutes and just five prompts to build the game. Here is a closer look at the final product.
—Ammaar Reshi (@ammaar) March 14, 2023
Then, over a weekend, I built a more complex game that I would describe as a "3-D space runner." Here's a closer look.
—Ammaar Reshi (@ammaar) March 19, 2023
Basically, I input a prompt like "Add a high-score label that tracks the amount you've eaten" and GPT-4 would spit out the code. I took those lines of code and pasted them into Replit — a browser-based coding environment — because I didn't have a JavaScript environment set up on my computer.
I also have really vivid dreams and they came in handy here. I was able to use an AI-image generator called Midjourney to recreate those visuals and illustrate my games.
All you need is your imagination and a prompt to go really far with GPT-4.
Sometimes GPT-4 seems like it's only half-listening
The experience definitely isn't perfect. Coding with GPT-4 sort feels like talking to someone who's only half-listening to you.
What I mean by that is with the first snippets of code GPT-4 generated for the snake game, the snake would hit the bottom of the screen — like it had died. Then it would resurrect itself and the game would just keep going.
So, I had to remind GPT-4, "Hey, you forgot to kill the snake."
Of course, that wasn't too bad. Trial-and-error is par for the course in coding. But the second game was another story.
It was significantly more complicated, so I expected that it would take me longer to complete. I didn't expect it to take me an entire weekend.
I had so many questions for GPT-4 that I needed to break them up into four separate conversations. I noticed that after a conversation had gone on long enough, GPT-4 would hit some sort of limit, and suddenly forget what "we" had been discussing. That's what I mean by only "half-listening."
There was another point when I was building the second game, where a spaceship — representing the player — would fall and essentially get stuck. I spent over two hours explaining the problem to GPT-4 in different ways, but it just couldn't figure out how to get past the issue. I used code from another AI assistant called Claude to get the spaceship moving again.
In the end, I showed my full-fledged software engineer friend the code that GPT-4 came up with. He conceded that it wasn't the best written code; it definitely repeats itself in places it doesn't need to. However, I think that GPT-4 will make coding more approachable for novice coders like me, and encourage more people to build out their ideas.
from Business Insider https://ift.tt/X3pSVUw
via IFTTT
Comments
Post a Comment