Inspiration

I have always been fascinated by how culture shapes the way people speak, think, and tell stories. At the same time, I am deeply interested in AI agents and human–AI interaction.

This project began with a simple question:

What if NPCs in a game could behave like culturally aware AI citizens instead of scripted characters?

I wanted to create a small world where virtual characters could represent different countries, speak with unique personalities, share real-world news from their homeland, and feel alive rather than pre-programmed.

This became Voices of the Town — a cultural exploration game powered by AI.

How I Built It

This project is a browser-based AI simulation built using modern web technologies, with Google’s Gemini 3 model serving as the intelligence core of the NPCs.

HTML/CSS for layout and visual design

Vanilla JavaScript (ES Modules) for game logic and interaction

Gemini 3 API as the main AI engine for NPC dialogue and personality

GNews API for country-specific real-world news

ElevenLabs Text-to-Speech for giving each NPC a unique voice

Gemini 3 as the Brain of the NPCs

At the heart of the project, Gemini 3 powers every conversation. Instead of relying on pre-written dialogue, each NPC generates responses dynamically based on:

Their cultural identity and personality prompt

The player’s message

Recent news from their home country

Each interaction is constructed through structured prompting, where Gemini 3 receives personality context and real-world information to produce natural, culturally grounded dialogue.

NPC Response=f(Personality Prompt,Player Message,Country News)

Gemini 3 enables the NPCs to:

Maintain a consistent personality

React differently to different players

Blend storytelling with real-world information

Feel less like scripted game characters and more like digital citizens

This transforms static NPCs into AI-driven agents capable of meaningful, context-aware conversation.

What I Learned

This project taught me a lot about AI integration in interactive systems:

Prompt Engineering for Personality

Small prompt adjustments can drastically change an AI character’s tone, politeness, humor, and storytelling style.

Real-World Data in Games

Integrating live news showed how external APIs can make virtual worlds feel connected to reality.

Voice as Identity

Adding Text-to-Speech made a huge difference. Voice adds emotion, cultural nuance, and a stronger sense of presence.

Multi-API System Design

I designed the system so multiple services (Gemini 3, News API, and TTS) worked together smoothly without blocking gameplay.

Challenges I Faced

Making NPCs Feel “Alive”

If prompts are too generic, characters feel robotic. If they are too detailed, responses become repetitive. Finding the right balance required extensive testing with Gemini 3 to keep personalities consistent but flexible.

Game Flow vs AI Latency

AI responses take time. I had to ensure the game still felt responsive while waiting for Gemini 3 text generation, news fetching, and voice synthesis.

Cultural Representation

It was important that NPCs felt culturally inspired without stereotyping. I focused on tone, interests, and storytelling style rather than clichés.

What This Project Represents

This is more than just a small browser game. It is an exploration of:

AI agents as digital citizens

Games as cultural bridges

Gemini-powered LLMs as tools for interactive storytelling

Voices of the Town shows how AI can transform static NPCs into living characters connected to the real world.

Built With

Share this project:

Updates