跳到正文
原文
Google AI:DEV 作者专属(RSS)· Shuvo·· 5 小时前AI 评分37

朋友 Game Boy Color 被偷后,我用 Gemma 3 4B 做了个浏览器版

My friend's Game Boy got stolen so I built him one

AI 导读

因朋友的 Game Boy Color 被偷且二手价高难寻,开发者用 mGBA 核心编译成 WebAssembly,在 Vite + TypeScript 项目中做出浏览器版 Game Boy Color,可玩真实 Game Boy 游戏。

正文

Cover image for My friend's Game Boy got stolen so I built him one

Shuvo

Hacktoberfest Weekend Challenge: Build for a Friend Submission 🤝

This is a submission for the Hacktoberfest Weekend Challenge: Build for a Friend

My friend's Game Boy Color got stolen. Rude. Then he went looking for a replacement and found out that decent used ones are now rare, overpriced, or "mint condition" in the way that means "mint-flavored lie."

So I built him a new one that can't be stolen: a Game Boy Color in the browser. It's teal, it has a D-pad that clicks, and it plays real Game Boy games.

The twist is that he never has to scroll through a ROM list. He just tells it what he's in the mood for:

"I want to play a game involving Pokémon."

A small AI reads the request, picks a game from the collection, and boots it. He can type the request or tap the mic and say it out loud. A bit like a game store clerk who lives inside the console.

Demo

Game demo

Code

Demo

Browser-based Gameboy Color Emulator

with AI game search capabilities using Google gemma 4b

Note: For the AI feature to work you need to have https://ollama.com/library/gemma3:4b installed and running on your machine.

in the package.json file there is a script called "start:ai" which will start the ollama server.

How I Built It

  • Emulator: The mGBA core compiled to WebAssembly, wired up in a Vite + TypeScript project. It loads ROMs straight from public/gameroms, including ones packed inside ZIP files.
  • Controls: Keyboard (Z/X/Enter/Shift), touch buttons on the on-screen console, and gamepad support.
  • The AI picker: Gemma 3 (4B), running locally through Ollama. When he makes a request, the app sends it along with the list of available games. Gemma picks the best match and the emulator loads it.
  • Voice: The browser's built-in speech recognition fills in the prompt and submits it when he stops talking. It's not an AI model, but it makes the whole thing feel like magic.
  • Escape hatch: If he knows what he wants, "Choose a game instead" opens a normal list.

The prompt is simple: "here's what the player wants, here's the game list, pick one." The game list is just a file (src/games.ts), so adding a game means dropping a ROM in a folder and adding its name.

Why Does Open Innovation Matter?

This project needed an AI that could do one small job well: match a vibe to a filename. A giant cloud model would be overkill, and a cloud API would have made it worse in a few ways:

  • It costs nothing. No API key, no per-request bill, no "you've hit your limit" while someone is trying to play Pokémon. For a gift to a friend, that matters.
  • It runs locally. His requests never leave the machine. Nobody needs to know what he plays at 2 AM.
  • It's swappable. Gemma 3 4B was small and fast enough. If a different model picks better, it's one line to change.
  • It doesn't break on me. No deprecation emails, no pricing changes, no surprise outages. The model is on the disk, and it stays there.

A 4B open model on a normal machine turned out to be plenty for this. It does the job without anyone's permission or a credit card.

Prize Categories

Best Use of Gemma: Gemma 3 (4B) running locally through Ollama powers the natural-language game picker.

来源:Google AI:DEV 作者专属(RSS) · dev.to