gaia-project/viewer
2026-10-31 18:34:35 +01:00
..
docs Teach range boosts and passing through native tutorial controls (#333) 2026-09-17 16:49:47 +02:00
public Merge gaia-lost-fleet: Lost Fleet expansion, sandbox mode, sealed-bid auctions (#328) 2026-08-25 00:07:03 +02:00
scripts Test hosted localization bundles from the production origin 2026-10-20 14:36:11 +02:00
src fix(viewer): place spectator chat beside the turn order 2026-10-31 18:34:35 +01:00
vendor fix(viewer): replace embedded chat with integrated chat control 2026-10-31 01:44:57 +01:00
.eslintrc.js Merge gaia-lost-fleet: Lost Fleet expansion, sandbox mode, sealed-bid auctions (#328) 2026-08-25 00:07:03 +02:00
.gitignore fix(viewer): replace embedded chat with integrated chat control 2026-10-31 01:44:57 +01:00
.postcssrc 🚚 (viewer) Move to a subfolder 2021-02-21 01:05:36 +01:00
.travis.yml 🚚 (viewer) Move to a subfolder 2021-02-21 01:05:36 +01:00
index.html feat: remove Frontiers expansion; fix import cycles + base-game scoring clip; Vite dev app (engine 4.11.0, viewer 5.15.0) 2026-09-01 10:33:08 +00:00
index.ts perf(engine): 10x federation enumeration — fixes >10s move timeouts in prod games (#325) 2026-08-19 12:19:05 +02:00
package.json fix(viewer): place spectator chat beside the turn order 2026-10-31 18:34:35 +01:00
pnpm-lock.yaml Merge gaia-lost-fleet: Lost Fleet expansion, sandbox mode, sealed-bid auctions (#328) 2026-08-25 00:07:03 +02:00
README.md 📝 docs: add Boardgamers play link 2026-09-28 22:47:16 +02:00
shims.d.ts 🎨 Add global prettier settings / workflow 2021-02-21 10:29:45 +01:00
tsconfig.build.json 🔨 (viewer) Remove cross-env to improve cross-editor compatibility 2021-04-25 13:09:50 +02:00
tsconfig.json 🔨 (viewer) Remove cross-env to improve cross-editor compatibility 2021-04-25 13:09:50 +02:00
vite.config.ts perf: split viewer languages and artwork into separate assets 2026-09-30 00:29:46 +02:00
vitest.config.ts feat(viewer): migrate build to Vite 8 + rolldown, tests to vitest 4 (v5.14.0) 2026-09-01 09:00:07 +00:00
vitest.setup.ts feat(engine): simultaneous sealed bidding - any order, hidden until all in (BGS contract) 2026-09-08 10:03:24 +02:00
vue-global-shim.js fix: RangeError on Rotate sectors + bundle load crash (viewer 5.13.1, engine 4.10.3) 2026-09-01 08:09:31 +00:00
vue.config.js fix: RangeError on Rotate sectors + bundle load crash (viewer 5.13.1, engine 4.10.3) 2026-09-01 08:09:31 +00:00

gaia-viewer

A Vue.js / SVG UI for Gaia Project

Play online at

Check out boardgamers.space!

Build and Run

In the viewer's folder:

pnpm install
npm run serve

And open localhost:8080 in the browser.

You can change src/self-contained.ts to change the initial setup: number of players, factions...

Offline pass-and-play

The hosted viewer can run multiple hot-seat games entirely on a single phone:

  1. While online, open the app and choose Offline games (or open ?offline=1).
  2. Wait until the green banner says App available offline. On a phone, add Fight Club to the home screen for the most reliable way to launch it later.
  3. Choose New game. Offline creation uses the same Lost Fleet setup preview, sector rotation, player count, faction-selection, ban-phase, and official center-sector controls as online creation, without lobby seats or invitations. It defaults to Silent Auction with the Ban phase enabled.
  4. Create as many local games as needed and choose one from the offline lobby before passing the phone around. In airplane mode, opening the installed app falls back to this local lobby.

The first visit must be online so the browser can download and cache the web app. After that, the app shell and game assets are cached, while each game's latest state is saved synchronously in this browser profile after every command. A refresh, accidental close, or phone restart resumes the same game, including a turn that was only partly entered. The original single-game save from v5.31.0 is automatically imported into the offline lobby. Browser/site-data deletion also deletes the local library, so use Export backup when a separate recoverable copy matters. Hosted multiplayer games remain server-backed and are not copied into offline mode.

Include in other projects

For now there are three ways to include the viewer:

  • By importing individual components: If you want to integrate into an existing Vue APP, for example
  • Through index.ts, the default export is the launch function: The viewer will create its own Vue App on the given selector
  • Through unpkg.com/@gaia-project/viewer, which will set window.gaiaViewer or global.gaiaViewer. Here is an example:
<script src="//unpkg.com/vue@^2/dist/vue.min.js"></script>
<script src="//unpkg.com/bootstrap-vue@^2/dist/bootstrap-vue.min.js"></script>

<script source="//unpkg.com/@gaia-project/viewer">
<link type="text/css" rel="stylesheet" href="//unpkg.com/@gaia-project/viewer/dist/package/viewer.css">

If you want something else, contact us.

launch function

The default export, and window.gaiaViewer.launch / global.gaiaViewer.launch when included via a script tag, is a function taking a css selector as an argument. When executed, it instantiates a Game on the aformentioned element, and returns an EventEmitter that can be communicated with.

The EventEmitter has this interface:

// Give the new game data to the viewer
emitter.emit("state", gameData);
// Update preferences
emitter.emit("preferences", { noFactionFill: true });
// Set player - choose either. If no player is set, then everyone can play
// in the same window
emitter.emit("player", { auth: "xxx" });
emitter.emit("player", { index: 0 });
// Listen for move actions
emitter.on("move", (move) => {
  /* send move to backend and give back result */
});
// Signals that a player's name was clicked
emitter.on("player:clicked", ({ name, index, auth }) => {
  /* ... */
});

If you want a self-contained game which plays in the browser with no interaction with your code, you can do:

// via <script>
window.gaiaViewer.launchSelfContained("#my-selector");

// via import
import { launchSelfContained } from "@gaia-project/viewer";

Shared accessibility preference

The BGS colorBlind boolean is shared across games and defaults to false. The viewer applies it live to the distinctive red/green planet borders. Declare colorBlind as a checkbox in the game metadata; the platform displays the global control instead of a per-game option. Sound follows the shared sound preference independently.