Skip to content

Latest commit

 

History

History

controller-client-lib

controller-client-lib

This is a TypeScript library to send inputs from a remote controller (phone) to the main Unity game and also receive data from the game over websockets. It works in the browser and in nodejs (thanks to isomorphic-ws).

See the ControllerClient class in ./src/ControllerClient.ts for documentation.

The server part of the game is implemented by ControllerServer.cs, ControllerInput.cs and the other scripts in ../../SynergyQuest/Assets/Scripts/ControllerInput. Take a look, these files are also quite well documented.

The full controller web app which makes use of this library can be found at ../controller-app.

Usage

You first should orient yourself on the README.md in the above folder the general build instructions. However, if you want to test this library in isolation from the other game components, you can follow these instructions.

We use yarn for managing dependencies and building the project.

  1. Install dependencies: yarn install
  2. Produce a production build with
    yarn build

To add this library to a node app:

yarn add path/to/controller-client-lib

Remarks

Setting up a typescript library that works in nodejs and the browser and can be imported by other projects is hell. Fortunately I found this template which has been used to setup the build environment for this lib: create-react-library