phaser3-authoritative-server
v0.0.4
Published
Run Phaser 3 on server side
Downloads
9
Maintainers
Readme
Phaser 3 authoritative server
Позволяет вести просчет физики Phaser 3 на стороне сервера
Usage
In main file
app.js
orindex.js
import module with options : Option | Argument | Description ---------|----------|---------server
| require | Therequire('http').Server(app)
.io
| require |The Socket.iorequire('socket.io').listen(server)
.port
| optional|Default8080
.Example:
const express = require('express') const app = express() const server = require('http').Server(app) const io = require('socket.io').listen(server) const PhaserAuthoritativeServer = require('phaser3-authoritative-server')(server, io, 8080)
Then start scene with metod
startScene(url,imports)
:In scene file not working 'import' and 'require'. Use
imports
option.| Option | Argument | Description | | --------- | ------------ | ----------------------------------------------------------------------------------------------------------------------------- | |
url
| require | Therequire('http').Server(app)
. | |imports
| optional | Object{ key:value, key2:value2 }
werekey
is literal name,value
is string valueurl
or modulerequire(url)
|Example:
var obj = { Constants: '/src/shared/Constants.js', fs: require('fs'), } PhaserAuthoritativeServer.startScene('/src/server/Scene.js', obj)