What it does
The pack sits on excavation, which owns the earth, the tunnels, ghosting through dirt, falling objects and pickups.
This pack owns the fight. The player has a weapon: either a harpoon that attaches to an enemy and inflates it over
several pumps, deflating if released, or a power ball that bounces through the tunnels and recharges more slowly after
each kill. Rocks or apples fall when the earth under them is dug away, and every enemy crushed under one fall is worth
more than the last.
Enemies follow a shared AI with per-kind settings. They chase the player through the tunnels by shortest path, with a chance you set, and otherwise wander. A ghost meter fills over time, faster while the player stands still, and sends them through the earth as eyes that will not surface too close to the player. Some breathe fire through the dirt, some periodically turn into diggers that tunnel after the player and eat what they find, and some eat the falling apples. When enemies are few, they speed up, and the last one tries to escape off the field.
Around that sit the extras of the genre: a bonus vegetable after a number of rocks have dropped, a monster nest that
turns into food that freezes the monsters and summons a stronger one, letters to collect for an extra life, a rare
diamond, score by depth and by crush count, lives and extra lives, round clears by any of several conditions, and
progression with a loop after the last round. It is pure, deterministic and fixed-step; you call tick with the held
direction and fire button, draw from state and the excavation field, and play sounds from the events.
Features
- Two weapons — a harpoon and pump with range, pumps to pop and timings for hold, deflate and recovery, or a bouncing power ball with a recharge table, hit and catch radii.
- Tunnel AI — chase and wander, a ghost meter that sends enemies through the earth, fire breath with range and wind-up, diggers that eat collectibles, object eaters and freezable kinds.
- Falling objects — rocks or apples, with crush scores rising for every enemy under one fall.
- Scoring by depth — strata with their own points, a double score for some kinds hit side-on, and points for fresh tunnel.
- Bonus rules — the bonus vegetable, the monster nest and its food, collectible clusters with streak bonuses, letters for an extra life, the diamond and the last enemy's escape.
- Speed-ups and difficulty — enemies go fast as their numbers fall, and Easy, Normal and Arcade scales adjust speed, ghosting, fire, enemy caps and aggression.
- Rounds and progression — authored or generated rounds, any of four clear conditions, lives, extra lives at set scores and a loop after the last round.
- Forgiving turns — a cornering window around each turn line so a slightly late turn is still taken, or set to 0 for strict whole-cell turns.
- Events for presentation — from
harpoon,pumpandpoptocrush,ghost,fire,letterandclear. - Snapshot and restore — deterministic from a seed, with a fixed step.
Good for
- Harpoon-and-rocks digging games in the style of Dig Dug, with strata, inflating enemies and a bonus vegetable.
- Cherry-collecting tunnellers in the style of Mr. Do!, with a bouncing ball, apples, a monster nest and letters.
- Hybrid digging games that mix the two, such as strata and a harpoon with cherries and a nest.
- Larger generated mines with more strata, more rocks and a steeper depth table.
- Arcade remakes and tributes that need faithful round layouts and scoring tables as a starting point.
Make it yours
A game is a DigCombatConfig. The field sets its subdivisions, tunnel width, strata and legend; each round lists its
terrain map, pre-dug tunnels, enemies, objects, items, player start, walk-in path and nest. The player has a speed, a
digging factor and a cornering window. Enemy kinds set their speeds, ghosting, fire, scores by stratum, transforms,
digging, eating and speed-up per round. The weapon, the AI's ghost meter, the vegetable, the nest, the collectibles, the
letters, the escape, the speed-up, the diamond, the clear conditions, lives, extra lives, difficulty, seed and timings
are all options too.
The presets are where to start. digDugPreset takes difficulty, lives, start round, seed, player speed, pumps, harpoon
range, the walk-in and the cornering window, and reproduces the fifteen rounds of the 1982 arcade digging game and their
repeat. mrDoPreset builds scenes with your choice of cherry clusters, apples and nest monsters, and a ball recharge
table. deepMinePreset is a materially different game on the same rules: a 20 by 20 mine with six strata, three pumps
and more rocks. generateDigRound makes a seeded round of any size from 5 to 64 cells each way.
A quick look
A game from a preset, stepped with the held direction and the fire button:
const g = game.digCombat.createDigCombat(game.digCombat.digDugPreset({ difficulty: 'normal' }));
game.step('dig', dt => {
g.tick(dt, { move: heldDirection, fire: buttonHeld });
for (const e of g.drain()) if (e.kind === 'pop') sfx('pop');
draw(g.state, g.field);
});
Works with
excavation— required: the earth, the tunnels, ghosting, falling objects and pickups.grid-walker— every body moves on its continuous grid walker, throughexcavation.render-textureandtypography— paint the earth into one texture and draw sprites and text over it.boulder-dash— for a cave of discrete cellular rules instead.maze-chase— for fixed mazes with dots and ghosts.
Good to know
- One player, and two weapon models: the harpoon and the ball.
- Enemy AI is shared, a shortest-path chase or a forward-biased wander, with per-kind variation from the options.
- Objects fall straight down and do not roll.
- Contact is by centre distance, and fire breath is a horizontal or vertical band.
- Weapon timings, rock falls and some bonus timings are tuned estimates of the arcade behaviour, and the second preset's scenes are authored in the original's style rather than copied map for map.






