Discord Rich Presence #3

Closed
opened 2026-10-17 02:09:12 +00:00 by mintopia · 5 comments
Owner

What to build

When Discord is running, the player's Discord profile shows what they're doing in Blur: in menus, the event/mode and track during a race, and lobby status (e.g. online lobby, 3/20 players). Talks to Discord's local IPC socket directly (no SDK). It has an on/off option in the game's Options menu, and does nothing quietly when Discord isn't running or is closed mid-session.

Acceptance criteria

  • Discord shows Blur as the current activity, with the state changing between menu, race (mode + track) and lobby
  • Lobby status shows player count and updates as it changes
  • No errors, stalls or log spam when Discord isn't running; reconnects if Discord starts later
  • Option off: no presence is published
  • Verified on BLUR_ENGINE=recomp

Blocked by

## What to build When Discord is running, the player's Discord profile shows what they're doing in Blur: in menus, the event/mode and track during a race, and lobby status (e.g. online lobby, 3/20 players). Talks to Discord's local IPC socket directly (no SDK). It has an on/off option in the game's Options menu, and does nothing quietly when Discord isn't running or is closed mid-session. ## Acceptance criteria - [ ] Discord shows Blur as the current activity, with the state changing between menu, race (mode + track) and lobby - [ ] Lobby status shows player count and updates as it changes - [ ] No errors, stalls or log spam when Discord isn't running; reconnects if Discord starts later - [ ] Option off: no presence is published - [ ] Verified on `BLUR_ENGINE=recomp` ## Blocked by - #2
Author
Owner

This should show the current race if it is in progress (Track Name)

This should show the current race if it is in progress (Track Name)
Author
Owner

Implemented Discord Rich Presence (src/host/discord.cpp): talks to discord-ipc-N unix socket directly, polls the game-state feed (#2) on a background thread, no guest-thread cost. Activity: "In the menus" / "Racing: " + event / "In a multiplayer lobby" + track + party size n/20. Options > Graphics > "Discord Rich Presence" Off/On (default On; persisted as DiscordPresence). Reconnects every 5s if Discord is absent, closed mid-session or started later; logs only connect/disconnect/handshake-failure once. Off = socket closed, nothing published. Verified on BLUR_ENGINE=recomp against a fake IPC server: connect after late start, menu -> career race (SPA Barcelona Oval 2 / StreetRace), close + reconnect republishes; Options row screenshot shows the row. ctest discord (fake-server unit test incl. option-off, reconnect) passes. NOT done: needs a real Discord application id - kDefaultClientId in discord.cpp is a placeholder; set the real one or BLUR_DISCORD_CLIENT_ID. Toggle-off click not driven in-game (covered by unit test). /comment-check findings fixed.

Implemented Discord Rich Presence (src/host/discord.cpp): talks to discord-ipc-N unix socket directly, polls the game-state feed (#2) on a background thread, no guest-thread cost. Activity: "In the menus" / "Racing: <Track>" + event / "In a multiplayer lobby" + track + party size n/20. Options > Graphics > "Discord Rich Presence" Off/On (default On; persisted as DiscordPresence). Reconnects every 5s if Discord is absent, closed mid-session or started later; logs only connect/disconnect/handshake-failure once. Off = socket closed, nothing published. Verified on BLUR_ENGINE=recomp against a fake IPC server: connect after late start, menu -> career race (SPA Barcelona Oval 2 / StreetRace), close + reconnect republishes; Options row screenshot shows the row. ctest discord (fake-server unit test incl. option-off, reconnect) passes. NOT done: needs a real Discord application id - kDefaultClientId in discord.cpp is a placeholder; set the real one or BLUR_DISCORD_CLIENT_ID. Toggle-off click not driven in-game (covered by unit test). /comment-check findings fixed.
mintopia removed their assignment 2026-10-17 19:57:41 +00:00
Author
Owner

Real Discord application id set (kDefaultClientId). Verified against the live Discord client on BLUR_ENGINE=recomp (career_race): log shows "[discord] connected" (the old placeholder id was rejected: "handshake failed"). A SET_ACTIVITY with the same id returned the activity as "Blur" (application_id 1561111597387087972). Rest as in previous comment: menu / race+track / lobby+party states, quiet reconnect, Options > Graphics toggle. ctest discord, game_state, state_ws pass.

Real Discord application id set (kDefaultClientId). Verified against the live Discord client on BLUR_ENGINE=recomp (career_race): log shows "[discord] connected" (the old placeholder id was rejected: "handshake failed"). A SET_ACTIVITY with the same id returned the activity as "Blur" (application_id 1561111597387087972). Rest as in previous comment: menu / race+track / lobby+party states, quiet reconnect, Options > Graphics toggle. ctest discord, game_state, state_ws pass.
Author
Owner

Comment-check fix: IPC opcodes are now named constants (kOpHandshake, kOpFrame); opcode comment removed. discord/game_state/state_ws ctests pass.

Comment-check fix: IPC opcodes are now named constants (kOpHandshake, kOpFrame); opcode comment removed. discord/game_state/state_ws ctests pass.
Author
Owner

Completed and merged by Harmonic (task 8).

Completed and merged by Harmonic (task 8).
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Depends on
#2 Game-state feed
mintopia/blur
Reference
mintopia/blur#3
No description provided.