herm-js-network

Herm-js network tool package for powerful network packet transmission.

Usage no npm install needed!

<script type="module">
  import hermJsNetwork from 'https://cdn.skypack.dev/herm-js-network';
</script>

README

Herm network tools

NPM

Collection of network wrappers for Herm

Network compensator

Allow you to interpolate values based on time thought network calls.

import { NetworkCompensator } from 'herm-js';

const characterPosition = {
    x: new NetworkCompensator(0),
    y: new NetworkCompensator(0),
    z: new NetworkCompensator(0),
};

network.onValue((position) => {
    characterPosition.x.set(position),
    characterPosition.y.set(position),
    characterPosition.z.set(position),
});

...

// even if no network update is received, Herm interpolate and guess the next value

requestAnimationFrame(() => character.setPosition(characterPosition));