mdoleh / LazerTeamTheGame

Based on the Roosterteeth Productions film. Players can don the Suit of Power and defend the Earth as its champion.
MIT License
0 stars 0 forks source link

Multiplayer Across Network #4

Open mdoleh opened 5 years ago

mdoleh commented 5 years ago
mdoleh commented 2 years ago

Source code for linked examples, uses Express to serve the client page and host the server:

Create-A-Basic-Multiplayer-Game-In-Phaser-3-With-Socket.io-Part-2.zip

mdoleh commented 2 years ago

Was able to get a successful socket connection with a custom URL in the client:

this.socket = io("http://localhost:8081");

Could theoretically have players host their own server and act as host to their own game sessions. Provide them the server host with all the required functionality, they run it locally and provide other players with the IP address to connect.

mdoleh commented 2 years ago

Able to access from the internet with router port forwarding enabled.

Note: only works from outside the internal network using the public IP address. Internal network can just use local IP. Both require port forwarding on router.

https://github.com/mdoleh/simple-socket-io-game

mdoleh commented 2 years ago

Reference for .NET library that can automatically do port forwarding on universal plug and play (UPnP) routers: https://www.fluxbytes.com/csharp/upnp-port-forwarding-the-easy-way/

mdoleh commented 2 years ago

NodeJS modules that can handle NAT UPnP configuration:

Edit: couldn't get the former to work, but the latter appears to work. Have a working example in simple-socket-io-game project.