nighthawkcoders / game_levels_mp

Engineering game repository
Apache License 2.0
1 stars 13 forks source link

Multiplayer: Installing node.js #21

Open Trystan-Schmits opened 9 months ago

Trystan-Schmits commented 9 months ago

"Node.js is a cross-platform, open-source JavaScript runtime environment that can run on Windows, Linux, Unix, macOS, and more. Node.js runs on the V8 JavaScript engine, and executes JavaScript code outside a web browser. Node.js lets developers use JavaScript to write command line tools and for server-side scripting."

Node.js will need to be installed to run the WebSocketServer on the localhost

to install Node.js we will use nvm.

Steps

  1. open a terminal
  2. in the terminal run curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
  3. open a new terminal
  4. run nvm install node
Trystan-Schmits commented 8 months ago

What we are using node js for:

  1. installing node modules
  2. running a local server, this is so you can play multiplayer on your localhost

Steps

  1. install node js following steps above
  2. in the terminal go to your repository
  3. cd node_backend
  4. run npm install uuid
  5. run npm install socket.io
  6. run node index.js

This runs the server in your localhost so that you can play multiplayer on your own computer. Remember! in Multiplayer.js in platformer2 you need to set the socket to be the local server and not aws