Ammaar Reshi Profile picture
Mar 14, 2023 10 tweets 5 min read Read on X
Can GPT-4 code an entire game for you? Yes, yes it can.

Here's how I recreated a Snake game that runs in your browser using Chat GPT-4 and @Replit, with ZERO knowledge of Javascript all in less than 20 mins 🧵
First, I just asked GPT-4 to provide code for a Snake game, with the relevant HTML, CSS, and Javascript required to make it run. This provided all of the code I needed to get the project going. It wasn't able to complete it all in one response, but I just replied with "continue"
Once I had all of the necessary code for the game, I created an account on @Replit and started a new HTML, CSS, JS project. That gives you all of the necessary files you'll need to run the code (and all in your browser too!)
Then, just paste the code into the relevant files that GPT-4 tells you to lay them out in within Replit and hit run! Using my arrow keys, the game worked just as expected except...
It had some issues. The snake would die after its first bite instead of growing, and it kept adding the score in increments of 2 instead of 1. So I asked GPT-4 to make those tweaks and it did!
I love that it followed up with explanations too—what a wonderful way to learn to code and actually understand why it's doing the things it's doing. GPT-4 is a decent teacher!
Finally, I wanted to add a high score counter to the game to make it a little competitive. How do I do that? well, I just asked and it gave me exactly what I needed to update my game on Replit.
Of course, you could add so much more, sounds, custom art, to make this a fully-featured game. The potential is so exciting. Anyone can make their own games just by describing them!

You can check out the game on @Replit with all of the code so you replit.com/@asrsubs/Snake…twitter.com/i/web/status/1…
Decided to add a little extra nostalgia to the game with the help of GPT-4... now that's more like it ✨ (sound on!).
A few replies said "isn't this just trained on how to write a Snake game from many examples on the web"... well, I pushed it further. What if you could point it to a game's Wikipedia page, make it understand the mechanics, and ask to recreate it?

... can't wait to show you! 👀

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Ammaar Reshi

Ammaar Reshi Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @ammaar

Nov 12, 2023
Introducing Sparkle ✨, a custom GPT that helps you craft storybooks and become a published author!

It can:
- Generate a book with a page by page breakdown
- Provide amazing MidJourney prompts & illustrate with DALL-E
- Layout pages & much more!

Demo and full features below! 🧵
As you saw above, you can brainstorm with Sparkle, refine ideas, while it pushes you to develop your story and add depth... But you can also just start someone in your life or an image and Sparkle helps personalize the story it crafts around that!
Not sure how MidJourney prompts work, or have questions about specific parameters? Sparkle is trained on MidJourney documentation too and can help you craft the perfect prompt while explaining how it all works. It can even give you tips on things like character consistency!
Read 5 tweets
May 21, 2023
Here’s an AI generated horror movie trailer I made this weekend in 2 hours!

Text-to-video clips with @runwayml Gen-2, and a little bit of voice acting.

And of course, the whole workflow and process with prompts so that you can make your own! 🧵
First, I knew I wanted to try my hand at horror, and to build tension I wanted scenes to be dimly lit, hard to look through, but just enough to see something was off. I took that direction to @runwayml's Gen-2.
So here's an example → "Cinematic horror shot" brought realism to my generations, "dimly lit" lighting descriptions made clips darker, and providing director inspiration like @flanaganfilm (who I'm a huge fan of), or @StephenKing gave it the right tone.
Read 7 tweets
Apr 27, 2023
AI has been a game changer for making my ideas real.

From books, animated shorts, coding games, podcasts with people from the past, and more. I love sharing what I'm learning in hopes to inspire you!

This thread is a compilation of all my guides so far with more to be added! 🧵 Image
Make your own children's book in a weekend, get it on Amazon and have the paperback in your hands within a week!

It's the experiment that started it all for me and ended up being featured in TIME, The Washington Post, Business Insider, and news outlets around the world!
Make your own animated short using MidJourney, ChatGPT, and a few other tools in less than 6 hours! Here's how I made a fan-made Batman one.

And a more detailed guide I wrote for @_buildspace:
buildspace.so/notes/animated…
Read 9 tweets
Mar 19, 2023
Turns out it did! It seemed to be describing the Wikipedia page of the game but that was all... so it was a true test—could we bring this game back to life based on just our understanding of it and a description? Image
I don't know how to write a line of 3D game programming code, so I asked GPT-4 to pick out how it would make the game, it suggested using BabylonJS, and HTML and CSS. Then I described exactly what we would borrow from SkyRoads and how this version would be different—prompt: Image
Once I got the code, I pasted it into @Replit the exact way GPT told me too, and it worked! Except... we were FAR from the final product. The green cube, our soon-to-be spaceship, had no ability to turn left or right no way to dodge those pesky obstacles. Well, GPT fixed that🚀
Read 15 tweets
Mar 19, 2023
So, you think GPT-4 can't make a complex game... think again!

Here's how I used GPT-4, @Replit, MidJourney, Claude, assembling a team of AI assistants, to create a 3D space runner from scratch with ZERO knowledge of Javascript or 3D game programming

Follow along for a saga! 🧵
After Snake, seeing @skirano's epic pong recreation, and @javilopen demoing Doom, I wanted to see if I could get GPT-4 to make a fully fledged 3D game. A childhood favorite game of mine was an MS-DOS game called SkyRoads, it was long forgotten. But... did GPT-4 know about it? Image
Turns out it did! It seemed to be describing the Wikipedia page of the game but that was all... so it was a true test—could we bring this game back to life based on just our understanding of it and a description? Image
Read 17 tweets
Jan 16, 2023
I spent 6 hours using ChatGPT, MidJourney, and a couple of other AI tools to make a fan-made Batman animated movie!

Here’s how 🧵
It started with the idea I had. I knew it was going to be about The Riddler (one of my favorites, and a huge fan of @mattreevesLA’s and Paul Dano’s rendition of the character) so I gave ChatGPT the prompt and we went back and forth on the monologue
I then used MidJourney to generate the artwork, broke down the lines from the script into different scenes I wanted and then went back and forth till I got a style that fit the eerie vibe I was going for
Read 8 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us!

:(