hrydgard / ppsspp

A PSP emulator for Android, Windows, Mac and Linux, written in C++. Want to contribute? Join us on Discord at https://discord.gg/5NJB6dD or just send pull requests / issues. For discussion use the forums at forums.ppsspp.org.
https://www.ppsspp.org
Other
11.45k stars 2.19k forks source link

The Warriors AdHoc #14113

Closed TemporaryPSP closed 3 years ago

TemporaryPSP commented 3 years ago

1P: Player 1 (network host, not necessarily the game host) 2P: Player 2

What happens?

Prior to PR #13967 build, no matter which player hosts the game, it will never start. Since it's merged with 1.11, it should be fixed but no. If 1P hosts the game, 2P will be disconnected even if 1P hasn't started the game. If 2P hosts the game, 1P won't be disconnected from the lobby, but the game won't start.

What should happen?

The game should start normally, even if 2P hosts it. (tested with PR build with multiple instances/localhost)

PPSSPP version?

Tested with 1.10, 1.10.3-1628-g65af16bcb (PR build), 1.11.

ghost commented 3 years ago

It should work with the PR build at least with multiple instances. If not then I think it's one of the games that are affected by I/O timing or force real clock sync in system options (or fast memory but i doubt that). I made a github wiki page that should help troubleshoot issues here : https://github.com/hrydgard/ppsspp/wiki/How-to-play-multiplayer-games-with-PPSSPP

anr2me commented 3 years ago

Hmm.. i can't reproduce this issue on localhost, it always works on my side, but i'm running both instance from the same PPSSPP folder.

May i know which mission did you choose? i'm testing it on the Quick Rumble -> 1on1 & Battle Royale & Survival & Race

Are you using different folder for each instance? if you are, make sure both PPSSPP exe are excluded from firewall

What Port Offset value are you using? if it's under 1024 you may need to run PPSSPP as admin (i'm using 1500 for this test)

Are you using any cheats?

PS: I'm using the default settings for Fast Memory (enabled), I/O on Thread (enabled), I/O Timing method (Fast), Force real clock sync (disabled)

TemporaryPSP commented 3 years ago

It works with localhost (1.11) but I tried 2 devices and it didn't work. (PC & Mobile)

Both instances are from the same folder, excluded from firewall, 5000 port offset, no cheats, with the same system settings.

anr2me commented 3 years ago

Okay i'm able to reproduce it, when Android is the host it is working fine, but when PC is the host it will loop trying to connect to android but always failed with EAGAIN/EWOULDBLOCK error because it's non-blocking connect and the game will immediately close the socket and try to connect again with new socket, thus the connect attempt never successful as it's too soon to close the socket.

Since the game didn't explicitly using PtpConnect to connect, but expecting PtpOpen to return a connected socket and immediately send data using PtpSend, i'll try to add some delays before returning from PtpOpen to give chance for the internal connect to get connected.

anr2me commented 3 years ago

@TemporaryPSP You can try this test build while waiting for PR https://github.com/hrydgard/ppsspp/pull/14117 to be merged

Android (ARMv7): https://www.dropbox.com/s/b41bm43mtn1gpnn/PPSSPP_1.11-testbuild_ARMv7.apk?dl=0 Win32/x64: https://www.dropbox.com/s/2t3mtdhb0f045cn/PPSSPP_1.11-testbuild_Win32x64.zip?dl=0

TemporaryPSP commented 3 years ago

I've tested mobile to mobile and localhost multiple times, but mobile to PC still doesn't work. Take a look at this video. (Be careful, flickering AVI dump, sorry)

https://user-images.githubusercontent.com/78895214/107971422-08288800-6fe5-11eb-8193-4e9af07ff8d2.mp4

anr2me commented 3 years ago

@TemporaryPSP Could you redownload the test builds, i've updated it yesterday to include the fix for communication issue between Android vs PC due to detecting an incorrect port. (the fix was intended for MGS:PW but other games could have similar issue too)

I've tested those test builds on The Warriors and found no problem playing on LAN Android vs PC using built-in AdhocServer on PC side, tested both Android as host and PC as host all working fine. You are using built-in AdhocServer for your test, right?

Edit: Nevermind, you're testing it on the Story and it did have problem with story. (i didn't know the story have multiplayer support too, i thought it was for single player only)

Looks like AdhocMatching issue, and AdhocMatching issue will probably takes some time to be fixed, since a lot of things need to be changed and each syscall's behavior need to be tested on a homebrew too (currently our AdhocMatching implementation works is a bit different than how pspnet_adhoc_matching.prx works), also all games that use AdhocMatching will need to be retested since the timings will be affected too.

anr2me commented 3 years ago

Looks like multiplayer on the Story also works if you waited a bit longer(about 3-4 seconds) before joining, wait a few seconds after you see the game room before joining, and after joined wait a few seconds before starting the mission.

Based on your video, it seems you're progressing too fast.

TemporaryPSP commented 3 years ago

Apologies for commenting on a closed thread, but just an update because the wait workaround doesn't work. No matter which mode (be it 1 on 1, story or other modes) I can't get mobile and PC to work. I tried waiting for minutes before joining the lobby, the game kicks 2P so fast that the name doesn't get a chance to show up.

I could only get mobile-mobile and localhost to work (interchangeable game hosts too) and it worked flawlessly. Mobile has built-in PRO adhoc server enabled (network host essentially, I tried different network connections too) because I could never get PC to do it.

I know that this issue will take a long time and isn't a priority but again, just an update comment. Maybe there are other workarounds?

anr2me commented 3 years ago

If mobile to mobile and multiple instances worked, it should also work on PC to mobile.

May be PPSSPP on your PC being blocked by firewall? You need to exclude the exe from firewall. And also, don't use "localhost" for Adhoc Server IP other than for multiple instances, otherwise different devices won't be able to communicate properly.

TemporaryPSP commented 3 years ago

It's excluded from firewall, and with the correct Adhoc server IP and everything. The game lobby is visible after all.

anr2me commented 3 years ago

Hmm have you tried both ways, try using the hosting on mobile and hosting on PC, because sometimes there are cases where both side need to run at the same FPS, so if one is slower than the other (ie. my old phone was struggling to get full FPS while my PC always runs at full FPS) the game could get desynced. usually, if the host is the slower one it will be more stable.

TemporaryPSP commented 3 years ago

Both devices run at 30 FPS, I tested with 10 FPS too, it worked and desync rarely happened (it only happened once, I even tested unthrottle and it keeps up pretty well) but this is the menu so FPS is not it.

I can't get PC to host at all (not game host) failed to connect to Adhoc server every time even though the IP is correct. (using the list)

anr2me commented 3 years ago

That's odd if it can't connect to Adhoc server on PC, is the Adhoc Server located on the PC or on mobile ?

If you enable built-in Adhoc Server on your PC, does the PPSSPP on your mobile can connect to that Adhoc Server? or will it shows Failed to connect too?

Could you take a screen shot of the Debug's Log Console from Debug menu when it's showing "Failed to connect to Adhoc server", there should be an Socket error code on it.

Something like this: (this is an example when i turned off built-in Adhoc Server) image

TemporaryPSP commented 3 years ago

As I was trying to reproduce the error, something new happened. Network initialized (this has never happened before) but mobile phone couldn't connect to it (at one point, the game kicked mobile from the network menu instead of getting stuck trying to connect to adhoc server), I tried other devices too, but not a single one could connect. ULUS10213_00010

EDIT: Despite this, PC still gets kicked out of the game lobby created by mobile. There are 3 scenarios that can happen:

  1. PC fails to host and thus, mobile can't join
  2. PC successfully hosts, mobile can't join, but doesn't get kicked for network error
  3. PC successfully hosts, mobile can't join, but gets kicked immediately for network error (and the freeze lasts way longer)
anr2me commented 3 years ago

Well it's hard to tell without logs file. And you haven't tell me whether PPSSPP on mobile can successfully connect to built-in AdhocSever on PC side, at this point you should only see Network initialized or Failed to connect to Adhoc Server, and testing built-in AdhocServer on PC will at least tells me whether something on your PC is blocking incoming connection or not.

I suspect this is what will happen: 1). If built-in Adhoc Server on PC side, everyone will get Failed to connect to Adhoc Server, and nobody can see each other. 2). If built-in Adhoc Server on mobile side, everyone will get Network initialized, you can see game room but will have an issue.

If both case are true, that means something on your PC is blocking incoming connection, so PC can only receive data (ie. game room data) but no body can connect to PC side. This might happen if you have a network security app on your PC, for example i'm using anti-virus with built-in network security called Eset Internet Security, and i need to allow "in/out" "UDP/TCP" for PPSSPP exe, otherwise it will block incoming connection.

And again, i wasn't talking about who host the game room, but who have the built-in Adhoc Server being enabled.

TemporaryPSP commented 3 years ago

I disabled network security and that did the trick. It's working perfectly now, I'm sorry for the inconveniences.

anr2me commented 3 years ago

You don't need to completely disable it since it could pose security risk, you just need to exclude PPSSPP exe from being blocked, or allow incoming/outgoing UDP & TCP.

Sometimes running PPSSPP as Administrator will also do the trick (some network security won't block program with admin privileged)

Nugss commented 2 years ago

Why the multiplayer is laggy on 2player's screen? Even the connection is good but on 1player's screen it runs fine. Is that normal?