Nonchalantly Perusing Magazines
    Have ideas to improve npm?Join in the discussion! »

    voxel-server

    2.1.1 • Public • Published

    voxel-server

    multiplayer server for voxel-engine

    Use with voxel-client

    Using as a module

    The returned server object implements EventEmitter

    var Server = require('voxel-server')
    
    var settings = {
      // various [voxel-engine]() settings to be sent to the clients
      avatarInitialPosition: [2, 20, 2],
      // list of incomming custom events to forward to all clients
      forwardEvents: ['attack','voiceChat']
    }
    
    // create server
    var server = Server(settings)
    
    // bind events
    server.on('missingChunk', function(chunk){ ... })
    server.on('client.join', function(client){ ... })
    server.on('client.leave', function(client){ ... })
    server.on('client.state', function(state){ ... })
    server.on('chat', function(message){ ... })
    server.on('set', function(pos, val, client){ ... })
    server.on('error', function(error){ ... })
    
    // connect a client
    var duplexStream = SomeTransportSteam()
    server.connectClient(duplexStream)

    transport streams

    websockets: websocket-stream

    webRTC: rtc-data-stream

    further reading:

    license

    BSD

    Keywords

    none

    Install

    npm i voxel-server

    DownloadsWeekly Downloads

    7

    Version

    2.1.1

    License

    BSD*

    Unpacked Size

    8.47 kB

    Total Files

    4

    Last publish

    Collaborators

    • avatar