Learning Timeline
Key Insights
One-Shot Prompting Tips
The more specific you are about 'Game Logic' (e.g., gravity, object speed, Collision Detection), the fewer errors or bugs the AI will produce in the code.
Use the Preview Feature
Google AI Studio has a built-in renderer. You don't need to copy the code to Notepad or VS Code to see the results; simply click the 'Preview' icon at the top right of the code block.
Prompts
One-Shot Game Generation Prompt
Target:
Gemini 1.5 Pro
Create a complete, single-file web-based game using HTML5, CSS, and JavaScript. The game should be a 'Side-scroller Runner'.
Requirements:
1. Visuals: Use a BIack neon aesthetic. The player is a bright cyan square, and obstacles are red triangles.
2. Controls: Press 'Spacebar' or 'Click' to jump.
3. Logic: Obstacles move from right to left at increasing speeds. Score increases based on survival time.
4. UI: Include a 'Start Game' screen, a live score display, and a 'Game Over' screen with a 'Play Again' button.
5. Technical: Keep all CSS and JS internal within the HTML file. Ensure the code is responsive.
Step by Step
Steps to Generate a One-Shot Game in Google AI Studio
- Visit the Google AI Studio website (aistudio.google.com).
- In the right-hand panel, click the 'Model' dropdown and select 'Gemini 1.5 Pro' or 'Gemini 1.5 Flash' for the best performance.
- Ensure the 'System Instruction' field is empty if you want to input all instructions directly into the 'Prompt' area.
- Type a descriptive prompt that includes: Game genre, control mechanics (keyboard/mouse), scoring system, and visual style (CSS).
- Click the 'Run' button at the bottom to start the code generation process.
- Once Gemini finishes generating the code (usually in a single HTML/CSS/JS block), click the 'Preview' button at the top of the code block to try the game immediately.
- If there are errors or missing features, type your feedback in the chat box (e.g., 'Add a Restart button') and click 'Run' again.