Free online Cannon (artillery duel)
Cannon is a turn-based artillery duel: two cannons, one at each end of a hilly battlefield, trade shots until one scores a hit. You control just two numbers, angle and power, yet there is wind, a fresh landscape every round and a shell that obeys gravity. Below is the physics that governs every shot and how to turn it into accurate aim.
History
Ballistics is older than the computer. Galileo showed in 1638 that a projectile follows a parabola, and ENIAC, built in the 1940s, was commissioned to calculate artillery firing tables. Once computers reached homes, the cannon duel became one of the first game genres: you typed an angle and a speed and watched the shell fly.
Gorillas, which shipped with MS-DOS 5, and Scorched Earth, from the early 1990s, popularized the formula; Worms (1995) and, in a different shape, Angry Birds (2009) carried it on.
How to play
On your turn, set the angle (10° to 85°) and the power (20 to 100) with the sliders or the keyboard: Up and Down change the angle, Left and Right change the power, and Space or Enter fire. The whole flight is computed the instant you shoot, with no luck involved: the same numbers on the same terrain and wind always give the same result.
A miss passes the turn, and the shot's trail stays drawn on screen as a reference. Player 1 (the red cannon on the left) always goes first; against the computer, that is you. The first to hit the opposing cannon wins the round and scores a point.
Rules
- The field is 900×520 units; the cannons stand 70 from the edges, so 760 apart.
- A direct hit means passing within 22 units of the enemy cannon's center. There is no health, partial damage or blast radius: missing by 23 is missing.
- One hit ends the round. The scoreboard counts rounds won in the session.
- Terrain and wind are redrawn every round; the wind stays fixed until someone hits.
- Each cannon remembers its last angle and power during the round; every new round starts at 45° and power 60.
- A shell can only hit the opponent: there is no friendly fire, and the terrain is never destroyed.
- Nothing is saved in the browser. New Game redraws the terrain and keeps the score; switching mode resets it.
Strategies
- Change one variable at a time. Fix the angle the hill allows and adjust only the power: since each point is worth about 20 units of range, a shot that landed 80 short needs 4 more.
- Treat the first shot as calibration. The default (45°, power 60) lands about 70 short on flat ground. See where it stopped and correct.
- Read the opponent's trail. It stays on screen after a miss, showing how the wind bends a shot and where the hill clips the path.
- Pick the angle by the wind. In a strong headwind lower the angle and raise the power; with a tailwind, cut the power.
- Fine-tune on the arrow keys. They move one point at a time, the right step for a 20-unit correction.
The physics behind the aim
Gravity is constant, there is no air drag, and the muzzle speed is the power times 0.24. On flat ground with no wind the range is close to 0.19 × power² × sin(2 × angle). Because power is squared, doubling it quadruples the range.
Measured in the game, these powers hit a cannon 760 away on flat ground with no wind:
- 20°: power 76 to 82
- 30°: power 67 to 70
- 45°: power 63 or 64
- 60°: power 68 or 69
- 70°: power 80 or 81
The hill and the quarter rule
The central hill stands 80 to 150 units tall on top of ripples of up to about 25, with its center up to 70 from mid-field. A shell that touches the ground ends there, so the angle must be high enough.
On flat ground the peak of the arc is roughly range × tangent of the angle ÷ 4, reached halfway along. For a range of 760:
- 20°: peak near 70
- 30°: near 110
- 45°: near 190
- 60°: near 330
Wind: who benefits
Wind is a constant horizontal acceleration: the number beside the arrow (0 to 100) is a percentage of the maximum, and the arrow points where the shell is pushed. An arrow pointing right helps the left cannon and hurts the right one.
Measured in the game, on flat ground, wind 60 pushes a shot off course by:
- at 30°: about 20 units, still inside the hit radius
- at 45°: about 30
- at 60°: 35 to 55
How the CPU aims, and why it misses
The CPU does not guess. It simulates 682 shots (31 angles from 20° to 80° in steps of 2°, times 22 powers from 35 to 98 in steps of 3) on the round's real terrain and wind, and picks one that hits. Then it rolls an error of up to 7° in angle and 9 in power.
Since one power point is worth about 20 units of range, that error sends most shots wide. In simulations of the code on random terrains it hit roughly one shot in nine. It does not learn from misses or look at the trail: every turn it recalculates and rolls a fresh error.
Because you shoot first, the arithmetic is simple: if you need four shots, it will have had three chances before, about a 30% chance of hitting first.
Common mistakes
- Changing angle and power together. You lose the reference for your error and start over.
- Underrating weak wind. Wind 30 on a 60° shot still shifts it by 17 to 29 units, close to the hit radius.
- Misreading the wind's side. The arrow is the same for both cannons: pointing right, it helps whoever stands on the left.
- Shooting flat without checking the hill. The shell dies on the slope and the turn is wasted.
Tips for beginners
- Start at 45° and touch only the power.
- Note whether the shell landed short or long of the target and correct in proportion.
- Check the wind arrow before the first shot.
- In a two-player game, player 2 sees player 1's trail: the compensation for shooting second.
Trivia
- At power 100 and 45°, a shell would travel about 1,900 units, more than twice the width of the field.
- Near 45° the angle barely changes the range (about 8 units per degree), while each power point changes it by 20 to 25.
- The game computes the whole flight at the moment of firing and only then animates it: you are watching the replay of a result already decided.
Mobile version
On a phone, angle and power are sliders under the field: drag your thumb slowly and check the number beside it before firing. With no keyboard, fine adjustment calls for short movements; if you overshoot, back off a little rather than starting over. The battlefield scales down to the phone's width.
Frequently asked questions
How do you aim in the cannon game?
You set two values: the angle (10° to 85°) and the power (20 to 100). The shell follows a parabola under constant gravity, pushed by the wind, and hits if it passes within 22 units of the opposing cannon's center.
Does the wind change with every shot?
No. The wind is drawn once per round and stays the same until someone hits. What varies is its effect, which depends on how high the shot goes.
Who shoots first?
Player 1, the red cannon on the left, starts every round. Against the computer, that player is you.
Is the computer unbeatable?
No. It calculates a perfect shot, but then rolls an error of up to 7° in angle and 9 in power, so it misses often. It also does not learn from earlier shots.
Does the hill block the shell?
Yes. A shell that touches the terrain stops there, without destroying it. If your shot hits the slope, raise the angle.
Can I hit my own cannon?
No. Only the opposing cannon counts as a target.
Does the score reset every round?
No. The score adds up rounds won. New Game redraws the terrain and keeps the score; switching mode resets it.
What are the keyboard shortcuts?
Up and Down change the angle, Left and Right change the power, and Space or Enter fire.
Can I play with a friend?
Yes, in 2 Players mode, taking turns on the same device. To play alone, pick vs Computer.