Skip to content

feat: Give bots character: a cast, moves and company around riders - #67

Merged
RalfLeonFasler merged 2 commits into
mainfrom
feat/bots
Nov 11, 2026
Merged

RalfLeonFasler merged 2 commits into
mainfrom
feat/bots

Conversation

@ThoreKoritzius

@ThoreKoritzius ThoreKoritzius commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Closes #64.

Why

Bots never reacted to anyone. They rode a fixed share of their FTP, spawned wherever the route was emptiest and were called "Swift Badger". On longer routes you rode mostly alone, and meeting a bot changed nothing. This gives every ride someone to chase, someone to ride with, and now and then someone who attacks you.

What changed

Who bots are (sim/names.rs, sim/bot.rs)

  • Names: each bot is a made-up character, a first name plus a cycling-pun surname ("Gus Tailwind", "Penny Farthing", "Sally Sprocket"; 1,600 names). They're all invented, so no real people and no film or TV characters.
  • Easter egg: about one new bot in 200 is Goldie Lemon, always in Team Zitrone's lemon yellow.
  • Fixed per name: the name decides the riding type and the team, so a name rides the same way on every server. Types: rouleur, climber, sprinter, attacker, tourer. Teams: eight kits, none orange (you) or sky blue (humans). Fitness is still matched to the humans online.

How they ride: moves within an energy budget

  • Energy: every bot has a W′ balance (the critical power model with Skiba's recovery). Efforts drain it, and an empty bot cracks, so following an attacker can wear it down.
  • Moves: pull on the front and then swing off, attack near a climb's top (climbers), take up the chase when a human comes past, and sprint for sprint lines.
    • Attacks and chases only happen with a human within 80 m (or in a race), so bots far from everyone ride quietly.
    • Each line is contested once per pass.
    • Tourers never race anybody.
    • There are no moves in vehicles or group rides.
  • What they change: moves change only power and lane choice. Physics, drafting and races are untouched.

Where they appear and how many (sim/world.rs)

  • Groups: bots spawn in groups of 2–5, in rows at about one level. A bot that gets ahead of its group waits for it, and a bot 300 m from the rest rides alone.

  • Company: every human riding freely keeps at least 6 bots within 1.5 km ahead or 400 m behind. Missing company spawns out of sight (≥ 350 m away):

    • 70% ahead and a bit slower: a group to chase;
    • 30% behind and a bit faster: a wheel coming by.

    When the route is full, bots far from everyone make room.

  • Count: unchanged. A route keeps OPENRADLR_TARGET_RIDERS riders, humans plus bots, as on main. Company comes out of that count: far bots make room, and nothing is added. 0 (the OpenBikeNet velodrome) still means no bots. A first draft grew the count with the humans, up to a fixed 48 that had no env var; that's gone after review.

Protocol (additive, no version bump): bots' rider entries gain team, style and move. Humans never have them.

Client

  • 3D view: a bot's jersey has its team's colour. The 2D view keeps grey dots, since Fix 2D view and change it to a top down view #38 is redoing it.
  • Rider list: the badge names the type ("climber bot" / "Kletterer-Bot"). Names now shorten before badges do, so a bot is always marked.
  • Ticker: it calls out a move as it starts, from a bot within 120 m: "Gus Tailwind attacks!", "… takes up the chase!" (only from behind you), "… goes for the sprint!" or "… comes through for a turn on the front." There is at most one line every 15 s.

Docs: spec and plan in docs/superpowers/, ADR 0022, protocol.md, architecture.md and the CHANGELOG.

Tuning

I simulated one hour per route with one rider at 75% of a 3.0 W/kg FTP:

route no bot within 300 m bots within 150 m (mean) moves near the rider
Col de la Forge 29 s 3.4 14
Riverside Flats 330 s 2.0 18
Island Tour 29 s 3.0 13

The first version spawned groups 350–1,200 m ahead and counted bots up to 1.5 km behind as company. On Col de la Forge that left the rider alone for 1,696 s of the hour, with one move nearby.

Then with OPENRADLR_TARGET_RIDERS as the only count, on Col de la Forge (the other riders start with the first):

target humans riders bots within 150 m (mean) no bot within 300 m
12 1 12 2.7 64 s
75 1 75 3.4 75 s
12 3 12 2.9 322 s

Screenshots

Ridden on a local server built from this branch, in headless Chromium with the simulated trainer.

A climber in Team Moos green takes up the chase when you come past (TV side camera), and the ticker calls it out:

Chase

The rider list names each bot's type. Long names are shortened, and the badges are never cut off:

Rider list

Goldie Lemon in lemon yellow, then taking up the chase. For these two frames only, I ran a throwaway local build with Goldie's odds raised from 1 in 200 to 1 in 2. The branch has 1 in 200.

Goldie Lemon Goldie Lemon chases

Testing

  • make check passes. It includes these new tests:
    • Sim: the cast and its shares, the W′ maths, each move's start and end, lines contested once per pass, lane wishes, what bots see (next line, passer, wheel behind, nearest human, group waiting and splitting), the population target, company out of sight at the right levels, a full route making room, and groups in rows.
    • Server: the new fields on bots and their absence on humans.
    • Client: kit colours, the badge, the ticker's rules, the 3D tint and the rider row.
  • Rides: several rides on a local server to check the moves and the screenshots. While watching a ride I found a bug: an answering bot left your lane again and rode past you. It's fixed, and a test covers it.

Notes for review

🤖 Generated with Claude Code

@RalfLeonFasler

Copy link
Copy Markdown
Contributor

Whats with this 48 cap? Isn't there an env for it? Currently we have 75 in prod

Every bot is now a made-up character ("Gus Tailwind", rarely Goldie
Lemon) whose name fixes a riding type and a team kit. Bots make moves
within a W' energy budget: they pull and swing off, attack near climb
tops, answer riders who come past and sprint for lines. They spawn in
groups out of sight around every human, and a route keeps more bots
the more humans ride it. Clients tint bots' jerseys by team, name the
type in the rider list and call out moves nearby in the ticker.

Closes #64.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Drop the growth with humans and its fixed cap of 48: a route keeps
target_riders riders as before, and company around each human comes
out of that count (far bots make room). One setting, no change in load.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ThoreKoritzius

Copy link
Copy Markdown
Contributor Author

Whats with this 48 cap? Isn't there an env for it? Currently we have 75 in prod

Good catch, thanks. The 48 had no env var, and with 75 it never did anything anyway. The formula was max(TARGET_RIDERS, min(humans × 7, 48)), which is always 75 in prod. So I've removed it in 2f149e4.

  • Count: OPENRADLR_TARGET_RIDERS is the one setting again. Every route keeps exactly that many riders, humans plus bots, as on main. With your 75 the count and the server's load are unchanged.
  • Company: the bots around each rider now come out of that count. Bots far from everyone make room, and groups spawn out of sight near the rider. Nothing is added.
  • Simulated hour on Col de la Forge: 12 riders with a target of 12, 75 with 75. One rider had 3.4 bots within 150 m on average with 75, and 2.7 with 12. Three riders sharing a target of 12 still averaged 2.9.

I've updated the spec, the ADR, the CHANGELOG and the PR description to match.

@RalfLeonFasler
RalfLeonFasler enabled auto-merge (squash) November 11, 2026 07:41
@RalfLeonFasler
RalfLeonFasler merged commit 1137aee into main Nov 11, 2026
8 checks passed
@RalfLeonFasler
RalfLeonFasler deleted the feat/bots branch November 11, 2026 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bots with character: names, riding types, moves and company around riders

2 participants