Hello,
i have found this network / multiplayer example on git:
BlockArena
I think there is a small typo in the readme:
... then navigate to "build/node" and start the server with node kha.js
node kha.js => node server.js
My problem is, i get this message when i calling >npm install:
*ws@0.4.32 install /path to project/BlockArena/build/node/node_modules/w> (node-gyp rebuild 2> builderror.log) || (exit 0)
make: Verzeichnis ,,/path to project/BlockArena/build/node/node_modules/ws/build" wird betreten
CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
bufferutil.target.mk:90: die Regel für Ziel ,,Release/obj.target/bufferutil/src/bufferutil.o" scheiterte
make: Verzeichnis ,,/path to project/BlockArena/build/node/node_modules/ws/build" wird verlassen*
I open two clients in my browser and have a strange behavior. The red blocks flicker in the left side of the canvas.
An when i close one client (close tab in browser) i get this error from the server:
*events.js:160
throw er; // Unhandled 'error' event
^
Error: channel closed
at process.target.send (internal/child_process.js:523:16)
at Object.kha_network_NodeProcessClient.send (/path to project/BlockArena/build/node/kha.js:14991:11)
at Object.kha_network_Session.sendToEverybody (/path to project/BlockArena/build/node/kha.js:15365:11)
at Object.kha_network_Session.update (/path to project/BlockArena/build/node/kha.js:15357:8)
at Timeout.kha_SystemImpl.synch [as _onTimeout] (/path to project/BlockArena/build/node/kha.js:3277:29)
at tryOnTimeout (timers.js:228:11)
at Timer.listOnTimeout (timers.js:202:5)*
I think that is because the server is not installed properly.
My node version: 6.3.1
npm version: 3.10.6
and the kha version is from git.
Before i found this demo, i have played a little bit with the node package 'ws'. Create sessions, store user-id und user-socket in a map send some bytes - nice and easy, but without the big features from the kha.network package (serialized objects, automatic synchronization, shared code between Client- and Server-App etc). Now I would never miss again these cool things.