DEV Community

Cover image for Creating Mini-Games in the Age of Generative AI - Generating Ideas, Code, Graphics, and Sound
ABA Games
ABA Games

Posted on • Edited on

Creating Mini-Games in the Age of Generative AI - Generating Ideas, Code, Graphics, and Sound

In this context, what remains for humans to do... fine-tuning, perhaps?

Dodge the incoming red electrons and boost your score by navigating through the yellow paths between them! 🎮⚡️ abagames.github.io/crisp-game-l...

ABA (@abagames.bsky.social) 2025-01-25T07:19:16.838Z

I attempted to create this game using Claude 3.5 Sonnet and various image and music generation AI tools. Here, I would like to explain specifically how this was made. I hope this serves as a reference for mini-game development processes using generative AI.

Let's start with idea generation.

GitHub logo abagames / claude-one-button-game-creation

How to create a one-button action game using the AI chatbot Claude

Claude's One-Button Game Creation

I used the AI chatbot Claude to generate a one-button game using the crisp-game-lib library. By providing appropriate prompts and files to Claude 3.5 Sonnet, it can generate unique game ideas and create the corresponding game code in JavaScript.

How to use

By dropping set of 5 files in the chat_knowledge directory into the chat session of Claude and starting a chat, game generation can be performed.

You can also give files in the project_knowledge directory to project knowledge for use.

First, enter the theme of the game you want to create. If necessary, type 'proceed' to proceed to the next step.

Examples of Built Games

Click the image below to play directly in the browser.

wavybird screenshot catchingwheel screenshot grapplingh screenshot fracave screenshot blockstacker screenshot sunflowersway screenshot skyraftsman screenshot neonpollinator screenshot

LEVITATION / TURBO TUNNEL / VINE CLIMBER / BLADE DANCER / WIND POWER / ROTATION ROD / BASERUNNER DASH / FISH GRILL / ELASTIC HERO / STOMPING BUBBLES /…

Using the Knowledge contained in this repository, when you input a theme to Claude, it generates several ideas for one-button action mini-games. The Knowledge includes documentation of game development expertise, such as code and explanations of games I've made before, and possible ways to assign actions to a single button.

This time, I gave it "electronic circuits" as a theme. Claude returned the following ideas:


  1. Circuit Connector

    • Basic: A moving connector draws current along circuit paths.
    • Control: Hold to extend the connector, release to contract. Must connect to valid circuit points.
  2. Component Jumper

    • Basic: Player becomes a voltage pulse jumping between electronic components.
    • Control: Tap to jump between components while avoiding shorts and open circuits.
  3. Resistor Runner

    • Basic: Guide signals through a field of resistors that rotate when current flows.
    • Control: Hold to charge the current resistor, release to discharge and move to the next.
  4. Capacitor Chain

    • Basic: Match the timing of capacitor charge-discharge cycles to connect them.
    • Control: Hold to charge the current capacitor, release at the right timing to discharge to the next.
  5. Electron Flow

    • Basic: Player controls electron flow through circuits while avoiding reverse current.
    • Control: Hold to accelerate electrons, release to decelerate.

I chose number 5 this time. Then it returns detailed game specifications and code, so you can just try running the code. You can fine-tune any unsatisfactory parts through chat. This time, I made the following requests:

  • Shouldn't the player return to the left edge when reaching the right?
  • Please connect the top and bottom edges too.
  • Can you draw yellow lines between consecutively generated reverseCurrent elements, and award points when electrons pass through there?
  • Let's generate reverseCurrent at x=150 and make it possible to score points when passing between off-screen reverseCurrent elements.

This mostly completed the game's base. For score logic and game balance adjustments, it was faster to directly modify the code.

Next are the visuals. I gave Claude the following prompts:

  • What kind of background image would be suitable for this game?
  • Please create an English prompt to generate this image for an image generation AI.
    • Image: About 10 colors
    • Prompt: About 25 words, separated by commas. Emphasize words by enclosing them in () or (()).

You can give this to DALL-E, ImageFX, or any other image generation AI you prefer, and you'll get some kind of image. Then convert this to pixel art.

I created my own tool because I couldn't find many tools that met specific requirements like adjustable dithering strength and color palette selection. This tool can convert high-resolution images created by image generation AI into pixel art.

This time it wasn't too difficult since it was just the background, but trying to create game characters in the same way is quite challenging. Current image generation AI tools aren't good at generating sprite sheet-like images, much less supporting animation patterns. So you need to generate sprite-like images through trial and error, convert them to pixel art, and then manually write simple animation patterns. For example, the dinosaur in the following game.

Tap to jump, tap again to stomp! Crush the cactus to increase your score! Speed increases too! abagames.github.io/crisp-game-l...

ABA (@abagames.bsky.social) 2025-01-22T11:55:59.727Z

Next is the BGM.

  • What kind of BGM would be suitable for this game?
  • Please create an English prompt to generate this BGM for a music generation AI.
    • Music: 3-channel 8-bit chiptune using square waves. 150BPM
    • Prompt: About 15 words. Natural English sentences without using ()

You can give this to Suno, Udio, or others. It's best to use the prompt format preferred by your chosen music generation AI. If you have preferred music genres, you can freely add them to the prompt. This time I added 'Industrial techno' on a whim, though I'm not sure if it's reflected in the final result. Constraints like three channels don't seem to be strictly followed either.

Next are sound effects.

  • Please list the necessary sound effects for this game in bullet points.
  • Please create English prompts to generate these sound effects for a sound effect generation AI.
    • Sound Effects: Short 8-bit era effects using square waves
    • Prompt: About 25 words. Natural English sentences without using ()

I'm not sure what the de facto standard for sound effect generation AI is, but there are options like ElevenLabs and LOVO. I'd appreciate recommendations for good ones aimed at retro games.

With this, all code and assets are complete, so you just need to build it. The repository for this game is below.

In this way, it's possible to create all necessary game resources using generative AI. However, important fine-tuning, centered around game balance, is naturally better done by hand. While it's possible to repeatedly generate until you get ideas, code, graphics, and sound that you like, it's futile. Chat-based dialogue for fine-tuning resources still has many constraints with current generative AI.

If we could fine-tune through chat even for content that's difficult to express in text, such as graphics, sound, and more broadly, game experiences, game creation solely through chat might become more realistic. While it seems quite difficult to achieve these things from the current situation... well, that's what we say, but then suddenly it becomes easily possible - that's how the recent generative AI scene has been, so we really don't know what will happen. I'll wait patiently with expectation.

Top comments (0)