libretro / libretro/RetroArch

(Netplay) Automatic Correct Network Setup Detection

Open
#10,192 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

netplay
Dominant language
C
Stars
14.1k
Forks
2.2k
Avg merge
7h 35m
Merged PRs (30d)
51

Description

I have been playing using Netplay for a bit with random rooms. There seem to be a lot of people that enjoy Netplay and tend to create public rooms for others to join. One issue that I have found to be a problem is that a lot of people that create public rooms are many times unaware that their NAT setup is incorrect. The session seems to be properly listed online but joining the game does not seem possible.

Fortunately, it would seem pretty trivial to check for correct NAT (at least preliminarily), perhaps even from the same script on the public URL. I suppose a simple TCP connection on the chosen / advertised port should suffice to determine whether the port is open and connects indeed to the Netplay host? If the script is written in PHP then sockets can be used to check [1] and even if the Netplay protocol switches to UDP then an open port could still be checked (related to #10146 concerning UDP).

I do not see the source code for the public netplay host listing but I might be able to contribute a patch to it that would attempt a connection first before listing it? Perhaps even add a badge like "NAT working" respectively "NAT not working" so others that look up the rooms know whether to join or not.

Perhaps as a minor bug report, somewhat related consequentially: joining some rooms with improperly configured routing ends up in RetroArch stalling, eventually the message "Could not initialize netplay" is shown and then the game proceeds. The time spent in stalling is between 3 to 5 minutes which is enough to be annoying especially since there is nothing the user can do except wait or switch the machine off entirely (exit button does not work). This happens on Lakka, git 9e25601a56 from 24th of January 2020.

[1] PHP TCP connection example: https://www.php.net/manual/ro/sockets.examples.php

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the public Netplay host-listing service and the RetroArch Netplay networking entry points; the issue does not name source files or tests. Reproduce the failed-room behavior on the referenced Lakka build or commit, then define how NAT status and the stalled “Could not initialize netplay” path should be detected and reported.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, php
Domain
networking
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.