Skip to content

Octane-Overlay/Octane-React

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

9 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿš—๐Ÿ’จ Octane-React

โš›๏ธ React hooks for the Octane Rocket League overlay toolkit.

@octane-rl/react wraps @octane-rl/core in a tiny set of ergonomic React hooks so you can build live Rocket League overlays, scoreboards, stat tickers, replay screens, and casting tools without ever touching the Rocket League Stats API. ๐ŸŽฎโœจ

๐Ÿ“ฆ What's in the box

  • ๐Ÿ”Œ Auto-managed connection to the Octane WebSocket relay (no boilerplate, no listeners to clean up).
  • ๐Ÿง  Full game state via useOctaneState (score, time, players, ball, boost, much more).
  • ๐Ÿ›ฐ๏ธ Match metadata via useOctaneMeta (teams, players, arena info).
  • ๐ŸŽฌ Lifecycle awareness via useOctaneGameState (idle, live, replay, podium, paused, ended).
  • ๐Ÿ”” Typed gameplay events via useOctaneEvents (goals, ball hits, crossbar pings, statfeed, countdowns, and more).
  • ๐Ÿงฐ TypeScript-first with full type inference on every event.
  • โšก React 19 ready, ESM-only, zero config.

๐Ÿš€ Installation

npm install @octane-rl/react
# or
pnpm add @octane-rl/react
# or
yarn add @octane-rl/react

โ„น๏ธ react@^19 is a hard requirement. @octane-rl/core ships alongside as the underlying transport.

๐Ÿ› ๏ธ Setup

Octane-React talks to the Octane-Bridge over a local WebSocket. Make sure:

  1. ๐ŸŽฏ Rocket League is running.
  2. ๐Ÿ›œ The bridge is installed and running.
  3. ๐Ÿ”ข You know the port the bridge is listening on (defaults to 49124).

โš™๏ธ Configure (optional)

If you need a custom port, call configureOctane once at app startup, before any hook renders:

// main.tsx
import { configureOctane } from '@octane-rl/react'

configureOctane({ port: 49124 })

๐Ÿชง Configuration is sticky. After the first hook subscribes, the connection opens and further configureOctane calls are ignored (with a warning). ๐Ÿ”’

๐Ÿช The Hooks

๐Ÿ“Š useOctaneState()

Streams the latest full game state. Returns null until the first update lands.

import { useOctaneState } from '@octane-rl/react'

export function Scoreboard() {
  const state = useOctaneState()
  if (!state) {
    return <div>โณ Waiting for Rocket League...</div>
  }

  return (
    <div>
      ๐Ÿ”ต {state.game.teams[0].score} : {state.game.teams[1].score} ๐ŸŸ 
    </div>
  )
}

๐Ÿชช useOctaneMeta()

Returns the per-match meta (team names, player roster, arena, etc.) once the match initializes.

import { useOctaneMeta } from '@octane-rl/react'

export function MatchHeader() {
  const meta = useOctaneMeta()
  if (!meta) return null

  return <h1>๐ŸŸ๏ธ {meta.arena}</h1>
}

Tip

The meta is provided by the bridge. To update the meta, the Admin Panel is required. Otherwise the metadata is empty and teamnames and logos will be missing.

๐ŸŽญ useOctaneGameState()

Reduces the firehose of lifecycle events into a single, friendly enum. Perfect for swapping overlays per phase.

import { useOctaneGameState, GameState } from '@octane-rl/react'

export function OverlayRouter() {
  const phase = useOctaneGameState()

  switch (phase) {
    case GameState.live:         return <LiveScoreboard />     // ๐ŸŸข
    case GameState.replay:       return <GoalReplayBanner />   // ๐ŸŽฌ
    case GameState.replayEnding: return <FadeOut />            // ๐ŸŒซ๏ธ
    case GameState.paused:       return <PauseCard />          // โธ๏ธ
    case GameState.podium:       return <PodiumScreen />       // ๐Ÿ†
    case GameState.ended:        return <PostGameStats />      // ๐Ÿ“ˆ
    case GameState.idle:         return <Idle />               // ๐Ÿ’ค
  }
}

Possible values: idle ๐Ÿ’ค, live ๐ŸŸข, replay ๐ŸŽฌ, replayEnding ๐ŸŒซ๏ธ, podium ๐Ÿ†, ended ๐Ÿ“ˆ, paused โธ๏ธ.

๐Ÿ”” useOctaneEvents()

Subscribe to gameplay events. Two modes:

๐ŸŒ All events

import { useOctaneEvents } from '@octane-rl/react'

export function EventTicker() {
  const event = useOctaneEvents()
  return <pre>{event && JSON.stringify(event, null, 2)}</pre>
}

๐ŸŽฏ A single event type (fully typed payload)

import { useOctaneEvents, EventType } from '@octane-rl/react'

export function GoalToast() {
  const goal = useOctaneEvents(EventType.goalScored)
  if (!goal) return null
  return <div>โšฝ GOAL by {goal.scorer.name}!</div>
}

Available gameplay event types:

Event ๐ŸŽŸ๏ธ EventType value Payload
โšฝ Goal scored EventType.goalScored GoalScoredEvent
๐Ÿ€ Ball hit EventType.ballHit BallHitEvent
๐Ÿฅ… Crossbar hit EventType.crossbarHit CrossbarHitEvent
๐Ÿ•’ Clock tick EventType.clockUpdatedSeconds ClockUpdatedEvent
3๏ธโƒฃ Countdown begin EventType.countdownBegin CountdownBeginEvent
๐Ÿšฆ Round started EventType.roundStarted RoundStartedEvent
๐Ÿ“ข Statfeed EventType.statfeedEvent StatFeedEvent (use StatFeedEventType for sub-typing)

๐Ÿงน Lifecycle events (match start/end, replay phases, pause) are filtered out of useOctaneEvents. Use useOctaneGameState for those.

๐Ÿงช A complete mini-overlay

import {
  configureOctane,
  useOctaneState,
  useOctaneGameState,
  useOctaneEvents,
  GameState,
  EventType,
} from '@octane-rl/react'

configureOctane({ port: 49124 })

export function Overlay() {
  const state = useOctaneState()
  const phase = useOctaneGameState()
  const lastGoal = useOctaneEvents(EventType.goalScored)

  if (phase === GameState.idle) return <div>๐Ÿ’ค Waiting for kickoff...</div>

  return (
    <div className="overlay">
      <div className="score">
        ๐Ÿ”ต {state?.game.teams[0].score ?? 0}
        <span> : </span>
        {state?.game.teams[1].score ?? 0} ๐ŸŸ 
      </div>
      {phase === GameState.replay && lastGoal && (
        <div className="goal-card">โšฝ {lastGoal.scorer.name} scored!</div>
      )}
    </div>
  )
}

๐Ÿงฐ Scripts

npm run build      # ๐Ÿ“ฆ build ESM + .d.ts via tsup
npm run dev        # ๐Ÿ‘€ watch mode
npm run typecheck  # ๐Ÿง tsc --noEmit
npm run test       # ๐Ÿงช jest

๐Ÿค Contributing

PRs welcome! ๐Ÿ’š Please run npm run typecheck and npm run test before opening one.

๐Ÿ“œ License

MIT ๐Ÿ†“

About

Contains React Hooks that offer an intuitive and ergonomic way to integrate the Octane Rocket League overlay into React applications

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages