Позволяет вести просчет физики Phaser 3 на стороне сервера
-
In main file
app.js
orindex.js
import module with options :Option Argument Description server
require The require('http').Server(app)
.io
require The Socket.io require('socket.io').listen(server)
.port
optional Default 8080
.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 The require('http').Server(app)
.imports
optional Object { key:value, key2:value2 }
werekey
is literal name,value
is string valueurl
or modulerequire(url)
var obj = { Constants: '/src/shared/Constants.js', fs: require('fs'), } PhaserAuthoritativeServer.startScene('/src/server/Scene.js', obj)