🚀 | Setup

Setting up Playroom Kit

Using NPM

If you are using npm, install Playroom Kit and its peer dependencies:

npm install --save playroomkit react react-dom

Then import it into your project:

import { onPlayerJoin, insertCoin, isHost, myPlayer } from "playroomkit";

Using a CDN

You can also directly include it via a script tag from a CDN like unpkg.com or our own cdn.joinplayroom.com, make sure to also include the peer dependencies also (react, react-dom):

  <script src="https://cdn.joinplayroom.com/react@18.2.0/umd/react.development.js"></script>
  <script src="https://cdn.joinplayroom.com/react-dom@18.2.0/umd/react-dom.development.js"></script>
  <script src="https://cdn.joinplayroom.com/playroomkit/multiplayer.umd.js"></script>
    const { onPlayerJoin, insertCoin, isHost, myPlayer } = Playroom;

This will make the Playroom object available on the global scope.

Next Steps

Refer to Usage for your engine of choice.