Coder Social home page Coder Social logo

commlibexamples's Introduction

Spaceify Communication Framework Examples

Examples and documentation of using the Spaceify Communication Framework API

Usage

You can use the Spaceify Communication Framework API in your code by adding the following script tag to your page:

<script type="text/javascript" src="http://spaceify.net/games/g/gamelib.min.js"></script>

The API is used through the simple GameClient class. The documentation of the GameClient class can be found in the directory "doc/api". You can browse the API docs online at http://htmlpreview.github.io/?https://github.com/ptesavol/commlibexamples/blob/master/doc/api/interface_game_client.html

The complete description of the GameClient class is available in WebIDL format with comments at https://github.com/ptesavol/commlibexamples/blob/master/doc/commlib.idl

Analogue gamepad example

An example of implementing an analogue gamepad in HTML5 is now available in the folder "www/duckscontroller". You can open it for development using an URL of the format:

http://localhost/~ptesavol/comm/duckscontroller/controller.html?host=spaceify.net&port=1979&gid=petris_own_group

Remember to replace the path with your own path, and the "gid" parameter with your group id. See the javascript console of your screen browser see what kind of RPC calls the controller tries to make, and implement them in your screen code.

The RPC methods you need to implement and expose in the screen are the following (in WebIDL format):

void setPlayerName(DOMString name, DOMString callerId);

void playerMove(dictionary coordinates {float x,float y}, DOMString callerId);

Local CommunicationHub binary

Local CommunicationHub binary is now available in the "bin" directory. Local CommunicationHub is especially useful for supporting iOS devices, the browser of which does not support WebRTC.

In order to use the Local CommunicationHub, first do this in your shell:

cd bin
npm install
chmod u+x localhub.sh

Then edit the localhub.sh file and insert there the one of your IP addresses that the mobile devices can see.

Now you are ready to start the local CommunicationHub by issuing the command

./localhub.sh

The CommunicationHub does not print much output to the console. If it does not start, make sure the ip address (--host) and port (--port) defined in the "localhub.sh" are free on your computer. You can know that the LocalHub is working correctly if it prints messages about opening and closing connections whenever you refresh the testscreen.html page in your web browser.

commlibexamples's People

Stargazers

codise avatar

Watchers

Petri Savolainen avatar codise avatar Sven Mayer avatar Max. Müller avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.