geckosio / phaser3-multiplayer-game-example Goto Github PK
View Code? Open in Web Editor NEWPhaser 3 multiplayer game example using geckos.io
License: MIT License
Phaser 3 multiplayer game example using geckos.io
License: MIT License
We should replace @geckos.io/phaser-on-nodejs
with arcade-physics
.
This example doesn't seem to be working with latest version of geckos.
Hi, this repo looks really interesting, but following the instructions here (on Chrome 87, Win 10).
I just get the following error after reaching npm run start
:1444/.wrtc/v1/connections:1 Failed to load resource: the server responded with a status of 404 (Not Found)
client.44ccaf22.js:204731 Unexpected token < in JSON at position 0
(anonymous) @ client.44ccaf22.js:204731
step @ client.44ccaf22.js:204571
(anonymous) @ client.44ccaf22.js:204501
rejected @ client.44ccaf22.js:204463
client.44ccaf22.js:205394 Unexpected token < in JSON at position 0
(anonymous) @ client.44ccaf22.js:205394
(anonymous) @ client.44ccaf22.js:205191
step @ client.44ccaf22.js:205024
(anonymous) @ client.44ccaf22.js:204954
fulfilled @ client.44ccaf22.js:204908
:1444/favicon.ico:1
$ node ./server/server.js
internal/modules/cjs/loader.js:964
throw err;
^
Error: Cannot find module '../build/Release/wrtc.node'
Require stack:
- /home/hhm/Dokumente/Phaser Projects/phaser3-multiplayer-game/node_modules/wrtc/lib/binding.js
- /home/hhm/Dokumente/Phaser Projects/phaser3-multiplayer-game/node_modules/wrtc/lib/index.js
- /home/hhm/Dokumente/Phaser Projects/phaser3-multiplayer-game/node_modules/@geckos.io/server/lib/wrtc/webrtcConnection.js
- /home/hhm/Dokumente/Phaser Projects/phaser3-multiplayer-game/node_modules/@geckos.io/server/lib/wrtc/connectionsManager.js
- /home/hhm/Dokumente/Phaser Projects/phaser3-multiplayer-game/node_modules/@geckos.io/server/lib/server.js
- /home/hhm/Dokumente/Phaser Projects/phaser3-multiplayer-game/node_modules/@geckos.io/server/lib/index.js
- /home/hhm/Dokumente/Phaser Projects/phaser3-multiplayer-game/server/game/gameScene.js
- /home/hhm/Dokumente/Phaser Projects/phaser3-multiplayer-game/server/game/config.js
- /home/hhm/Dokumente/Phaser Projects/phaser3-multiplayer-game/server/game/game.js
- /home/hhm/Dokumente/Phaser Projects/phaser3-multiplayer-game/server/server.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:961:17)
at Function.Module._load (internal/modules/cjs/loader.js:854:27)
at Module.require (internal/modules/cjs/loader.js:1023:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (/home/hhm/Dokumente/Phaser Projects/phaser3-multiplayer-game/node_modules/wrtc/lib/binding.js:6:20)
at Module._compile (internal/modules/cjs/loader.js:1128:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1167:10)
at Module.load (internal/modules/cjs/loader.js:983:32)
at Function.Module._load (internal/modules/cjs/loader.js:891:14)
at Module.require (internal/modules/cjs/loader.js:1023:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/home/hhm/Dokumente/Phaser Projects/phaser3-multiplayer-game/node_modules/wrtc/lib/binding.js',
'/home/hhm/Dokumente/Phaser Projects/phaser3-multiplayer-game/node_modules/wrtc/lib/index.js',
'/home/hhm/Dokumente/Phaser Projects/phaser3-multiplayer-game/node_modules/@geckos.io/server/lib/wrtc/webrtcConnection.js',
'/home/hhm/Dokumente/Phaser Projects/phaser3-multiplayer-game/node_modules/@geckos.io/server/lib/wrtc/connectionsManager.js',
'/home/hhm/Dokumente/Phaser Projects/phaser3-multiplayer-game/node_modules/@geckos.io/server/lib/server.js',
'/home/hhm/Dokumente/Phaser Projects/phaser3-multiplayer-game/node_modules/@geckos.io/server/lib/index.js',
'/home/hhm/Dokumente/Phaser Projects/phaser3-multiplayer-game/server/game/gameScene.js',
'/home/hhm/Dokumente/Phaser Projects/phaser3-multiplayer-game/server/game/config.js',
'/home/hhm/Dokumente/Phaser Projects/phaser3-multiplayer-game/server/game/game.js',
'/home/hhm/Dokumente/Phaser Projects/phaser3-multiplayer-game/server/server.js'
]
}
$ node -v
v13.3.0
OS:
Ubuntu 19.04
I used to be able to get this demo to work, but when I try to run "npm install" now, it tells me that there is a problem with the installation of the canvas package. I think it is to do with the version
npm WARN deprecated [email protected]: Use your platform's native performance.now() and performance.timeOrigin.
npm WARN deprecated [email protected]: < 18.1.0 is no longer supported
npm ERR! code 1
npm ERR! path /Users/qiler/Documents/phaser3-multiplayer-game-example/node_modules/canvas
npm ERR! command failed
npm ERR! command sh -c -- node-pre-gyp install --fallback-to-build --update-binary
npm ERR! Failed to execute '/Users/qiler/.nvm/versions/node/v16.18.0/bin/node /Users/qiler/.nvm/versions/node/v16.18.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --update-binary --module=/Users/qiler/Documents/phaser3-multiplayer-game-example/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/Users/qiler/Documents/phaser3-multiplayer-game-example/node_modules/canvas/build/Release --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v93' (1)
npm ERR! node-pre-gyp info it worked if it ends with ok
npm ERR! node-pre-gyp info using [email protected]
npm ERR! node-pre-gyp info using [email protected] | darwin | arm64
npm ERR! node-pre-gyp http GET https://github.com/Automattic/node-canvas/releases/download/v2.10.2/canvas-v2.10.2-node-v93-darwin-unknown-arm64.tar.gz
npm ERR! node-pre-gyp ERR! install response status 404 Not Found on https://github.com/Automattic/node-canvas/releases/download/v2.10.2/canvas-v2.10.2-node-v93-darwin-unknown-arm64.tar.gz
npm ERR! node-pre-gyp WARN Pre-built binaries not installable for [email protected] and [email protected] (node-v93 ABI, unknown) (falling back to source compile with node-gyp)
npm ERR! node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/Automattic/node-canvas/releases/download/v2.10.2/canvas-v2.10.2-node-v93-darwin-unknown-arm64.tar.gz
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | darwin | arm64
npm ERR! gyp info ok
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | darwin | arm64
npm ERR! gyp info find Python using Python version 3.8.9 found at "/Library/Developer/CommandLineTools/usr/bin/python3"
npm ERR! gyp info spawn /Library/Developer/CommandLineTools/usr/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/Users/qiler/.nvm/versions/node/v16.18.0/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args 'binding.gyp',
npm ERR! gyp info spawn args '-f',
npm ERR! gyp info spawn args 'make',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/qiler/Documents/phaser3-multiplayer-game-example/node_modules/canvas/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/qiler/.nvm/versions/node/v16.18.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/qiler/Library/Caches/node-gyp/16.18.0/include/node/common.gypi',
npm ERR! gyp info spawn args '-Dlibrary=shared_library',
npm ERR! gyp info spawn args '-Dvisibility=default',
npm ERR! gyp info spawn args '-Dnode_root_dir=/Users/qiler/Library/Caches/node-gyp/16.18.0',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/Users/qiler/.nvm/versions/node/v16.18.0/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/Users/qiler/Library/Caches/node-gyp/16.18.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/Users/qiler/Documents/phaser3-multiplayer-game-example/node_modules/canvas',
npm ERR! gyp info spawn args '-Dnode_engine=v8',
npm ERR! gyp info spawn args '--depth=.',
npm ERR! gyp info spawn args '--no-parallel',
npm ERR! gyp info spawn args '--generator-output',
npm ERR! gyp info spawn args 'build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! /bin/sh: pkg-config: command not found
npm ERR! gyp: Call to 'pkg-config pixman-1 --libs' returned exit status 127 while in binding.gyp. while trying to load binding.gyp
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
npm ERR! gyp ERR! stack at ChildProcess.onCpExit (/Users/qiler/.nvm/versions/node/v16.18.0/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:284:16)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:293:12)
npm ERR! gyp ERR! System Darwin 21.4.0
npm ERR! gyp ERR! command "/Users/qiler/.nvm/versions/node/v16.18.0/bin/node" "/Users/qiler/.nvm/versions/node/v16.18.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--update-binary" "--module=/Users/qiler/Documents/phaser3-multiplayer-game-example/node_modules/canvas/build/Release/canvas.node" "--module_name=canvas" "--module_path=/Users/qiler/Documents/phaser3-multiplayer-game-example/node_modules/canvas/build/Release" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v93"
npm ERR! gyp ERR! cwd /Users/qiler/Documents/phaser3-multiplayer-game-example/node_modules/canvas
npm ERR! gyp ERR! node -v v16.18.0
npm ERR! gyp ERR! node-gyp -v v9.1.0
npm ERR! gyp ERR! not ok
npm ERR! node-pre-gyp ERR! build error
npm ERR! node-pre-gyp ERR! stack Error: Failed to execute '/Users/qiler/.nvm/versions/node/v16.18.0/bin/node /Users/qiler/.nvm/versions/node/v16.18.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --update-binary --module=/Users/qiler/Documents/phaser3-multiplayer-game-example/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/Users/qiler/Documents/phaser3-multiplayer-game-example/node_modules/canvas/build/Release --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v93' (1)
npm ERR! node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/Users/qiler/Documents/phaser3-multiplayer-game-example/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
npm ERR! node-pre-gyp ERR! stack at ChildProcess.emit (node:events:513:28)
npm ERR! node-pre-gyp ERR! stack at maybeClose (node:internal/child_process:1100:16)
npm ERR! node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:304:5)
npm ERR! node-pre-gyp ERR! System Darwin 21.4.0
npm ERR! node-pre-gyp ERR! command "/Users/qiler/.nvm/versions/node/v16.18.0/bin/node" "/Users/qiler/Documents/phaser3-multiplayer-game-example/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--update-binary"
npm ERR! node-pre-gyp ERR! cwd /Users/qiler/Documents/phaser3-multiplayer-game-example/node_modules/canvas
npm ERR! node-pre-gyp ERR! node -v v16.18.0
npm ERR! node-pre-gyp ERR! node-pre-gyp -v v1.0.10
npm ERR! node-pre-gyp ERR! not ok
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/qiler/.npm/_logs/2022-12-19T06_08_07_602Z-debug-0.log
I'm not exactly sure what the problem is. Most of the repos on geckosio is presenting me with this error when I run npm install.
Can someone please take a look
As I was said that https://github.com/yandeu/phaser3-multiplayer-with-physics outdated and geckos.io is better performance, please port "Phaser 3 with multiplayer physics" to geckos.io then newbie like me can understand more about geckos.io
Thanks
So I am mucking around making a goof for work and I cloned this again as a starting point. A while back I played with this and it worked fine.
But this time when I ran the server I got an exception launching it around css-builder.js and when I tried loading it I got the error defined in this SO post.
https://stackoverflow.com/questions/66526161/parcel-failed-with-css-loader-js-invalid-version-undefined-error
Per this post I resolved the issue by rolling back to version 1.12.3 of parcel. Just thought you should know.
Thanks for this repo. As someone with too little time and too many ambitions its things like this that make me able to realize my goofs :)
[nodemon] starting `node server/server.js`
Server running at http://localhost:1234
🚨 /Users/anonymous.coward/Downloads/phaser3-multiplayer-game-example-master 2/node_modules/parcel/src/builtins/css-loader.js: Invalid Version: undefined
🚨 /Users/anonymous.coward/Downloads/phaser3-multiplayer-game-example-master 2/node_modules/parcel/src/builtins/css-loader.js: Invalid Version: undefined
at new SemVer (/Users/anonymous.coward/Downloads/phaser3-multiplayer-game-example-master 2/node_modules/@babel/preset-env/node_modules/semver/semver.js:314:11)
at compare (/Users/anonymous.coward/Downloads/phaser3-multiplayer-game-example-master 2/node_modules/@babel/preset-env/node_modules/semver/semver.js:647:10)
at lt (/Users/anonymous.coward/Downloads/phaser3-multiplayer-game-example-master 2/node_modules/@babel/preset-env/node_modules/semver/semver.js:688:10)
at /Users/anonymous.coward/Downloads/phaser3-multiplayer-game-example-master 2/node_modules/@babel/preset-env/lib/index.js:280:22
at Object.default (/Users/anonymous.coward/Downloads/phaser3-multiplayer-game-example-master 2/node_modules/@babel/helper-plugin-utils/lib/index.js:22:12)
at getEnvPlugins (/Users/anonymous.coward/Downloads/phaser3-multiplayer-game-example-master 2/node_modules/parcel/src/transforms/babel/env.js:62:34)
at getEnvConfig (/Users/anonymous.coward/Downloads/phaser3-multiplayer-game-example-master 2/node_modules/parcel/src/transforms/babel/env.js:12:25)
at async getBabelConfig (/Users/anonymous.coward/Downloads/phaser3-multiplayer-game-example-master 2/node_modules/parcel/src/transforms/babel/config.js:32:19)
at async babelTransform (/Users/anonymous.coward/Downloads/phaser3-multiplayer-game-example-master 2/node_modules/parcel/src/transforms/babel/transform.js:6:16)
at async JSAsset.pretransform (/Users/anonymous.coward/Downloads/phaser3-multiplayer-game-example-master 2/node_modules/parcel/src/assets/JSAsset.js:83:5)
Very nice work! Development works soo good!
can you provide steps for publish?(ex heroku)
i have changed ports, but doesnt work
https://onlinegamee1.herokuapp.com
example repo: https://github.com/thebylito/multiplayer-game-js
I think this is a better starting point than the web socket demo, but that demo is a better comprehensive test, better suited to help developers to see side by side the difference WebRTC makes for games.
Here's what I like about both repos (hopefully you can combine the best of both worlds):
Pros for this repo (https://github.com/geckosio/phaser3-multiplayer-game-example):
Pros for other repo (https://github.com/yandeu/phaser3-multiplayer-with-physics):
Please consider porting the physics demo into this repo and retain Parcel + WebRTC, thanks in advance!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.