Learn AI development by playing a game! A fun, interactive JavaScript adventure that teaches you how to use Microsoft Foundry Local and AI tools, one level at a time.
No installation required! Play the web version directly in your browser:
๐ Play Foundry Learning Adventure ๐
The web version includes all 5 levels and works completely in your browser with simulated AI responses.
For the full AI experience, install Foundry Local. No port configuration needed. The CLI game uses the foundry-local-sdk npm package to discover, download, and load models automatically. The web game scans for the Foundry Local service on known ports.
# Install Foundry Local
winget install Microsoft.FoundryLocal
# CLI game: the SDK downloads and loads the model for you
cd game && npm install && npm start- What is This Game?
- What You'll Learn
- Play Online (GitHub Pages)
- Quick Start
- Installation Guide
- How to Play
- Level Guide
- Game Screenshots
- Commands Reference
- Rewards & Badges
- Deploy to GitHub Pages
- Troubleshooting
- FAQ
- Project Structure
- Running Tests
- Contributing
The Foundry Local Learning Adventure is an educational game designed for complete beginners who want to learn about:
- ๐ค AI/ML Basics - How AI models work and respond
- ๐ฌ Prompt Engineering - Writing effective prompts
- ๐ Embeddings - How AI understands meaning
- โก AI Workflows - Chaining operations together
- ๐ง Tool Building - Extending AI capabilities
You do not need any prior AI experience! Just follow along, complete challenges, and earn badges as you learn.
- ๐จโ๐ Students learning about AI
- ๐ฉโ๐ป Developers new to AI tools
- ๐จ Anyone curious about how AI works
- ๐ Educators teaching AI concepts
| Level | Topic | What You Will Master |
|---|---|---|
| 1 | Meet the Model | Making your first AI API call |
| 2 | Prompt Mastery | Writing effective prompts |
| 3 | Embeddings Explorer | Semantic search & similarity |
| 4 | Workflow Wizard | Building AI pipelines |
| 5 | Build Your Own Tool | Creating custom AI tools |
The web version runs entirely in your browser with no installation required:
- All 5 levels with interactive challenges
- Progress saved automatically (localStorage)
- Works on desktop, tablet, and mobile
- Starts in Demo Mode; connects to real Foundry Local automatically if installed
- Model selector dropdown lets you switch between available models
- Real-time connection status shows scanning, loading, and download progress
Tip for educators: Fork the repo, enable GitHub Pages, and share the link with your class. Students can start learning immediately with zero setup.
When you are ready for real AI interactions, try the CLI version with Foundry Local.
Choose how you want to play:
| Option | Best For | How to Start |
|---|---|---|
| ๐ Play Online | Classrooms, quick demos, mobile | Click the link (no install needed) |
| ๐ Run Web Locally | Offline use, local development | cd game then run scripts/start-web.ps1 |
| ๐ป CLI (Terminal) | Power users, traceable prompts | cd game && npm start |
All three options start in Demo Mode (simulated AI). Install Foundry Local for real AI responses. The game discovers models automatically.
No installation required - play directly in your browser:
๐ Play Now ๐
Using startup scripts (easiest):
Windows (Batch):
cd game
scripts\start-web.batWindows (PowerShell):
cd game
powershell -ExecutionPolicy Bypass -File scripts\start-web.ps1Mac/Linux:
cd game
chmod +x scripts/start-web.sh
./scripts/start-web.shOr manually start a server:
# Navigate to web folder
cd game/web
# Start a local server (choose one):
npx http-server -p 8080 -c-1
# OR
python -m http.server 8080
# OR
python3 -m http.server 8080Then open http://localhost:8080 in your browser.
For real AI responses with Foundry Local:
-
Download or clone this repository
-
Navigate to the
gamefolder -
Run one of these options:
Option A - Batch File (double-click):
scripts\start-game.bat
Option B - PowerShell (recommended):
powershell -ExecutionPolicy Bypass -File scripts\start-game.ps1
-
Follow the on-screen prompts
-
Start playing!
# Clone the repository
git clone <repository-url>
cd game
# Make the script executable
chmod +x scripts/start-game.sh
# Run the game
./scripts/start-game.shcd game
npm install
npm startNode.js is required to run this game. It is free and easy to install.
- Visit nodejs.org
- Download the LTS version (green button)
- Run the installer
- Click "Next" through all options
- Restart your terminal after installing
- Done! โ
# Using Homebrew (recommended)
brew install node
# Or download from nodejs.orgsudo apt update
sudo apt install nodejs npmOpen a terminal/command prompt and type:
node --versionYou should see something like v18.x.x or higher.
- Click the green "Code" button on the repository page
- Select "Download ZIP"
- Extract to a folder you can easily find (e.g., Desktop)
git clone https://github.com/leestott/FoundryLocal-LearningAdventure.git
cd FoundryLocal-LearningAdventureOpen a terminal in the game folder:
cd game
npm installThis downloads all required packages. You only need to do this once.
The game works without Foundry Local (in demo mode), but for the full AI experience:
winget install Microsoft.FoundryLocalThe CLI game uses the foundry-local-sdk to discover, download, and load models automatically. You do not need to start a model manually:
cd game
npm install
npm startThe SDK will find available models, download any that are missing, and load the best one for you.
Windows (Batch):
cd game
scripts\start-game.batWindows (PowerShell):
cd game
powershell -ExecutionPolicy Bypass -File scripts\start-game.ps1Mac/Linux:
cd game
chmod +x scripts/start-game.sh
./scripts/start-game.shnpm startWhen you start the game, you will see a welcome screen:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ๐ฎ FOUNDRY LOCAL LEARNING ADVENTURE ๐ฎ โ
โ โ
โ Master Microsoft Foundry AI - One Level at a Time! โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
- Start a level: Type
play 1to start Level 1 - Follow instructions: Each level explains what to do
- Complete the task: Try the challenge
- Get help if stuck: Type
hintfor tips - Earn rewards: Complete levels to unlock badges!
Throughout the game, Sage will guide you:
- ๐ Introduces each level
- ๐ก Provides helpful hints
- โ Answers your questions
- ๐ Celebrates your wins!
Type ask [your question] anytime to chat with Sage.
What you will do: Send your first message to an AI and get a response.
What you will learn:
- How AI models communicate
- The request/response pattern
- What happens when you call an AI
Example:
Your prompt: Hello! Please introduce yourself.
Tips:
- Just type a friendly greeting
- Watch how the AI responds
- There is no wrong answer here!
Badge Earned: ๐ฏ Prompt Apprentice (100 points)
What you will do: Improve a poorly written prompt and compare results.
What you will learn:
- Why prompt quality matters
- How to be specific and clear
- The difference good prompts make
The Challenge:
Bad prompt: "tell me stuff about coding"
Your task: Write a better version!
Tips:
- Be specific (what topic? what language?)
- Add context (your skill level, format wanted)
- Ask for examples
Badge Earned: โ๏ธ Prompt Engineer (150 points)
What you will do: Search a knowledge base using semantic similarity.
What you will learn:
- How AI understands meaning (not just keywords)
- What embeddings are and how they work
- How semantic search finds related content
Example:
Your query: "How do I run AI offline?"
Result: Finds content about Foundry Local's offline capabilities
Tips:
- Think about meaning, not exact words
- Try different ways of asking the same thing
- See how similar concepts connect
Badge Earned: ๐ Embedding Explorer (200 points)
What you will do: Build a 3-step AI pipeline that processes text.
What you will learn:
- How to chain AI operations together
- Passing output from one step to the next
- Automating complex multi-step tasks
The Pipeline:
Step 1: Summarize text
โ
Step 2: Extract keywords
โ
Step 3: Generate questions
Tips:
- Watch how each step uses the previous output
- Think about other workflows you could build
- This is how real AI applications work!
Badge Earned: โก Workflow Wizard (250 points)
What you will do: Create a JavaScript function and let AI use it.
What you will learn:
- What AI tools/functions are
- How agents call external code
- Extending what AI can do
Example Tool:
// A simple calculator tool
function add_numbers(a, b) {
return a + b;
}Tips:
- Keep your function simple
- Add clear descriptions
- The AI will learn to call your tool!
Badge Earned: ๐ Foundry Champion (300 points)
When you first open the game, you will see a friendly welcome screen:
After entering your name, choose from 5 progressive levels:
Your first interaction with an AI model:
Watch the AI respond to your prompts in real-time:
Get help anytime from Sage, your friendly mentor:
Stuck? Use hints to guide your learning:
Track your points, badges, and completion status:
Earn badges as you master each concept:
Note: Screenshots are captured automatically using Playwright. The terminal version has similar functionality with a text-based interface.
See the game in action with our walkthrough videos:
- Desktop Walkthrough: Full game experience (1280ร720)
- Mobile Walkthrough: Mobile-responsive view (375ร812)
| Command | What It Does | Example |
|---|---|---|
play [n] |
Start level n | play 1 |
levels |
Show all levels | levels |
progress |
View your stats | progress |
badges |
See earned badges | badges |
hint |
Get a hint | hint |
ask [text] |
Ask the mentor | ask what are embeddings? |
explain [x] |
Explain a concept | explain prompt engineering |
help |
Show commands | help |
reset |
Reset progress | reset |
quit |
Save & exit | quit |
| Badge | Level | Points | For |
|---|---|---|---|
| ๐ฏ Prompt Apprentice | 1 | 100 | First AI call |
| โ๏ธ Prompt Engineer | 2 | 150 | Better prompts |
| ๐ Embedding Explorer | 3 | 200 | Semantic search |
| โก Workflow Wizard | 4 | 250 | AI pipelines |
| ๐ Foundry Champion | 5 | 300 | All complete! |
| Points | Title | Description |
|---|---|---|
| 100 | Beginner | Just getting started! |
| 250 | Learner | Making progress! |
| 500 | Practitioner | Getting skilled! |
| 750 | Expert | Almost a master! |
| 1000 | Master | You have done it all! |
- ๐ฃ First Steps - Complete your first level
- ๐ Halfway Hero - Complete 50% of levels
- โก Speed Learner - Complete a level in under 5 minutes
- ๐ง Hint-Free Hero - Complete without using hints
- โ Curious Mind - Ask 10 questions
- ๐ Master Graduate - Complete everything!
Deploy your own copy of the game to GitHub Pages for free hosting!
-
Fork this repository to your GitHub account
-
Enable GitHub Pages:
- Go to your repo's Settings โ Pages
- Source: Select GitHub Actions
-
Push to main branch - deployment happens automatically!
-
Access your game at:
https://YOUR-USERNAME.github.io/FoundryLocal-LearningAdventure/
-
Fork this repository
-
Enable GitHub Pages:
- Go to Settings โ Pages
- Source: Deploy from a branch
- Branch:
main - Folder:
/game/web
-
Wait 2-3 minutes for deployment
-
Visit
https://YOUR-USERNAME.github.io/FoundryLocal-LearningAdventure/
Local testing: See the Quick Start section for running the web version on your machine.
What happened: Node.js is not installed or is not in your PATH.
Fix:
- Download Node.js from nodejs.org
- Choose the LTS version
- Run the installer (accept defaults)
- Close and reopen your terminal
- Try again
What happened: The game cannot connect to Foundry Local.
This is fine! The game will work in "demo mode" with simulated responses.
To enable full AI:
- Install Foundry Local:
winget install Microsoft.FoundryLocal - Run
npm startin thegamefolder - The SDK will discover, download, and load a model automatically
Note: The CLI game uses the
foundry-local-sdknpm package, which manages the Foundry Local service lifecycle (starting, model loading) internally. You do not need to start a model or configure a port manually. The web version scans common ports (61341, 5272, 51319, 5000, 8080) to find the running service.
What happened: Dependencies are not installed.
Fix:
cd game
npm install
npm startWhat happened: The game cannot write to the progress file.
Fix:
- Use
quitcommand to exit (not Ctrl+C) - Check that
data/progress.jsonexists - Make sure you have write permission
- Try:
npm run resetto create a fresh progress file
What happened: The AI call is taking a while.
Fix:
- Wait 10 to 15 seconds (AI can be slow)
- If using Foundry Local, check it is still running
- Press Ctrl+C to cancel and try again
- The game will use demo mode if AI is unavailable
No! The game teaches concepts through interaction. You will learn as you go.
No! Everything runs on your computer. That is what "Local" means.
No! The game has a demo mode. But you will get better responses with it.
No, levels unlock in order. Each one builds on previous concepts.
Most people finish in 1 to 2 hours. Take your time and enjoy!
No problem! That is how you learn. Use hint or ask for help.
Yes! Type play [number] to replay any completed level.
Type reset in the game, or run npm run reset.
FoundryLocal-LearningAdventure/
โโโ README.md # This file!
โโโ AGENTS.md # AI agent conventions
โโโ changelog.md # Version history
โโโ LICENSE # MIT Licence
โโโ CONTRIBUTING.md # Contribution guidelines
โโโ SECURITY.md # Security policy
โโโ .gitignore # Git ignore rules
โโโ .github/ # GitHub configuration
โ โโโ workflows/ # CI/CD workflows
โ โโโ deploy.yml # GitHub Pages deployment
โ โโโ test.yml # Automated testing
โโโ game/ # Game source code
โโโ src/ # Source code (Node.js version)
โ โโโ game.js # Main game engine (uses foundry-local-sdk)
โ โโโ levels.js # Level management and tasks
โ โโโ mentor.js # AI mentor (Sage)
โโโ web/ # Web version (GitHub Pages)
โ โโโ index.html # Main HTML page
โ โโโ styles.css # Game styling
โ โโโ game-web.js # Web game engine
โ โโโ game-data.js # Levels, rewards, mentor data
โโโ data/ # Game data (JSON)
โ โโโ levels.json # Level definitions
โ โโโ rewards.json # Badges and achievements
โ โโโ progress.json # Your saved progress
โโโ screenshots/ # Game screenshots
โโโ tests/ # Test files
โโโ scripts/ # All startup scripts
โ โโโ start-game.bat # Windows CLI launcher
โ โโโ start-game.ps1 # PowerShell CLI launcher
โ โโโ start-game.sh # Mac/Linux CLI launcher
โ โโโ start-web.bat # Windows Web launcher
โ โโโ start-web.ps1 # PowerShell Web launcher
โ โโโ start-web.sh # Mac/Linux Web launcher
โโโ config.json # Settings
โโโ package.json # Node.js configuration (includes foundry-local-sdk)
Make sure everything is working:
# Run all tests
npm test
# Check Foundry Local status (Windows)
npm run test:foundry
# Reset your progress
npm run resetCapture screenshots automatically using Playwright:
# Navigate to game folder
cd game
# Install Playwright (first time only)
npm run test:install
# Capture all screenshots
npm run test:screenshotsScreenshots are saved to game/screenshots/.
Test output shows:
- โ Passed tests (green)
- โ Failed tests (red)
- โญ๏ธ Skipped tests (yellow - usually means Foundry Local not running)
Edit config.json to customise:
{
"foundryLocal": {
"defaultModel": "Phi-3.5-mini-instruct-generic-cpu:1",
"sdkAppName": "FoundryLearningAdventure",
"sdkLogLevel": "warn"
},
"azureFoundry": {
"enabled": false,
"endpoint": "https://YOUR-RESOURCE.openai.azure.com",
"apiKey": "YOUR-API-KEY",
"apiVersion": "2024-02-01",
"deploymentName": "gpt-4o-mini"
},
"game": {
"maxHintsPerLevel": 3,
"demoModeEnabled": true
}
}The game automatically detects available AI services:
| Priority | Mode | Description |
|---|---|---|
| 1 | Foundry Local | Uses local AI model via the foundry-local-sdk (CLI) or HTTP port scanning (web) |
| 2 | Azure OpenAI | Uses Azure cloud if configured |
| 3 | Demo Mode | Simulated responses (fallback) |
To use Azure OpenAI instead of local models:
- Create an Azure OpenAI resource at Azure Portal
- Deploy a model (e.g., gpt-4o-mini)
- Update config.json:
{ "azureFoundry": { "enabled": true, "endpoint": "https://your-resource.openai.azure.com", "apiKey": "your-api-key", "deploymentName": "gpt-4o-mini" } } - Run the game - it will connect to Azure!
- Different model: Change
defaultModelto your preferred model alias - More hints: Increase
maxHintsPerLevel - SDK logging: Set
sdkLogLevelto"info"or"debug"for more detailed output
We welcome contributions! Here is how:
- Fork the repository
- Create a branch:
git checkout -b my-feature - Make your changes
- Test:
npm test - Commit:
git commit -m "Add my feature" - Push:
git push origin my-feature - Open a Pull Request
- ๐ New levels teaching more concepts
- ๐ Translations to other languages
- ๐จ Visual/UX improvements
- ๐ Bug fixes
- ๐ Documentation improvements
- ๐งช More tests
- Foundry Local Documentation
- Prompt Engineering Guide
- Understanding Embeddings
- AI Fundamentals Learning Path
MIT Licence - Feel free to use, modify, and share!
See LICENSE for details.
- ๐ Bug? Open an issue
- ๐ก Idea? Start a discussion
- โ Question? Check FAQ or open an issue







