simondevyoutube / Quick_3D_MMORPG

Absolutely 100% unsupported, and full of infuriating bugs.
MIT License
443 stars 172 forks source link

I'm in! #2

Open Addyvan opened 3 years ago

Addyvan commented 3 years ago

If you are like me, it's nice to dig around and follow along when source code is provided. There were a couple hurdles getting running on this one so I figured I'd share.

Server side

This is using a newer-ish version node.js 's import syntax so you will need to use nvm to swap over to somewhere around 15.8.0 using nvm. You can install nvm using:

wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash

Once installed:

nvm install 15.8.0

Simon seems to have removed server/package.json. I was able to fill in the blanks and this worked fine for me:

{
  "name": "server",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "gl-matrix": "^3.3.0",
    "socket.io": "^3.1.1"
  },
  "scripts": {
    "start": "node index.mjs"
  }
}

Once you have that set done you can run the following to start the server:

npm install
node index.mjs

Leave this running in a separate terminal.

Client side

Install http-server

sudo npm install -g http-server

Then run a simple http-server to serve up the files. If you don't do this you will get CORS issues.

$ http-server
Starting up http-server, serving ./
Available on:
  http://127.0.0.1:8081
  http://192.168.1.129:8081
  http://10.0.7.10:8081
  http://192.168.96.1:8081
Hit CTRL-C to stop the server

I was able to see the login screen, walk around and kill some monsters named after my username lol.

Addyvan commented 3 years ago

simondev-min

Unusualiscool commented 3 years ago

I'm stuck on installing nvm, its saying wget is not a recognized command, any help?

simondevyoutube commented 3 years ago

This is amazing work, thank you so much for supplying these instructions!

Addyvan commented 3 years ago

I'm stuck on installing nvm, its saying wget is not a recognized command, any help?

@Unusualiscool Are you on linux?

If you are on windows you can just make sure you are running the latest node version (15.*) and skip those steps altogether.

Unusualiscool commented 3 years ago

now I'm stuck on installing the server, I type in "npm install node index.mjs" it says this error: npm ERR! code E404 npm ERR! 404 Not Found - GET https://registry.npmjs.org/index.mjs - Not found npm ERR! 404 npm ERR! 404 'index.mjs@*' is not in the npm registry. npm ERR! 404 You should bug the author to publish it (or use the name yourself!) npm ERR! 404 npm ERR! 404 Note that you can also install from a npm ERR! 404 tarball, folder, http url, or git url.

any help? I'm doing this on a windows computer.

Unusualiscool commented 3 years ago

ok Its not detecting the package.json

Unusualiscool commented 3 years ago

I'm stuck on installing nvm, its saying wget is not a recognized command, any help?

@Unusualiscool Are you on linux?

If you are on windows you can just make sure you are running the latest node version (15.*) and skip those steps altogether.

now it's giving me this error, "websocket.js:87 WebSocket connection to 'ws://localhost:3000/socket.io/?EIO=4&transport=websocket' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED" I found this by doing inspect element when on a locally hosted server

ITAndy23 commented 3 years ago

@Unusualiscool What did you do to get the websocket error? After you built the package.json inside the server folder per @Addyvan instructions, you should run npm install via command prompt while in the server directory. That should install what you need. Then run npm start while in that directory. Leave that running. In a new command prompt window, change directory over to the client folder and run: npm install -g http-server Then run http-server The window will tell you the url and port you can hit from your browser. For me it was, http://127.0.0.1:8080/

UnusualGitHub commented 3 years ago

@Unusualiscool What did you do to get the websocket error? After you built the package.json inside the server folder per @Addyvan instructions, you should run npm install via command prompt while in the server directory. That should install what you need. Then run npm start while in that directory. Leave that running. In a new command prompt window, change directory over to the client folder and run: npm install -g http-server Then run http-server The window will tell you the url and port you can hit from your browser. For me it was, http://127.0.0.1:8080/ @ITAndy23 I tried npm start and it's giving me a error, this is the error: ERR_UNSUPPORTED_ESM_URL_SCHEME

Kadajett commented 3 years ago

I'm stuck on installing nvm, its saying wget is not a recognized command, any help?

try curl instead? Or install wget.

UnusualGitHub commented 3 years ago

@Kadajett I fixed that, I just need help on the npm start part, it's saying: "ERR_UNSUPPORTED_ESM_URL_SCHEME"

Kadajett commented 3 years ago

@Kadajett I fixed that, I just need help on the npm start part, it's saying: "ERR_UNSUPPORTED_ESM_URL_SCHEME"

I am dead tired, but I am going to submit a draft PR tonight solidifying the base of the application. If you could keep an eye out, some extra thought would be great. I didn't ask permission from simondev before starting the rewrite. Sorry 🙏

Kadajett commented 3 years ago

I have a PR up now. It's gonna take a bit to get it all working though. Anyone else familiar with TS, you are more than welcome to start tackling some of the errors as well. 😄

ettoreleandrotognoli commented 3 years ago

Thanks @Addyvan, your server/package.json really helped. I'm playing with docker-swarm at home, and I hosted the application Feel free to play https://mmorpg-client.etto.cloudns.cl/

thush commented 3 years ago

This is amazing work, thank you so much for supplying these instructions!

Yes...Amazing that we can find good documentation ,to support a projects.. Kudos and keep it up for the steps given..

thush commented 3 years ago

Thanks @Addyvan, your server/package.json really helped. I'm playing with docker-swarm at home, and I hosted the application Feel free to play https://mmorpg-client.etto.cloudns.cl/

thnks.. Good find this link..

makc commented 3 years ago

https://mmorpg-client.etto.cloudns.cl/ seems to be dead

ettoreleandrotognoli commented 3 years ago

https://mmorpg-client.etto.cloudns.cl/ seems to be dead

sorry @makc, it is back now

makc commented 3 years ago

@ettoreleandrotognoli thanks for trying but there are now a bunch of loading errors: Screen Shot 2021-05-11 at 13 29 36

ettoreleandrotognoli commented 3 years ago

I'm getting a similar error, but after accepting the exception it runs normally. screenshot21

ettoreleandrotognoli commented 3 years ago

Screenshot at 2021-05-11 14-02-53

phamvietdung commented 2 years ago

@Addyvan you're savior