The Secret Recipe for Fun
What if you could build a game just by describing it? Today, you'll learn the secret language of "prompts" to team up with an AI co-pilot and turn your wildest ideas into something real you can play. Ready to be the boss? Let's go! π
Your AI Co-Pilot π€
Think of an AI as a super-fast, super-obedient robot that can draw, code, and build. But it has one big problem: it has no imagination! You are the creative director. Your wordsβyour "prompts"βare the instructions.
A good prompt is like a clear recipe. A bad prompt is like asking someone to bake "a cake" with no other instructions. Watch this quick video to see what generative AI is all about:
A weak prompt leads to a boring game. A strong, specific prompt... that's where the magic starts.
β Weak Prompt
"Make a cool space game where I shoot aliens."
Why it fails: β Too vague! The AI is confused. π€
β Strong Prompt
"Code a 2D top-down space shooter in HTML5 canvas. The player controls a blue ship with WASD. The core mechanic is that shooting costs fuel, but destroying red aliens drops fuel. The game gets 10% faster every 30 seconds."
Why it works: β Super clear! The AI knows exactly what to build. You're the boss! π
π¬ Why is this prompt so good?
- "Code a 2D top-down space shooter..." β Tells the AI the language, camera angle, and genre.
- "...in HTML5 canvas." β Tells the AI the exact tool to use, so it builds something we can run in a browser.
- "...shooting costs fuel, but destroying red aliens drops fuel." β This creates the core challenge, or 'game loop'! It's the risk vs. reward.
π‘ Key Terms Decoder
Click on the cards below to reveal the secret meaning behind game design words!
π
Genre
The type of game! Is it a Platformer like Mario? A Puzzle game? A Racer?
π₯
Mechanic
The main action, like jumping on things, collecting coins, or solving puzzles.
β³
Constraint
A rule that makes the game challenging, like "you only have 99 seconds!" or "the floor is lava!"
βοΈ Your First Game Prompt
Time to be the boss! Write the perfect "Day 1" prompt to generate the foundation of your game idea.
Your goal: Your prompt must mention the genre, the main mechanic, and player controls.
Stuck? Build-a-Prompt!
Click the buttons to build a sentence:
Create a where you control a with the to .
π The Iteration Loop: Finding the Fun
Your first prompt won't generate a perfect game. No one's does! The real secret to making fun stuff is the iteration loop. It's how you go from a basic idea to something that feels amazing to play.
βοΈ Pro Designer Challenge
The AI made your character jump, but they're floating away like a balloon! π± Tweak the gravity value below to make the jump feel right. (Hint: A normal value is around 0.8).
That's the loop: Prompt β Test β Tweak β Repeat! This is how you make your game feel fun.
π Level Up: Pro Prompting Techniques
Want the AI to give you even better results? Try these two secret weapons pros use:
- Use a Persona: Start your prompt by giving the AI a job. For example: "You are an expert game developer who specializes in clean, readable JavaScript. Your task is to..." This helps it focus on creating high-quality code.
- Few-Shot Prompts: Instead of just asking for something, give the AI an example first! "Here is some code for moving left and right. Now, write the code for jumping in the same style." This is called a "few-shot" prompt and it's super powerful.
π‘οΈ Safety Check: Be the Boss of Your AI
Using AI is like having a super-smart assistant, but you're always in charge. Remember these rules:
- AI can make mistakes. Sometimes it writes buggy code or makes up stuff that sounds true. That's normal! If you see anything weird or confusing, tell a parent. You're not in troubleβyou're being a great scientist.
- Keep personal info private. Never type your full name, school, address, or passwords into an AI. Think of it like a public notepadβkeep your secrets safe!
- You are the creator. The AI is a tool, like a pencil. The creative spark, the fun ideas, and the final game all come from you.
π οΈ Let's Build For Real!
Time to leave the simulator and fly a real ship! A master builder doesn't use one giant promptβthey build step-by-step, like a conversation.
Your Mission: With a parent, open an AI tool like Replit's AI and try this professional workflow, one prompt at a time:
- First Prompt: `Set up an HTML file with a black 800x600 game canvas.`
- Second Prompt: `Draw a red circle in the center of the canvas. This is the player.`
- Third Prompt: `Make the red circle move up, down, left, and right when I press the arrow keys.`
- Fourth Prompt: `Now, add a score. Every time I press the spacebar, increase the score by 1 and display it in the top-left corner in white text.`
- Fifth Prompt: `If the score reaches 10, stop the game and display a "You Win!" message in the center of the screen.`
- Final Boss Prompt: `Finally, add some "juice"! When the score increases, make the screen shake for a split second.`
π€ Your Prompt, Your Code
When you give the AI a prompt, it turns your words into real code. Click below to see a peek at what the AI might write for step #3!
π€« Show me the secret code!
// The AI writes code like this from your prompt!
// This listens for your key presses
window.addEventListener('keydown', function(event) {
if (event.key === 'ArrowRight') { // If you press 'β'
player.x += 5; // Move the player to the right
}
if (event.key === 'ArrowLeft') { // If you press 'β'
player.x -= 5; // Move the player to the left
}
});
π AI Detective Challenge
The best way to learn is to deconstruct! Check out this simple web game of Breakout: Simple Breakout Game. Can you write the step-by-step prompts a developer might have used to build it? Start with "Set up the canvas..." and see if you can describe the whole game in 5-7 prompts.
π¨βπ©βπ§ Parent Corner
Excited to see your child building? We recommend Replit as a great, browser-based starting environment. You can sign up for a free account and supervise your child as they use the AI features. This is a fantastic opportunity to talk about online safety and creative problem-solving together!
A note on professional tools: Replit is fantastic. As your builder grows, they may hear about tools like VS Code with an AI assistant like GitHub Copilot. The skills they're learning hereβbreaking down problems and writing clear promptsβare exactly the same ones the pros use every day.
Dinner Table Prompt: Ask your creator: "If you could add any superpower to your game's character, what would it be and why?"
Write a passing prompt in the challenge above to complete this module!