-
Notifications
You must be signed in to change notification settings - Fork 52
Update 9.netplay.md #68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,46 +1,108 @@ | ||
| # Netplay | ||
| # EmulatorJS Netplay Server Setup Guide | ||
|
|
||
| The old version of netplay that works versions prior to 4.0 (version 3.0) is really buggy and not recommended unless you need to. | ||
| Step-by-step instructions to set up your own EmulatorJS netplay server. | ||
|
|
||
| ::alert{type="danger"} | ||
| ::list{type="danger"} | ||
| - Netplay is currently **not supported**. Any bugs will not be fixed. A netplay re-write is being worked on. | ||
| :: | ||
| :: | ||
| ## Prerequisites | ||
|
|
||
| ## To add to your site | ||
| Before beginning ensure you have a netplay server to use or host your own. | ||
|
|
||
| 1. Set a game id in the javascript config | ||
| ```js | ||
| EJS_gameID = 1; //Id needs to be unique per game in your website! | ||
| ``` | ||
| ## Server Setup | ||
|
|
||
| The EmulatorJS Netplay server is maintained in a separate repository. | ||
| Go clone the repository and follow its instructions: | ||
|
|
||
| 2. At the moment, netplay requires the old cores. To do this you must add this line to your code. | ||
| ```js | ||
| EJS_oldCores = true; | ||
| ```bash | ||
| git clone https://github.com/EmulatorJS/EmulatorJS-Netplay.git | ||
| cd EmulatorJS-Netplay | ||
| ``` | ||
|
|
||
| **These 2 steps will add netplay to your website!** | ||
| > Follow the README in the repository for installation and running instructions. | ||
|
|
||
| --- | ||
|
|
||
| ## To host your own server: | ||
| ## Website Integration | ||
|
|
||
| 1. Clone the EmulatorJS-netplay repository | ||
| ```sh | ||
| git clone https://github.com/EmulatorJS/EmulatorJS-netplay-old.git | ||
| In your JavaScript configuration file: | ||
|
|
||
| 1. **Set a Unique Game ID** | ||
|
|
||
| ```javascript | ||
| EJS_gameID = 1; // Must be unique per game on your website | ||
| ``` | ||
|
|
||
| 2. Install nodejs dependencies | ||
| ```sh | ||
| npm install | ||
| 2. **Configure Server Settings** | ||
|
|
||
| > Add or remove ICE servers as needed for your specific requirements. | ||
| > These are just examples of free, open-source servers. | ||
|
|
||
| ```javascript | ||
| EJS_netplayServer: 'https://yourIP:port#', | ||
| EJS_netplayICEServers: [ | ||
| { urls: 'stun:stun.l.google.com:19302' }, | ||
| { urls: 'stun:stun1.l.google.com:19302' }, | ||
| { urls: 'stun:stun2.l.google.com:19302' }, | ||
| { urls: 'stun:stun.nextcloud.com:3478' }, | ||
| { urls: 'turn:openrelay.metered.ca:80', username: 'openrelayproject', credential: 'openrelayproject' }, | ||
| { urls: 'turn:openrelay.metered.ca:443', username: 'openrelayproject', credential: 'openrelayproject' } | ||
| ] | ||
| ``` | ||
|
|
||
| 3. start the server | ||
| ```sh | ||
| npm run start | ||
| > You can visit https://developer.mozilla.org/en-US/docs/Web/API/WebRTC_API/Protocols for more information on what these servers are used for. | ||
|
|
||
| --- | ||
|
|
||
| ## Sharing Your Server | ||
|
|
||
| To allow friends to connect to your server over the internet, you need to configure your firewall and router. | ||
|
|
||
| ### Firewall Configuration | ||
|
|
||
| #### Windows | ||
| 1. Search for **"Windows Defender Firewall with Advanced Security"** | ||
| 2. Navigate to **"Inbound Rules"** | ||
| 3. Click **"New Rule..."** | ||
| 4. Select **"Port"** and follow prompts to allow TCP traffic for the port used by your server (default **3000**) | ||
|
|
||
| #### Linux (using ufw) | ||
|
|
||
| ```bash | ||
| sudo ufw allow 3000/tcp | ||
| ``` | ||
|
|
||
| You can then set your netplay server with the `EJS_netplayUrl` setting. | ||
| ```js | ||
| EJS_netplayUrl = "URL HERE"; | ||
| ### Port Forwarding | ||
|
|
||
| 1. **Find Your Local IP Address** | ||
| - **Windows:** Run `ipconfig` in Command Prompt, look for "IPv4 Address" | ||
| - **Linux:** Run `hostname -I` in terminal | ||
|
|
||
| 2. **Access Router Admin Panel** | ||
| - Open web browser and navigate to your router admin page | ||
|
|
||
| 3. **Configure Port Forwarding** | ||
| - Create a rule with these settings: | ||
| - **Application Name:** Netplay Server | ||
| - **External/Start Port:** 3000 | ||
| - **Internal/End Port:** 3000 | ||
| - **Protocol:** TCP | ||
| - **Device IP:** Your computer's local IP address | ||
|
|
||
| ### Share Connection Details | ||
|
|
||
| 1. **Find Your Public IP** | ||
| - Google search: "what is my IP" | ||
| - Copy the displayed IP address | ||
|
|
||
| 2. **Give the Connection Details to Friends** | ||
| - Format: `[Your Public IP]:3000` | ||
| - Example: `123.45.67.89:3000` | ||
|
|
||
| --- | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| - Ensure Node.js is installed | ||
| - Verify firewall rules are correctly configured | ||
| - Check that port forwarding is set up on your router | ||
| - Confirm your public IP address is current | ||
| - Make sure the server is running before attempting connections | ||
| ``` | ||
| <!-- EJS_netplayServer --> | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.