I can’t get the discord multiplayer template to work.
The game scene
and console
Can you please share the commands you ran to start the client and service for the template?
Also, in your terminal, are you seeing any errors with Colyseus
starting up?
You should see something similar to this in your terminal if everything started up correctly on the backend:
npm run dev
was the only command I was using until I noticed
then I manually started running the server with npm run start
.
It works now but after seeing your screenshot I don’t that is what I’m supposed to be doing.
Got it. So, running npm run dev
from the root of the project will just start both the client and server packages in the project template. This will run both projects in the same terminal window and you should see logs related to both client and server.
If the server failed for some reason, it should be fine to restart the server by running npm run start
from the packages/server
folder in another terminal window. The main difference between that and the other command would be that the application will not be ran with nodemon
, and so if you make changes you will need to manually stop and restart the server.
In case it helps, here is a screenshot of the output when I run the npm run dev
command from the root of the project template:
The screenshot was helpful.
This is what I got after using npm run dev
.
I changed “dev”: “node dev-command.js”
to “dev”: npm-run-all build start:dev"
in packages/server/package.json
because I couldn’t find “start”: “npm-run-all build start:dev”
being used.
Getting npm run dev
to work correctly
“dev”: “node dev-command.js”
originally did.
That should be fine to run the project that way. All node dev-command.js
did was run the start
script in the package.json with nodemon
.
By running the project that way, any time you make changes to the source code, you will need to manually stop the server and re-run the command so it rebuilds the project.
If you try replacing the dev
script with the following:
"dev": "nodemon --watch src -e ts,ejs --exec npm start",
does the server startup for you?
Thank you that fixed it.