npm.io
1.0.24 • Published 6 years ago

antelopejs

Licence
(MIT OR Apache-2.0)
Version
1.0.24
Deps
0
Size
8 kB
Vulns
0
Weekly
0

Antelope Networking

Jackalope


Example

Documentation

About

What it is:

Antelope Networking is a library used to help develop JavaScript multiplayer games with a determanistic client server architecture. Antelope should be considered the layer in between, just barely reaching into both your client and your server.

What it isn't:

Antelope will not help with things like user input or server architecture.

What it Might Be:

In the future I plan on extracting Socket.IO in favor of writing our own WebSocket solution. Socket.IO is heavy and unnecesary for a solution like this, but to get MVP working the decision has been made to just endure. In the future, writing a Unity Client port would be a great opportunity. As of now I think keeping it JS on the client side is a win because of the ability to share code between the server and client in terms of movement methods etc.


Motivation

Antelope Networking is mostly a pet project for me to learn more about networking architecture. At the moment I believe that there is a considerable lack of networking implementations that are easy to use and follow client/server architecture.


Features

  • Client Side Reconciliation
  • Server Side Value Validation
  • Flexable: Antelope just track values. what you do with them is up to you.

Examples

Client
const xPosition = new ClientNetowrkValue(10, 'x-posiiton', socket);

xPosition.set(5);

xPosition.get();
Server

function validate(newPos, input) {
    if (movementIsPossible(oldPos, newPos, input)) {
        return newPos;
    } else {
        getNewPosition(oldPos, input);
    }
}

const xPosition = new ServerNetworkValue('x-position', validate, socket);

Tests

Antelope utilizes Mocha and Chai for testing. To run the tests you can npm run test.


License

MIT License