# StreamArena SDK

> Build a game for live streams in one JavaScript file. The StreamArena runtime handles chat, phone join, answer matching, timing, scores and the stream overlay.

The StreamArena SDK lets you build a live stream game in one JavaScript file. You describe one round, and the runtime does the rest: chat from YouTube, Twitch, Kick and Rumble through Upstream.so, phone join by QR code, loose answer matching, timing by when an answer was sent, the house player, the scoreboard and the 16:9 overlay.

> **Internal for now:** The SDK is internal today, and names will change before makers get access. Join the [creator program](https://streamarena.so/creator-program/) waitlist to get it when it opens.

## What a game looks like

A game is one object passed to `Playcade.game()`. Its `round()` function runs once per round.

```js
Playcade.game({
  id: 'movie-barcode',
  title: 'Movie Barcode',
  inputs: ['guess'],
  content: FILMS,
  async round({ item, show, chat, timer, reveal }) {
    show.html(barcode(item))            // draw anything in the game area
    chat.expect(item.title)             // loose matching, faster answers score more
    await timer(40, { 12: () => show.hint('Released ' + item.year) })
    await reveal(item.title)
  },
})
```

## What the runtime does for you

- Reads chat from Upstream.so's Multi-chat and answers from phones, and hands both to your game in one shape.
- Matches guesses loosely: case, accents, "the", filler words and small typos.
- Times every answer from when the viewer saw the round, so a slow platform never loses.
- Runs a house player when fewer than three people are playing.
- Draws the header, the join code, the timer and the scoreboard around your game area.
- Passes names and free text through the safety filter before they reach the screen.

## Next
  - [Your first game](https://streamarena.so/docs/first-game/): Zoom Out, the sample game, line by line.
  - [Guesses, votes and teams](https://streamarena.so/docs/guides/inputs/): The three ways players answer.
  - [The round](https://streamarena.so/docs/reference/round/): Everything round() gets.
  - [Get your game approved](https://streamarena.so/docs/guides/review/): What we check before a game goes live.
