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
10.85k stars 2.13k forks source link

Def Jam Ad-hoc netplay broken #14553

Open samosaphile opened 3 years ago

samosaphile commented 3 years ago

What happens?

So try getting a match going on socom.cc server port 20k. You either match declined when you send a battle request (even tho my friend accepted multiple times on his end and never declined) or after a few attempts trying, it'll eventually, say "connecting..." Only to lead to the eventual generic connection error occurred.

What should happen?

Should be able play, with no disconnection errors or wierd request declined issues.

What are you using?

What hardware / device and operating system?

Pixel 4a on android 11 (stock pixelOS).

What graphics card (GPU) or mobile phone model?

Adreno 618 / sunfish.

What PPSSPP version (standalone/official), and did it work before?

1.11.3-742, really don't know tbh.

Which game or games?

ULUS10100 ULES00390

Checklist

anr2me commented 3 years ago

This has been known for quite a while as it was reported by @MojoJojoDojo at PPSSPP forum long ago, finally someone submitted the ticket at github :D I've tried to fix it may times without 100% success rate.

As i remembered the issue was because this game have a part of the net code that only waited incoming data for a short time but another thread (which have an interval of 1sec) was taking control for 500ms while the netcode was waiting for data, and after returning control back to the netcode thread it was already hit the in-game timeout with a few milliseconds difference.

As i remembered, i did a small workaround on my old testbuild (available on my forum's signature) by adding 10ms delay somewhere to avoid bumping that thread that takes 500ms to finish during critical time, and it seems to have better chance for a player to join successfully, although not 100%. It's been quite awhile since i updated that testbuild so i barely remembered what was tested on it https://forums.ppsspp.org/showthread.php?tid=26826&pid=140519#pid140519

So basically the main issue seems to be timing issue (since we don't have an accurate sceNet timings) that causes this game netcode's thread to bumped into another thread (which is taking too much CPU time) that's not supposed to happen. So if someone somehow managed to benchmark sceNet syscalls in the future to get a slightly accurate timing, this game will probably automatically fixed.

ghost commented 3 years ago

This has been known for quite a while as it was reported by @MojoJojoDojo at PPSSPP forum long ago, finally someone submitted the ticket at github :D I've tried to fix it may times without 100% success rate.

As i remembered the issue was because this game have a part of the net code that only waited incoming data for a short time but another thread (which have an interval of 1sec) was taking control for 500ms while the netcode was waiting for data, and after returning control back to the netcode thread it was already hit the in-game timeout with a few milliseconds difference.

As i remembered, i did a small workaround on my old testbuild (available on my forum's signature) by adding 10ms delay somewhere to avoid bumping that thread that takes 500ms to finish during critical time, and it seems to have better chance for a player to join successfully, although not 100%. It's been quite awhile since i updated that testbuild so i barely remembered what was tested on it https://forums.ppsspp.org/showthread.php?tid=26826&pid=140519#pid140519

So basically the main issue seems to be timing issue (since we don't have an accurate sceNet timings) that causes this game netcode's thread to bumped into another thread (which is taking too much CPU time) that's not supposed to happen. So if someone somehow managed to benchmark sceNet syscalls in the future to get a slightly accurate timing, this game will probably automatically fixed.

lol I thought it was enough that it got sorta fixed in the test builds and didnt open an issue. Btw it only worked in your infra build which is windows only The guy uses Android so it wouldnt work. Unless something happened since and now the fix is on Android or something. @ANR2ME should I open a report on Driver 76 or that got fixed? BTW that game does not use lan infrastructure like previously thought its just regular adhoc (Driver 76). It does use middleware from Quazal and it makes that "infra-like" I guess.

anr2me commented 3 years ago

LOL Def Jam doesn't seems to work anymore with the latest infra testbuild when i tested it this morning, but i was using default setting, i haven't tried changing the I/O setting to see if it's affected or not. And based on my old post here, someone did said Def Jam worked Android vs Android but not sure which version they're using ( don't even remember where i read it from, may be youtube's comment...) https://forums.ppsspp.org/showthread.php?tid=26826&pid=140500#pid140500

Nope, Driver 76 uses infrastructure for LAN multiplayer, but it also tried to initialize Adhoc, probably only used for grouping. Currently with infra testbuild, it can see the game room but unable to join, when i tried to join the room the client never send or do anything so the host never knew someone is trying to join.

You can submit the issue for Driver 76 if it's not already exist.

ghost commented 3 years ago

Gonna do it then. There is a video of Def Jam working here btw : https://www.youtube.com/watch?v=FCLykm3xa8A My guess is that they used the CPU clock speed option on System to modify the clocks on one or either of the PPSSPP instances and maybe it made it work or something. Also they most likely using the stable 1.11.3 build.

MajinDipu commented 3 years ago

Here's a better tutorial video of how to play in Spanish--> https://youtu.be/hYKzAygKVHA

He changed the CPU clock speed to 222 and used WLAN channel number 6. I don’t know if those have anything to do with it but still. Version number can also be seen in the video.

Somone with 2 android needs to test it. I can't since I only have one lol

MajinDipu commented 3 years ago

Hey! This guy in the comment provided 2 interesting extra settings. Screenshot_20210623_152503_com google android youtube He said turning off auto save helps preventing connection issue. I am not sure about the Vulkan one. I think that's only for better graphics.

anr2me commented 3 years ago

Hmm.. interesting... may be that thread that's taking 500ms time was related to auto save..

ghost commented 3 years ago

I can confrim that disabling auto save makes it work lol. What a tiny little detail lmao. I guess its not really a fix tho because its supposed to work with auto save too. All the other PPSSPP settings stayed the same so CPU clock stayed on auto.

EDIT: tried again and it didnt work... Yeah I give up on this game lol. It does seem like you got more chance to get it to work on the infra build though (the latest one worked for me on localhost). Either that or getting one instance slower then the other by using fast forward or the CPU clock seting.

samosaphile commented 3 years ago

I'm thinking about closing this issue. I got it to work recently with someone on pc. It is extremely buggy tho. We had to keep trying several times and kept getting declined / disconnect / lost connection. Eventually, it did work tho.

So yeah, works just extremely buggy..

P.S. the guy I was playing with didn't have the best connection. So the lag was unreal. It was like 5 FPS in game. Think this game is sensitive to having a good connection.