PROTOTYPE based on the game Roekoe, not Roekoe itself
Race engine: predetermined (A) vs tick-based (B)
Prototype and benchmark on real pigeons, last scraped stats. Generated . Code:
web/race-sim/ (sim.js is the engine, this page runs it live).
Recommendation: option C, “tick maths, computed once”. Run the tick-based simulation (B) in a single job when the race starts and keep a checkpoint every 30 minutes.
You get B’s alternative paths and lead changes, A’s cost profile (one job, N rows written, nothing to schedule) and a race that is fully replayable from its seed.
Plain B only pays off if players or live events must be able to change a race while it is running.
Compute is not the limit for any option: 100,000 pigeons take under half a second in JS. The limits are persistence (B: rows written per tick), PHP memory and read traffic; they are in the limit table below and adjustable.
1. The three options
A Predetermined
At race start every pigeon gets one finish time: distance / speed × luck × detour. Sort once and the result is known. The live view only interpolates position over time (straight line).
B Recalculate every x minutes
State per pigeon (position, speed wobble, off course?) advances each tick. Shared weather, detours and fatigue play out live. The outcome is not known until the last tick.
C Hybrid
The B maths run once at start in a tight loop; positions are stored every 30 min. The live view interpolates between checkpoints. Same paths as B, no scheduler.
2. What decides a pigeon’s race day
| Input | How it enters | Data |
|---|---|---|
| Base stats | Short / middle / long score interpolated over the race distance (anchors 150, 400, 800 km) → speed in m/s. Calibrated on 9,170 real finishes: mean 16.5 m/s, 0.19 m/s per score point. | All 2,853 pigeons (last scraped) |
| Fitness + moral | Condition index 0.65·fitness + 0.35·moral scales power between ×0.70 and ×1.00. | Real for the 15 own pigeons; for the rest drawn from the own-hok distribution (fitness ≈ 88±9, moral ≈ 91±7) |
| Food the day before | Night effect from the food_types table (peanut −2/+8, power feed +23/−3, grain +13/+2 fitness/moral), added to fitness/moral before the race. | Real for own pigeons; for the rest a random feeding plan (55% grain, 25% power feed, 12% peanuts, 8% nothing) |
| Form of the day | One draw per pigeon per race, ±3% power, fixed by hash(seed, pigeon). | Random |
| Navigation | Chance of a detour that grows with distance and shrinks with navigation. A: one time penalty up front. B: pigeon flies at 50% speed for 20–60 min. | Own: real stat. Rest: proxy from middle/long score |
| Endurance, weather resistance | B/C only: fatigue towards the finish, and sensitivity to a shared wind process (rainy races swing harder). A uses the mean fatigue as a closed form and ignores weather. | Proxies as above |
Only the scores exist for 2,838 of the 2,853 pigeons (they come from results and pedigree pages). Their fitness, moral and feeding are simulated, so the race outcomes are illustrative while the cost numbers are real. Fully populated stats for everybody would only change the inputs, not the engine cost.
3. Comparison
4. Measured cost per field size
450 km race, cloudy, median of 3 runs, Node on . B is shown at a 5-minute tick; 1 and 15 minutes in the second table. Fields above 2,853 are the real pigeons sampled with replacement.
5. How many pigeons can a race take?
CPU is measured above; the rest are assumptions you can change to match the real backend.
Defaults are deliberately pessimistic: 8× slower than Node, 20k rows/s (MySQL bulk upsert; the SQLite figure measured here is ~1.3M rows/s but is not representative). SQLite measured on this machine: rows/s.
6. Outcome quality (30 race days, same 2,853 pigeons)
A’s luck parameter (σ=0.03 on finish time) was tuned until A and B are equally skill-driven; the table shows that this holds, so what remains different is the shape of the race, not the fairness.
7. Try it
8. Caveats
- The real race formula lives server-side and is not public. This is an empirical model (speed spread and mean calibrated on real finishes), good enough to size the engine, not to predict real races.
- JS timings stand in for PHP; the slowdown factor is an assumption. Relative numbers between A, B and C hold regardless.
- Rows written assumes B persists every pigeon’s position on every tick. Persisting only a top-N board plus 30-minute checkpoints cuts this about 6× and is what C does by construction.
- Memory per pigeon is the model’s typed-array size (~34 bytes for B state); PHP arrays are far heavier, hence the separate bytes/pigeon input.
Prototype by Rascals, based on the game Roekoe. Not affiliated with or endorsed by Roekoe. All pigeons on this page are real scraped scores or generated.