Implement Channel Points Twungeon MVP
This commit is contained in:
@@ -120,7 +120,7 @@ The Twitch adapter uses Twurple to:
|
||||
- receive chat messages needed for `!spawn`;
|
||||
- extract the stable Twitch user ID and display data from the chat event;
|
||||
- verify follower eligibility using the configured broadcaster identity;
|
||||
- receive the Bits event selected for resurrection;
|
||||
- receive the configured Channel Points custom reward redemption event;
|
||||
- normalize Twitch events into internal messages; and
|
||||
- reconnect without submitting the same external event more than once.
|
||||
|
||||
@@ -537,12 +537,12 @@ When HP reaches 0:
|
||||
The dead character remains associated with the Twitch user ID and cannot be
|
||||
replaced with `!spawn`.
|
||||
|
||||
### 10.4 Bits resurrection
|
||||
### 10.4 Channel Points resurrection
|
||||
|
||||
The Bits price is a required positive configuration value and may change
|
||||
without changing domain code. An accepted resurrection event must identify the
|
||||
same Twitch user ID as the dead character, satisfy the configured transaction
|
||||
rule, and have a unique external event ID.
|
||||
The Channel Points custom reward ID is required configuration and may change
|
||||
without changing domain code. Its cost is owned by Twitch. An accepted
|
||||
resurrection event must identify the configured reward, the same Twitch user ID
|
||||
as the dead character, and a unique redemption ID.
|
||||
|
||||
Resurrection:
|
||||
|
||||
@@ -553,8 +553,9 @@ Resurrection:
|
||||
- grants 0 AP during the current phase; and
|
||||
- enables action beginning with the next Player Phase.
|
||||
|
||||
Extra, duplicate, anonymous, insufficient, or non-dead-user events do not alter
|
||||
game state and must produce a diagnostic result without exposing secrets.
|
||||
Other-reward, duplicate, unknown-user, or non-dead-user events do not alter game
|
||||
state and must produce a diagnostic result without exposing secrets. Bits and
|
||||
Cheers are outside the MVP and are not normalized into domain messages.
|
||||
|
||||
### 10.5 Refresh and reconnect
|
||||
|
||||
@@ -648,8 +649,9 @@ alive, the backend immediately:
|
||||
9. logs the wipe and reset; and
|
||||
10. begins a fresh Player Phase.
|
||||
|
||||
Because the reset is immediate, a Bits event cannot interrupt a completed
|
||||
total-party wipe. Zero participating characters is explicitly not a wipe.
|
||||
Because the reset is immediate, a Channel Points redemption cannot interrupt a
|
||||
completed total-party wipe. Zero participating characters is explicitly not a
|
||||
wipe.
|
||||
|
||||
## 13. Randomness
|
||||
|
||||
@@ -732,10 +734,10 @@ type TwitchMessage =
|
||||
broadcasterId: string
|
||||
}
|
||||
| {
|
||||
type: 'bits-resurrection-received'
|
||||
type: 'channel-point-resurrection-redeemed'
|
||||
externalEventId: string
|
||||
twitchUserId: string
|
||||
amount: number
|
||||
rewardId: string
|
||||
}
|
||||
```
|
||||
|
||||
@@ -776,8 +778,8 @@ When phase is dormant, both applicable views prominently display exactly:
|
||||
### 16.1 Twitch unavailable
|
||||
|
||||
- Existing authenticated gameplay may continue if the backend remains healthy.
|
||||
- New spawn, new identity binding, and Bits events fail closed when they cannot
|
||||
be verified.
|
||||
- New spawn, new identity binding, and Channel Points redemptions fail closed
|
||||
when they cannot be verified.
|
||||
- The operator view and logs identify the unavailable integration.
|
||||
- Reconnect uses bounded exponential backoff and does not duplicate events.
|
||||
|
||||
@@ -813,7 +815,7 @@ Structured operational logs must distinguish:
|
||||
- accepted and rejected spawn attempts;
|
||||
- accepted and rejected controller commands;
|
||||
- phase transitions and timer expiry;
|
||||
- Bits-event deduplication and resurrection results;
|
||||
- Channel Points redemption deduplication and resurrection results;
|
||||
- floor-generation seed and validation result;
|
||||
- reconnect and snapshot resynchronization; and
|
||||
- run reset or fatal errors.
|
||||
@@ -832,7 +834,7 @@ credentials and full authentication payloads.
|
||||
|-- packages/
|
||||
| |-- domain/ # Framework-independent game state and rules
|
||||
| |-- dungeon-generator/ # Seeded two-room generation and validation
|
||||
| |-- twitch-adapter/ # Twurple chat, follower, and Bits integration
|
||||
| |-- twitch-adapter/ # Twurple chat, follower, and Channel Points integration
|
||||
| |-- rpgjs-adapter/ # Mapping between domain state and RPGJS
|
||||
| |-- contracts/ # Shared validated API/event schemas
|
||||
| `-- ui/ # Shared layout, status, controls, and log components
|
||||
@@ -894,7 +896,7 @@ Integration tests use test doubles before live Twitch testing and cover:
|
||||
- two authenticated viewers controlling separate characters;
|
||||
- refresh/reconnect without duplication;
|
||||
- Twitch event and command deduplication;
|
||||
- Bits event mapped to the correct dead character;
|
||||
- Channel Points redemption mapped to the correct dead character;
|
||||
- backend snapshots, ordered events, and sequence-gap recovery; and
|
||||
- RPGJS rendering updates without domain authority leakage.
|
||||
|
||||
@@ -909,7 +911,7 @@ At minimum, the live test plan must demonstrate:
|
||||
5. two or more simultaneous viewer characters;
|
||||
6. movement, two attacks, heal, pass, timer expiry, and AutoGuard;
|
||||
7. Goblin aggro, pursuit, attack, target death, and return;
|
||||
8. Bits resurrection of the correct dead viewer;
|
||||
8. Channel Points resurrection of the correct dead viewer;
|
||||
9. floor escape with the Goblin alive and dead-player revival;
|
||||
10. total-party wipe and Floor 1 reset;
|
||||
11. refresh and temporary disconnect recovery; and
|
||||
@@ -923,7 +925,7 @@ At minimum, the live test plan must demonstrate:
|
||||
| 7-13 | Dormancy, spawn eligibility, duplicate prevention, and identity integration tests |
|
||||
| 14-19 | Controller, phase, timer, AP, combat, heal, death, Guard, and log tests |
|
||||
| 20-22 | Goblin AI, generator validation, and live-Goblin escape tests |
|
||||
| 23-29 | Floor revival, death lockout, Bits, wipe, zero-player, late spawn, and reconnect tests |
|
||||
| 23-29 | Floor revival, death lockout, Channel Points, wipe, zero-player, late spawn, and reconnect tests |
|
||||
| 30-33 | Multi-floor soak test, first-time-viewer test, setup troubleshooting review, and viewer-feedback session |
|
||||
|
||||
The test implementation should reference individual PRD criterion numbers in
|
||||
@@ -945,7 +947,7 @@ slices:
|
||||
6. Add Twurple chat and follower verification for `!spawn`.
|
||||
7. Add Extension authentication, identity binding, controller commands, and
|
||||
personalized state.
|
||||
8. Add the Twitch Bits adapter and configurable resurrection rule.
|
||||
8. Add the Twitch Channel Points redemption adapter and configured reward rule.
|
||||
9. Complete clean-checkout Twitch setup and troubleshooting documentation.
|
||||
10. Run automated, live-channel, multi-viewer, and repeated-floor acceptance
|
||||
tests against all 33 PRD criteria.
|
||||
@@ -955,7 +957,7 @@ slices:
|
||||
The following are intentionally configurable or version-dependent and do not
|
||||
change the domain design:
|
||||
|
||||
- exact Bits resurrection price;
|
||||
- Channel Points resurrection reward ID and broadcaster-managed cost;
|
||||
- concrete Twitch developer application and Extension identifiers;
|
||||
- exact Twitch scopes, EventSub event names, and Twurple configuration required
|
||||
by the versions selected at implementation time;
|
||||
@@ -983,7 +985,7 @@ Resolved behavior choices:
|
||||
3. The backend serializes commands by authoritative arrival order.
|
||||
4. The arrival timestamp at the backend gateway decides timer-boundary commands.
|
||||
5. Run state survives client reconnects but not backend process restarts.
|
||||
6. Bits resurrection restores full HP at spawn and grants AP next Player Phase.
|
||||
6. Channel Points resurrection restores full HP at spawn and grants AP next Player Phase.
|
||||
7. Broadcast and Extension modes share presentation, but only the authenticated
|
||||
Extension is interactive.
|
||||
8. The backend domain core is the sole authority for every state transition.
|
||||
|
||||
Reference in New Issue
Block a user