DEV Community

Anatoly
Anatoly

Posted on

AI-Sandbox

Gemma 4 Challenge: Build With Gemma 4 Submission

*This is a submission for the Gemma

What I Built

I built AI Sandbox, a first-person 3D sandbox game made in Godot 4.x with GDScript. It is inspired by the freedom of Garry’s Mod: the player can spawn physics props, build small structures, pin objects in the air, throw items, interact with benches, chairs, blankets, boomboxes, water, tools, weather, and a command console.

The main idea is that the player does not explore the sandbox alone. The world includes an AI-powered NPC that lives inside the same space. It can look around, talk, react to the player, walk to places, remember recent events, sit on objects, swim, build props, move items, and use sandbox tools.

The experience I wanted to create is a small living playground where the player can experiment freely while an AI companion understands the world, responds naturally, and participates instead of just standing there as a scripted character.

Demo

Code

https://github.com/CrazyDashTool/AI-sandbox

How I Used Gemma 4

I used Gemma 4 31B Dense as the brain of the NPC. In the project, the default Google model is:

gemma-4-31b-it
For OpenRouter, the default model is:

google/gemma-4-31b-it:free
Every time the NPC thinks, the game sends Gemma a structured prompt containing the current world state, recent player actions, conversation memory, active music, weather, water state, known places, and a 1280×720 screenshot from the NPC’s own camera. Gemma then responds with a JSON decision:

{
"visual_observation": "what the NPC sees",
"speech": "what the NPC says",
"action": "what the NPC does",
"emotion": "how the NPC feels"
}

The game parses that JSON and turns it into real in-game behavior: speech bubbles, emotion color changes, movement, building, object interaction, sitting, swimming, looking at the player, and more.

I chose 31B Dense because the NPC needs more than simple chat. It has to combine visual understanding, memory, player instructions, world context, and strict JSON output while still sounding like a believable character. The larger model gives the NPC better situational awareness and more natural decisions, which is exactly what this sandbox needs.

Team Submissions: @crazydashtool <-(Me, created a game) @__66_55 <-(My friend, created 3d assets)

Top comments (0)