1

Title Slide - Head-to-Head Battle

00:00-03:00
Lesson 6 is the peak of the course - the lesson that combines everything we've learned and adds a new layer: Multiplayer. We chose Tank Duel because it's a turn-based game that teaches advanced physics (projectile movement in a parabola), a turn system, and impressive explosions. The game is inspired by classics like Scorched Earth, Worms, and Artillery Duel.
Scorched Earth (1991) was one of the first and most popular turn-based battle games. Worms (1995) took the concept and turned it into a global franchise. We are building a simple but impressive version of this genre.

Share screen with the finished game - two tanks, one firing and the projectile flying in a parabola and hitting "Good evening everyone! Welcome to the final lesson of the course - the coolest lesson of them all."

"Do you see this? Two tanks. Each of you will control one tank. You'll choose an angle, choose power, and fire."

Demonstrate a shot - the projectile flies in a parabola, hits, explosion! "Look at the projectile. It doesn't move in a straight line - it flies in a parabola. Just like in real life. Gravity pulls it down exactly like a ball being thrown."

"Today we're not just building a game. We're learning real physics."

"And at the end of the lesson? You'll play against each other. Tank vs Tank. One keyboard, two players, a real battle."

The opening should be dramatic and exciting - it's the last lesson! Demonstrate the finished game to show them where we're headed. It's important to emphasize the parabola - it's the magic ingredient. If possible, demonstrate a shot that misses and then one that hits.
2

History - The First Game and Turn-based Battles

Pong (1972) was the first commercial game in history. Two players, one keyboard (or joysticks), a bouncing ball. This proved that video games could be social - playing together instead of alone.

Tank Wars / Artillery Games (1980s) took the idea a step further: instead of fast reflexes, strategic thinking.

"Before we start building, let's talk about history for a moment."

"The first commercial game in history was Pong - 1972. Two players, paddles, a ball. Simple but revolutionary."

"Why? Because it was social. Two people next to one machine, competing. Not computer against person - person against person."

"The game we're building today belongs to a different genre: Artillery Games - cannon games. This genre started in the 80s with games like Tank Wars."

"Instead of fast reflexes, you need thinking. What angle? what power? If I make a mistake - my opponent takes advantage."

3

Local Multiplayer - Two Players, One Keyboard

03:00-08:00
Local Multiplayer: two players on the same device (one keyboard/screen). Simple to implement, fun to play together.

Online Multiplayer: two players on different devices over the internet. Complex - requires servers, synchronization, Netcode.
Local Multiplayer has made a comeback in recent years. Games like Overcooked, Gang Beasts, and Moving Out became global hits. Why? Because it's a social experience - people in the same room, laughing together.

"There are two types of Multiplayer: Local and Online."

"Online - that's when everyone is on their own computer, connected via the internet. It's complicated. You need servers, synchronization, a lot of code."

"Local - it's simple. Two players, the same keyboard. One uses WASD, the other uses arrows. One sits on the left, the other on the right."

"And it's not just simple - it's also more fun. You see the expression on your opponent's face when they miss. You hear them shout when you hit."

"Local Multiplayer is much more than code - it's a social experience."

4

Input Handling - Managing Multiple Inputs

Key Mapping: Assigning different keys to different players.

Player 1: W (Up), S (Down), D (Shoot)
Player 2: Arrow Up (Up), Arrow Down (Down), Arrow Right or SPACE (Shoot)

In code: we need to identify which key was pressed and update the correct player.
In the industry, we use a data structure called an Input Map - a table that connects keys to actions. This allows the player to customize keys (Key Rebinding).

"When there are two players, there's a problem: two sets of keys."

"Player 1 uses WASD. Why? Because it's on the left side of the keyboard - convenient for someone sitting on the left."

"Player 2 uses arrows. Why? Because it's on the right side - convenient for someone sitting on the right."

"In code, we need to recognize: 'Wait, was W pressed or Arrow Up? If W - update the first player. If Arrow - update the second'."

"This is called Key Mapping. It's the basis for every local multiplayer game."

5

The First Prompt - Building the Engine

08:00-15:00
The game consists of 4 main components:

1. Two tanks - fixed position on the sides of the screen, with a moving barrel
2. Angle system - each tank can aim the barrel up/down
3. Power system - how strong the shot is (Power bar)
4. Parabolic projectile - flies according to the laws of physics
Create a Tank Duel game in a single index.html file using HTML5 Canvas. GAME SETUP: 1. Two tanks positioned at opposite sides of the screen (left and right) 2. Each tank has a barrel that rotates to aim 3. Dark battlefield background with a ground line CONTROLS: - Player 1 (left tank): W/S to adjust angle, D to shoot - Player 2 (right tank): Arrow Up/Down to adjust angle, Space to shoot PHYSICS: - Projectiles follow realistic parabolic trajectory with gravity - Show angle indicator on each tank - Display power meter (starts at 50%, adjust with time held) VISUAL STYLE: - Dark blue/gray battlefield - Neon green tank for Player 1, Neon red tank for Player 2 - Yellow projectiles - Retro/arcade aesthetic

Open Antigravity, new project named TankDuel "Everyone open Antigravity. New project. Call it TankDuel or BattleTanks."

"We're going to ask the agent to build the base. Two tanks, an aiming system, and real physics."

Type the prompt and press Generate "Notice the instructions. I'm asking for real physics - 'realistic parabolic trajectory with gravity'."

"I'm also asking for a Power Meter. Why? Because the longer we hold the key, the stronger the shot will be. This adds a layer of skill."

Wait for completion and click Preview "The agent finished. Let's see what we have..."

Demonstrate the game - change angle, fire, projectile flies "Wow. look at this. We have two tanks. I press W - the barrel moves up. S - down. D - hits!"

"And look at the projectile. It doesn't move in a straight line. It makes an arc. This is a real mathematical parabola."

The first shot should be dramatic! Take a few tries to show that it's not easy - it shows there's a challenge. If the projectile flies off-screen or hits the ground, that's fine - it's part of the fun. Let students understand that they need thinking, not just random clicking.
6

Projectile Motion - How It Moves

When firing a projectile, it moves in two directions simultaneously:

Horizontal (X): Constant speed (no air resistance in our game)
Vertical (Y): Starts with high speed upwards, but gravity slows it down until the projectile falls

The formulas:
vx = power * cos(angle) - horizontal velocity
vy = power * sin(angle) - initial vertical velocity
vy += gravity - gravity adds to vertical velocity every frame
This is exactly the same math used in high school physics! Sin and Cos break down the angle into X and Y components. In the real world, there's also air resistance, but we ignore it for simplicity.

"Let's understand what happens when the projectile flies. There's real physics here."

"When firing, the projectile gets velocity in two directions: X (side to side) and Y (up and down)."

"The horizontal velocity (X) remains constant. But the vertical velocity (Y)? It changes all the time because of gravity."

"At first, the projectile moves fast upwards. But gravity slows it down... slows it down... until it stops in the air for a moment, and then starts falling."

"It's exactly like throwing a ball up in real life. It goes up, stops, comes down. Same physics."

"Our agent wrote this math. It took the angle we chose, the power, and turned it into realistic movement."

7

Angle & Power - Mastery through Skill

15:00-22:00
Angle: Shooting direction. 0° = horizontal, 45° = optimal for range, 90° = straight up

Power: How strong the shot is. 0% = the projectile falls next to the tank, 100% = it flies far away

Power Bar: Visual indicator that shows power in real-time - the longer you hold the key, the power increases.
Improve the Power system: 1. When holding the shoot key (D or Space), show a growing Power Bar above the tank 2. Power starts at 0% and increases over time (up to 100% after 2 seconds) 3. When released, shoot with that power level 4. Visual: animated bar that fills up with color gradient (green → yellow → red) 5. Display current angle in degrees next to each tank

"We have a small problem. Right now, the power is always the same. That's boring."

"Let's add a Power Bar - a meter that teaches the player control."

Type the improvement prompt "I'm asking the agent: 'When I hold the fire key, show me a filling meter. The longer I hold - the power increases'."

Run the game with Power Bar "Now look. I hold D... and the meter starts to fill. Green... yellow... red. Now I release - hits!"

"This adds a layer of skill. You need to know when to let go. Too much power - the projectile flies over the opponent. Too little - it falls short."

"That's the art of the game."

Demonstrate the Power Bar several times. Let students see how it changes the trajectory. Try: 1) too low power (falls close), 2) medium power (perfect!), 3) too high power (goes over). This teaches the concept better than any verbal explanation.
8

Turn-based Gameplay - Strategy First

Real-time: Everyone acts simultaneously (Snake, Flappy Bird, most action games)

Turn-based: Each player takes turns (Chess, Civilization, Worms)

Turn-based Benefits:
  • Time to think and plan
  • Less pressure, more strategy
  • Ideal for playing with one keyboard
  • Simple mechanism to implement
Turn-based is one of the oldest genres - Chess and Checkers are turn-based. In video games, this genre returned to popularity with XCOM, Into the Breach, and Slay the Spire.
The game needs to track currentPlayer - a variable indicating whose turn it is.

The Logic:
1. Player 1 fires → Projectile flies → Hit/Miss
2. currentPlayer = 2 (Switch turn)
3. Player 2 fires → Projectile flies → Hit/Miss
4. currentPlayer = 1 (Back to Player 1)

UI: Visual highlight of whose turn it is - the active tank glows, or there's text saying "PLAYER 1 TURN".

"Now let's talk about Turn-based Gameplay - turn-based play."

"Most games we've built so far have been Real-time - everything happens at once. In Snake, the snake moves constantly. In Flappy Bird, you have to jump fast."

"But in our game? One turn at a time. Player 1 fires. Then the turn passes to Player 2. Player 2 fires. Back to Player 1."

"Why is this good? Because it gives you time to think. You don't need fast reflexes. You need strategy."

"What angle will hit the opponent? Exactly how much power do I need? It's like chess - you plan your move."

"And the game tracks currentPlayer - a variable that says 'now it's Player 1's turn' or 'now it's Player 2's turn'."

9

Collision & Explosions - Drama on Impact

22:00-30:00
Hit Detection: Checking if the projectile hit the opponent's tank.

The check:
if (projectileX >= tankX && projectileX <= tankX + tankWidth &&
    projectileY >= tankY && projectileY <= tankY + tankHeight)


If condition met → Hit! → Explosion + Point + Turn switch
A good explosion consists of 3 components:

1. Visual: A circle/ball that expands and fades (or a particle system)
2. Audio: Explosion sound (low-frequency Sawtooth wave)
3. Screen Shake: Slight camera tremor - moving the Canvas 2-3 pixels randomly for 200ms
Add explosion effects on hit: 1. When projectile hits a tank, create an explosion animation: - Expanding circle with orange/red gradient - Fade out over 0.5 seconds 2. Add explosion sound using Web Audio API (low frequency buzz) 3. Add camera shake effect (subtle screen tremor for 200ms) 4. Display "+1 POINT" text that floats up and fades 5. Update score display for the hitting player

"The game works, but it's missing something. Drama."

"When the projectile hits, it just... disappears. No feedback. No feeling of impact."

"Let's add an explosion!"

Type the prompt "I'm asking the agent for three things:"

"1. Visual explosion - orange-red circle that grows and fades.
2. Explosion sound - low buzz using Web Audio.
3. Screen shake - slight Camera Shake."

Run the game and demonstrate a hit "Now look... I fire... BOOM!" [Let the explosion land] "The screen shook for a moment! There was an explosion! There was sound! It feels like a real hit!"

The explosion is the WOW moment of the lesson. Demonstrate it several times. Make sure the sound and shake work - if not, it ruins the effect. If Camera Shake is too strong and annoying, ask the agent to reduce it to 1-2 pixels instead of 3-5.
10

Particle System - Visual Polish

Particle System: A system that creates dozens/hundreds of small "particles" that move, fade, and disappear.

Uses: Fire, smoke, explosions, sparks, rain, snow, magic

How it works:
1. Each particle = a small object with: position, velocity, color, size, lifespan
2. Every frame: update position, decrease lifespan, change opacity
3. When lifespan reaches 0 → delete the particle
Particle Systems are the basis for all visual effects in modern games. Even AAA games like Call of Duty or Fortnite use the same basic principle. The difference is just the amount of particles and physics complexity.
Upgrade explosion to use a Particle System: 1. On explosion, create 20-30 particles at impact point 2. Each particle: - Random velocity in all directions - Orange/yellow/red color (random) - Fades out over 1 second - Affected by gravity (falls down) 3. Particles should spread outward from center 4. Add smoke trail to projectile while flying (optional bonus)

"Our explosion looks good. But there's something that can be even more amazing."

"Instead of one circle that fades, what if we use a Particle System - a particle system?"

"That means: instead of one big object, dozens of small objects scattering in all directions."

Type the prompt "I'm asking the agent to create 20-30 particles. Each flies in a random direction, random color (orange/yellow/red), and fades."

Run and demonstrate explosion with particles "Now look... I fire... BOOM!!!" [Let the explosion land] "Look at that! Particles flying everywhere! It looks like a real explosion!"

"This is a Particle System - one of the most important tools for creating effects in games."

11

Polishing - Adding Game States

30:00-40:00
Game State: The current state of the game. Each state shows a different UI and reacts differently to input.

3 states in our game:

MENU: Start screen - "TANK DUEL", "Press SPACE to Start"
PLAYING: Game is active - shooting, turns, score
GAME_OVER: Someone won - "PLAYER X WINS!", "Press R to Restart"
Add Game States and Win Condition: 1. Start Menu state: - Display "TANK DUEL" title (large, glowing) - "Press SPACE to Start" - Instructions: "P1: W/S/D | P2: ↑/↓/SPACE" 2. Win Condition: - First player to 5 points wins - Game Over screen: "PLAYER X WINS!" - Display final scores - "Press R to Restart" 3. Add trajectory preview (dotted line showing where shot will go) 4. Add turn timer (15 seconds per turn - optional)

"We have a working game. Now let's turn it into a complete product."

"A real game needs three things:"

"1. Start Menu - a screen that explains how to play.
2. Win Condition - first to reach 5 points wins.
3. Game Over screen - 'Player 1 Wins!' with an option to restart."

Type the prompt "I'm asking the agent to add all this. And a bonus - Trajectory Preview - a dotted line showing where the projectile will fly."

Run the game, show menu "Now when I open the game, there's a menu! 'TANK DUEL' in large. Instructions. Pressing Space..."

Play until victory "The game starts. Player 1 fires... hit! 1-0. Player 2 fires... hit! 1-1..." [Continue playing] "5-3... PLAYER 1 WINS!"

"That's it. We have a complete game with a beginning, middle, and end. A real product."

It's time to let two students play against each other! Invite someone to the screen and demonstrate a live battle. This creates energy in the class and enthusiasm. If possible, let every pair of students play in breakout rooms later.
12

Summary & The Journey Continues

40:00-50:00
Local Multiplayer - two players, one keyboard
Input Handling - managing multiple inputs (WASD + arrows)
Key Mapping - assigning keys to players
Projectile Motion - projectile physics (parabola)
Angle & Power - aiming and strength system
Turn-based Gameplay - turn-by-turn play
Player Switching - logic for swapping active players
Hit Detection - collision logic
Particle System - for visual effects
Camera Shake - for impact feedback
Game States - Menu, Playing, Game Over
Win Condition - ending the game

Stop screen sharing, return to camera "Friends, that's it. We've finished the last lesson."

"Let's stop for a moment and look at what we did today:"

"We built a game with real physics - projectiles flying in parabolas just like in nature."

"We learned Local Multiplayer - how two players play together on one device."

"We created a Particle System - effects that look like AAA games."

"And we built a complete game - with a menu, turns, victory, and restart."

"But this is not the end."

"It's just the beginning. In this course, you learned the foundations:"
"• How to talk to AI
• How to build games
• How to solve problems
• How to turn ideas into products"

"Now you can take this anywhere. Want to build a racing game? Build it. Want a card game? Build it. You have the tools."

"The final challenge: Take Tank Duel, and add something of your own. Wind that changes the projectile path? Destructible terrain? Special weapons? Be creative!"

"And if you wanted to learn more - we'll meet in the next course. We'll learn how to turn games into real apps, how to upload to an app store, and how to build games with neural networks."

"Thank you all for an amazing course. You are game developers now! 🎮"

The closing should be emotional! Emphasize how far they've come - from Lesson 1 (simple Snake) to Lesson 6 (Multiplayer with physics). Send all the prompts in the general chat. Allow time for final questions. Teaser for the next course (if applicable) - you want to leave them wanting more! Encourage them to share the games they built with friends and family.
End of Speaker Notes - Lesson 6 | Course Completion 🎉