The Hardest Game to Build
Of the 12 games on Omokboard, Alkkagi was the hardest to build. The rules are simple, but getting the marbles on screen to slide the way alkkagi marbles should was not. It came down to a single number: the friction coefficient.
I grew up playing it during school breaks on a Go board spread out in the classroom, so whenever the marbles on screen moved differently from what my fingertips remembered, it felt wrong right away.
How a Marble Stops
On every frame the screen draws, Omokboard's Alkkagi moves each marble by its speed, then multiplies the speed by the friction coefficient. Once the speed drops below a set threshold, the marble stops. A full-power flick starts at 20 pixels per frame, and the area a marble can move across is 524 pixels wide.
The First Value Was Far Too Slippery
| Setting | Friction | Stop threshold | Full-power slide distance | Time to stop |
|---|---|---|---|---|
| First version | 0.984 | 0.12 | 1,243 px (2.37× the board width) | 318 frames, about 5.3 s |
| Since 2026-06-08 | 0.960 | 0.20 | 495 px (0.94× the board width) | 113 frames, about 1.9 s |
Times assume a 60 Hz screen. With the first value, a hard flick slid more than twice across the board, and you had to wait over 5 seconds for it to stop. That makes aiming pointless, and most marbles on the board fly off in a single shot.
Changing friction from a 1.6% slowdown per frame to 4% made even the hardest shot stop just short of crossing the whole board. Stop too soon and the flick has no feel; slide too long and aiming stops mattering. Finding the value in between took the longest.
The Playing Tips This Value Created
- Pulling back a tenth of the board already gives full power. Speed is the pull distance times 0.38, capped at 20, so anything past 52.6 pixels (10% of the board width) adds no power. A long pull is for aiming precisely, not for hitting harder.
- Distant targets get hit more softly. Your marble keeps slowing as it rolls, so if it travels about half the board before it connects, a target from the middle of the board usually stops before reaching the edge. That's why clearing nearby marbles first tends to beat reaching for distant ones.
More on power and angles is in the Alkkagi guide.
Getting the Same Result in Online Play
In online play, the marble I shoot has to move the same way on my opponent's screen. So the physics uses no random values, and it runs on a fixed 560×560 virtual board regardless of screen size.
The shooter sends which marble was flicked, in what direction and how hard, along with where every marble ended up once they all stopped on the shooter's screen. The receiver replays the same shot to show the movement, then snaps the marbles to the final positions the shooter sent. It's the same calculation, so the result should already match, but treating the shooter's result as the reference makes sure tiny floating-point differences can never pile up and change the outcome.
This design also caused a bug. In the other games, an opponent's move is applied the moment it arrives, but in Alkkagi the replay keeps going for the few seconds the marbles are rolling. The code that checks whose turn it is ran only once, before the replay ended, so even when it was my turn, dragging did nothing. On September 6, 2026, I fixed it to check the turn again once the marbles have fully stopped.
What Came Later
On August 3, 2026, I added Extreme mode, which places three fixed obstacles in a vertical line in the middle of the board. The obstacles bounce marbles back with the same restitution (0.9) used when marbles hit each other. Tips for using the obstacles are in the Extreme mode section of the Alkkagi guide.
Check It Yourself
- Physics code: alkkagi.js (FRICTION, MIN_SPEED, and MAX_LAUNCH at the top of the file)
- The friction change: f31c830 (2026-06-08)
- Extreme mode: f907971 (2026-08-03)
- Online turn bug fix: a4eb611 (2026-09-06)