Skip to main content

AI VTuber Broadcast

Overview

This guide explains the current ProjectP broadcast-console workflow for running a YouTube-style AI VTuber stream inside the ProjectP client.

The current implementation combines:

  • an in-world broadcast console item
  • one target NPC
  • YouTube OAuth and live-chat polling
  • OBS for outgoing video streaming

Current Runtime Split

The current implementation is built from three parts.

BroadcastController

Owns:

  • Google OAuth
  • token storage
  • broadcast creation
  • reusable stream lookup or creation
  • stream preparation
  • YouTube live-chat polling
  • current watch URL / RTMP / stream key state

BroadcastChatNpcRelay

Owns:

  • reading the current chat feed from BroadcastController
  • choosing the next usable viewer message
  • resolving the selected target NPC
  • forwarding the message to that NPC through the normal AI NPC path

This component should stay thin.

ItemBroadcastConsole

Owns:

  • the in-world control UI
  • Google Client ID / Client Secret inputs
  • target NPC selection
  • login / start / stop button flow
  • current status display

OBS

OBS still sends the actual video stream to YouTube.

ProjectP renders the world and the NPC.

OBS captures that output and transmits it using the RTMP values prepared by the console.

Supported Scope

  • YouTube OAuth login from the client
  • local token storage on the broadcast console
  • watch URL / RTMP / stream key display
  • reusable stream workflow
  • live-chat polling
  • one-NPC chat relay
  • Auto target mode that uses the first NPC found in the world

Current Limitations

  • one target NPC at a time
  • one-message-at-a-time relay
  • normal AI NPC response path only
  • no in-console OBS control
  • no multi-NPC broadcast flow

Prerequisites

Before using the broadcast console:

  1. Prepare a YouTube channel that is allowed to go live.
  2. In Google Cloud Console, enable YouTube Data API v3.
  3. Create an OAuth 2.0 desktop client.
  4. Prepare the Client ID.
  5. Prepare the Client Secret.

Notes:

  • Some desktop OAuth flows can work without a secret, but the current ProjectP sample expects both values to be available.
  • If the OAuth consent screen is still in testing mode, add the intended Google account as a test user.

World Setup

  1. Prepare at least one NPC with NpcDesc.
  2. Place the broadcast console item in the world.
  3. Make sure the item contains:
    • BroadcastController
    • BroadcastChatNpcRelay
    • ItemBroadcastConsole
  4. Open the console UI.
  5. Enter:
    • Google Client ID
    • Google Client Secret
  6. Choose Target NPC.

Target selection behavior:

  • Auto uses the first NPC found in the loaded world
  • explicit NPC name uses the selected NpcDesc.npcName

The target list refreshes:

  • when the console opens
  • when the target dropdown is opened

Ownership And Control

The console can be configured to require item ownership before control actions are allowed.

In that mode:

  • the user controlling the broadcast console must own the item
  • login, start, and stop actions are blocked until ownership is available
  • the console UI still shows status, but protected actions stay host-only

This prevents multiple users from fighting over the same live session state.

Login Flow

  1. Click Login YouTube.
  2. A browser window opens.
  3. Sign in with the Google account that owns the YouTube channel.
  4. Approve access.
  5. Return to ProjectP and confirm the console changes into a connected state.

The console stores token state locally, so repeated login is usually unnecessary while the refresh token remains valid.

Broadcast Preparation Flow

  1. Click Start Broadcast.
  2. The console creates or reuses the YouTube live stream.
  3. The console creates or refreshes the broadcast session.
  4. The console binds the broadcast to the stream.
  5. The console displays:
    • watch URL
    • RTMP server URL
    • stream key
  6. Copy the RTMP values into OBS.
  7. Start streaming from OBS.
  8. The console continues polling until the stream state becomes live.

OBS Setup

Basic OBS setup:

  1. Create a new scene.
  2. Add the ProjectP client as a source.
  3. In Settings -> Stream, choose Custom.
  4. Paste the RTMP server URL from the console.
  5. Paste the stream key from the console.
  6. Start streaming in OBS.

Recommended capture order:

  • Game Capture
  • Window Capture
  • Display Capture

Chat Relay Flow

BroadcastChatNpcRelay works like this:

  1. Read the current JSON chat feed from BroadcastController.
  2. Ignore already-processed chat entries.
  3. Skip unsupported message types.
  4. Choose the next usable textMessageEvent.
  5. Resolve the target NPC.
  6. Call ExecuteNpcChatAsync(...).
  7. Push the reply back through the normal NPC chat and speech path.

The relay also supports:

  • ignoreExistingMessagesOnStart prevents the NPC from responding to old chat history when the relay boots
  • minReplyIntervalSeconds enforces a minimum reply gap to avoid spammy back-to-back speech

Troubleshooting

Browser login succeeds but token exchange fails

Check:

  • Client ID is correct
  • Client Secret is correct
  • the Google account is allowed in the OAuth consent configuration
  • the YouTube channel is actually live-enabled

Target NPC dropdown is empty

Check:

  • the world has at least one object with NpcDesc
  • the NPC is loaded in the current world

Chat appears in YouTube but the NPC does not answer

Check:

  • the console is not still in auth or start-in-progress state
  • Target NPC is set correctly
  • the selected NPC has working AI chat
  • the broadcast state is no longer idle

OBS is streaming but YouTube does not become live

Check:

  • RTMP server URL is correct
  • stream key is correct
  • OBS is really sending to the configured endpoint
  • the YouTube channel is allowed to start live broadcasts