Lesson Notes — Editing the Template with AI Help
Course 2: Game Design & Development Principles / Unit 6: Game Design Mechanics, Rules & Documentation / Lesson 9: Editing the Template with AI Help
Lesson overview
In the next lessons you will change One Life with an expansion, also called a mod: a folder you add to the game without touching the game itself. The expansion is written in JavaScript. You do not need to know JavaScript to do this. You are encouraged to use an AI tool to write the JavaScript for your expansion. This lesson teaches you how to do that well, because an AI tool is only as good as the instructions you give it and the testing you do afterward.
Step 1: What you are actually editing
You start from the expansion template: a ready-made file that already works and is full of plain-English comments explaining what each part is for. You will not write a program from nothing. You change a number, a word, or a rule, and everything else stays the same. Think of JavaScript as the language the game speaks, and the AI tool as your translator. Your job is to say clearly what you want. The AI’s job is to say it in JavaScript.
Step 2: Ground rules for using an AI tool
- Use the AI tool your teacher approves for this class.
- Never type your name, your password or any personal information into an AI tool.
- AI can sound sure and still be wrong. You are responsible for what you submit, so you test everything.
- You must be able to say in your own words what your change does. You will need this when you document your mod.
Step 3: Write a prompt that works
A good prompt has four parts:
| Part | What to say | Example |
|---|---|---|
| Context | What the file is and that you are new to code. | ‘This is the expansion template file for a browser game. I do not know JavaScript.’ |
| Goal | The change, in plain English and as specific as you can make it. | ‘Make one hangout with a friend give 2 popularity points instead of 1.’ |
| Limits | What must not change. | ‘Change only that. Keep every comment and every other line exactly as it is.’ |
| Explain | Ask for an explanation you can understand. | ‘Tell me which lines you changed and what each change does, in words a ninth grader would understand.’ |
Then paste the whole template file into the AI tool along with your prompt. Giving it the real file is what keeps the answer matched to the game.
Step 4: Check the answer without knowing JavaScript
You can judge an answer without reading code like a programmer. Check these things:
- Did it change only what you asked? If it rewrote the whole file or removed lines, tell it to try again and change only the one thing.
- Did it explain every change? If you do not understand the explanation, ask again in simpler words.
- Is anything suspicious? A game change should not need web addresses, installing anything, or words like fetch or eval. If the answer has them, ask the AI why, and show your teacher if you are still unsure.
- Can you say what it will do? Write it in your own words before you run it.
Step 5: The test loop
- Make a backup copy of your working expansion file before you change it.
- Put the AI’s new version in your expansion file and save it.
- Reload One Life and play to the place where your change should show up.
- If it works, save a new backup. If it does not, press F12 and open the Console tab. Copy the first red message, paste it to the AI along with your file, and ask for a fix. A red message often points to a syntax error, which is a typing mistake in the code such as a missing bracket.
- If it is still broken after three tries, go back to your last backup. If the whole game acts wrong, delete your expansion folder. The game goes back to normal because your expansion never touched the core game.
Your turn
- Write the change you want in plain English in Section 1 of the Prompt Planner.
- Write your prompt using Context, Goal, Limits and Explain in Section 2.
- Ask your AI tool, then check its answer with the list in Section 3.
- Trade prompts with a partner. Does their prompt give you enough to understand the change?
- Finish Section 5 in your own words and submit the Prompt Planner in Google Classroom.
In the next lesson you will place your expansion folder in the game and run your first mod.