Disclosure: I'm the developer of Bear Wars, the game this post is about.
Bear Wars is a turn-based artillery game in the spirit of Worms and Hedgewars. Two teams of bears take turns on destructible maps, the wind bends every shot, and it runs in the browser with nothing to install. You can play the computer (3 difficulty levels), pass one device around, or send a friend a room code for a 1v1 match. A phone in landscape can play against a PC.
Here are the five ideas that carried most of the weight.
1. Terrain is a bitmask, not geometry
The map is a grid where 1 means solid. The art is drawn on top; physics only reads the mask. An explosion is carveCircle(x, y, r). That single primitive gives you craters, tunnels and caves.
We store the mask as 64x64 tiles with copy-on-write, so a carve only copies the tiles it overlaps instead of the whole map.
2. Sweep the projectile, don't teleport it
A fast shell can travel further in one tick than a thin wall is thick. Testing only the end point makes shots pass through hills. Walk the segment from the previous position to the new one and stop at the first solid cell.
3. Fixed timestep
Run the simulation at a fixed tick, independent of frame rate. A shot then lands in the same place on a slow phone and a fast desktop.
4. Walking is step rules plus normals
Small bumps should be climbable, walls should not. In Bear Wars a bear steps up at most 6 px and down at most 8 px; anything taller needs a jump or the rope. A surface normal (normalAt) tells you which way a slope faces.
5. The bot shoots with the real physics
The computer opponent tries many angle and power combinations, simulates each with the same simulation code the game uses, and picks the best. No second "AI physics" to keep in sync.
The fun part: weapons
12 of them, including a rope, timed grenades (1-5 s), teleport, an air strike, a helicopter, a drill that tunnels along your aim, a point-blank bogatyr sword, and the Tsar Cone: it barely bounces, sits for a few seconds and explodes twice as hard as a grenade. The bears talk, in 8 languages.
If you're building something in this genre, I'm happy to answer questions in the comments. And if you want to try it: https://bearwars.org/