Discord Rich Presence #3
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Depends on
#2 Game-state feed
mintopia/blur
Reference
mintopia/blur#3
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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
BLUR_ENGINE=recompBlocked by
This should show the current race if it is in progress (Track Name)
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.
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.
Comment-check fix: IPC opcodes are now named constants (kOpHandshake, kOpFrame); opcode comment removed. discord/game_state/state_ws ctests pass.
Completed and merged by Harmonic (task 8).