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.05k stars 2.15k forks source link

Dragon Ball Z Tenkaichi Tag Team disconnects during wireless battle #14361

Open MajinDipu opened 3 years ago

MajinDipu commented 3 years ago

This thing right here. It’s been around here since dawn of civilization. Screenshot_20210407_160819_org ppsspp ppsspp

I think anybody who tried to do multiplayer in DBZ TTT knows about this problem. During ad-hoc battles the game will display "Connection Lost" message and it will disconnect you from the match. It happens all the time. Can't even play this game peacefully with my friends. The whole match is supposed to be played without any interruptions but this happens. Doesn’t matter which device or hardware I use this is guranteed to happen. I twicked all the settings but it just won’t go away! Fast memory enabled or disabled it will happen.

Please fix this!

ghost commented 3 years ago

The game is like that its really sensitive to the distance and connection. If you will try to play the game over Xlink Kai online you would also get disconnections even from the Ad-hoc menu lol. The netcode is just not meant to be played online etc but if its locally over wifi then I dont know. It does seem like the game worked better in the past though: https://www.youtube.com/watch?v=shTrcz-EVI8

I wonder how they messed this game up because compared to Shin Budokai 2 that game got like a god hood netcode lol for a fighting game on PSP.

MajinDipu commented 3 years ago

I was talking about local multiplayer tho. Don't know why it’s an issue in local multiplayer. Any solution? (Yes, for local multiplayer. I am not crazy enough to try it online lol)

MajinDipu commented 3 years ago

It does seem like the game worked better in the past though: https://www.youtube.com/watch?v=shTrcz-EVI8

I wonder how they messed this game up

What version those guys were using? It was clearly ok back then

anr2me commented 3 years ago

Are you playing this between PC vs Android? if it is, it might be the same disconnection issue with Dissidia 012 when using some ability/skill and being played on 2 different architecture, there might be some inconsistencies on the data being sent (ie. floating point precision on a specific value) I think GvG Next Plus also suffer from similar issue when being hit by a certain type of attack, but if that attack didn't hit you it won't cause a disconnection.

Other than that, another possibility is that the game might be measuring their own timing to checked for timeouts and bumped into a weird timeout comparison (ie. a negative signed value being treated as unsigned) which could happened when the time goes backward for some unknown reason.

MajinDipu commented 3 years ago

Are you playing this between PC vs Android?

Right now yes, I am testing with PC vs Android bcz I only have one mobile. But in android vs android situation it also happens. I think disconnect happens less often in android vs android.

MajinDipu commented 3 years ago

So umm... no solution, eh?

ghost commented 3 years ago

Maybe try to disable the JIT or the VFPU option in the JIT. You can do it in Tools -> Developer tools Or something. Both sides need to disable it though.

anr2me commented 3 years ago

So umm... no solution, eh?

Unlike crashes that can be easily caught where the issue was using debugger (as long they can be reproduced), disconnection in the middle of gameplay is hard to detects, since we don't have any clue which commit affecting it, and debugging on Android is a pain since the logcat often goes EOL and stopped printing anything. And the video didn't even mentioned which version was being used and whether all players are using the same platform or multiple platforms.

So it will probably takes a long time until we can findout what exactly happened.

Most games only do regular Send/Recv during gameplay, and calculate timeout using currentTime - lastRecv > timeout, and we know that Send & Recv already working properly, while there is still an issue where time can goes backward, one of my solution to prevent disconnection was by faking the lastRecv timestamp to currentTime - 10ms so it shouldn't have much issue on the timeout, since most games is trying to sync data on every frame (ie. 16ms on 60 FPS games) As i remembered Vantage Master Portable was one of the game that significantly affected by this fake lastRecv (it's one of the game that treats timeout comparison as unsigned value), without faking it the game will get disconnected after a few minutes without doing anything on multiple instance, while with faked time i can leave the game and do nothing for 30 minutes (probably more but didn't bothered to wait any longer) without getting disconnected.

I can try adding notification message on screen when detecting time that goes backward, so that we can at least findout if the disconnection occurred right after this notification or not.

ghost commented 3 years ago

So umm... no solution, eh?

Unlike crashes that can be easily caught where the issue was using debugger (as long they can be reproduced), disconnection in the middle of gameplay is hard to detects, since we don't have any clue which commit affecting it, and debugging on Android is a pain since the logcat often goes EOL and stopped printing anything. And the video didn't even mentioned which version was being used and whether all players are using the same platform or multiple platforms.

So it will probably takes a long time until we can findout what exactly happened.

I remember that the game disconnected before and you somehow fixed it on some commit but I dont remember which. Maybe it got regressed. Best to use 1.10.3 or earlier because I think it worked better there then for now.

MajinDipu commented 3 years ago

I can try adding notification message on screen when detecting time that goes backward, so that we can at least findout if the disconnection occurred right after this notification or not.

OK I did not understand for the most parts but it was helpful. And that adding notification message thing might be a beginning step to fix this?

MajinDipu commented 3 years ago

Maybe try to disable the JIT or the VFPU option in the JIT. You can do it in Tools -> Developer tools Or something.

Too lazy to try this right now but I will test it later :)

ghost commented 3 years ago

I think that disabling the VFPU or JIT helped me with getting Dissidia 012 to not disconnect... But it makes the game very slow on some android devices.

anr2me commented 3 years ago

I wondered if the android build was compiled with precise precision like we had on Visual Studio (/fp:precise) or not...

MajinDipu commented 3 years ago

I think that disabling the VFPU or JIT helped me with getting Dissidia 012 to not disconnect... But it makes the game very slow on some android devices.

OK can you tell me which option are you talking about specifically? There is JIT Debug tools in Tools> Developer Tools> JIT Tools And inside there are many other options. Inside JIT Tools everything is disabled including 6 different VFPU options.

Should I change CPU Core? It's set to Dynarec (JIT)

unknownbrackets commented 3 years ago

Hm. Is it relying on both sides calculating floats to exactly the same bits?

-[Unknown]

anr2me commented 3 years ago

Not sure, but there is a possibility for the game to treat specific floating point value as a different value (ie. rounding/normalizing denormalized numbers) due to some issue, which might happen if the game was ported from a different platform.

anr2me commented 3 years ago

Btw, we're using -mfpu=neon on ARMv7 right? It seems Neon is not IEEE754 compliant, according to this https://wiki.debian.org/ArmHardFloatPort/VfpComparison

unknownbrackets commented 3 years ago

We might also be doing fused calculations in some places, among other things. We are not bit exact to PSP results in multiple ways, and platforms are not always identical to each other either. I guess this may be a problem for networking...

Between PSP and PPSSPP though, you just have to look at i.e. #2990 to see differences in opinions on floating point calculation. Much of the PSP VFPU was not IEEE754 compliant either.

-[Unknown]

hrydgard commented 3 years ago

NEON on ArmV7 is indeed not IEEE754 compliant, fortunately ARM64's NEON "ASIMD" is compliant.

As Unknown says, there can still be minor differences, the spec doesn't do a good job of defining signs of NaNs and stuff like that. It's a very difficult problem to solve.

MajinDipu commented 3 years ago

Hey guys, I have a info to share with you. Using IR Interpreter the game had a stable connection. Meaning disconnection happened rarely. But the con here is the game becomes super laggy with IR Interpreter. Dynarec JIT gives better speed but in multiplayer it gets disconnected almost immediately.

So my stupid theory is that The laggier the game gets the more stable the connection becomes. Although that's not a solution since laggy gameplay is the worst gameplay

anr2me commented 3 years ago

Does it disconnects when both of you not doing anything (ie. not fighting)? because most of the issue i suspects to be related to VFPU were happened when someone get hit with a certain attack, if that attack missed it won't cause disconnection.

If it disconnects by just idling, both device (PC and Android) might not be running at the same pace, causing the slower one to be flooded by packets from the faster one, thus the receive buffer gets full and new packets gets dropped since the slower one can't process the data fast enough, and because of this dropped packets it will eventually desync.

PS: And i don't think frame skipping will be helpful in this case, but switching who host and who join might help.

MajinDipu commented 3 years ago

OK I haven’t tested with idling but surely will. The thing is both device runs at virtually same speed. But I guess not running at same speed technically

ghost commented 3 years ago

On the video I shared before you could see the players overclock the emulated CPU to high levels before they play it. So messing with the emulated CPU option in System can also help I guess.

MajinDipu commented 3 years ago

Update: Doing nothing in the match or simply idling doesn’t make the game disconnect. I did nothing for like 500 seconds and the game was fine. Then decided to fight a little and it got disconnected after minute.

MajinDipu commented 3 years ago

On the video I shared before you could see the players overclock the emulated CPU to high levels before they play it. So messing with the emulated CPU option in System can also help I guess.

Thanks for the head up Mojo. I will check that out again

MajinDipu commented 3 years ago

So I tried with emulated clock speed to 1000 MHz and I think it helped to prevent us from getting disconnected big time. Needs more testing by other people on other devices. Also I changed the I/O timing method to "Fast" from "Host".

Only time it disconnected when something weird happened right before connection lost. My player Vegeta was charging up away from enemy Goku in my screen but on the other screen Vegeta was standing right in front of Goku. I hit one attack button and " Connection lost" massage showed up. What happened was Goku knocked me away and I tried to rush to him immediately pressing Up+O. I missed the timing on my android device but for some reason I was succesfully rush charged into Goku on PC.

Anyway I hope this info will be useful. But I still believe making the emulated CPU clock speed to 1000 MHz and I/O timing method to "Fast" actually helped a lot. But as I mentioned before this theory needs more testing by other people. Also wish there was some way to increase clock speed over 1000 MHz as 1000 is the max range.

anr2me commented 3 years ago

I think it's normal to get weird behavior when forcing the CPU to a certain clock, it could also causing the FPS to dropped on some games due to the extra burden from overclocking.

Did you overclock both side? have you tried overclocking only one side?

Btw, if both side showing different things on the screen and followed by disconnection, the game might be desynced, it may happen when packets being dropped/lost too many times.

MajinDipu commented 3 years ago

Did you overclock both side? have you tried overclocking only one side?

Overclocked both sides. Maybe I will try overclocking one side only. Also how do you think it would affect the connection if we could increase the CPU clock speed over 1000 MHz (2000 MHz for example)?? Is it possible that the "Connection lost" error message will become an extremely rare occurrence if not gone forever by doing so?

unknownbrackets commented 3 years ago

Are you using "Force real clock sync" (I'd recommend having it on for networking)? I would recommend "Host" io timing as well for network play, and try to avoid frameskip if possible. The force 60 FPS setting might be good too.

-[Unknown]

MajinDipu commented 3 years ago

I tried with both Force Real Clock on and off and results were almost the same. And frameskip is also on. What a weird problem

MajinDipu commented 3 years ago

Also this kind of problem was in GvG too right? Is it fixed in GvG? If yes then how?

anr2me commented 3 years ago

I don't think the issue where you get disconnected when getting hit by a certain attack while doing multiplayer Android vs PC ever got fixed on GvG.

It was an old bug, i think it was first reported on forum, but between JPCSP vs PPSSPP https://forums.ppsspp.org/showthread.php?tid=12357&pid=99304#pid99304

I've noticed that the error (2:45) happens only after someone receives an attack, specially the triangle button attacks (or a couple of seconds after). If the attacks don't hit, the error won't show up.

As the battle gets more and more chaotic the error will pop up, if any AI is present the error will happen a lot more faster (5 to 30 seconds).

Of course, this error only happens when using JPCSP as host and PPSSPP as player. JPCSP to JPCSP is perfectly fine.

But later also happened on PPSSPP Android vs PC as i remembered.

It happened on JPCSP vs JPCSP too when playing betwwen old and new version (suspected to be related to VROT/VCOS) https://forums.ppsspp.org/showthread.php?tid=12357&pid=106915#pid106915

this error will happens when using jpcsp-rbd345a4 with jpcsp-r3ad1872(or older)

as gid15(author of JPCSP) say: That can happen if the game is exchanging values computed using VROT or VCOS through the network: both sides have to use the exact same algorithm. I guess when playing against jpcsp with ppsspp, ppsspp need fixed VROT or VCOS.

MajinDipu commented 3 years ago

oopsie

ghost commented 3 years ago

I noticed there is a theme with games that got this issue I think they are called "Arena Fightiing/Brawler Fighting" games. Games like: Dissidia 012 , DBZ Tag Team and the mentioned GvG get disconnected by attacking. There is a Marvel game and a WWE that also fits this criteria but does not have the same error , instead it just desyncs but does not disconnect so you see the other players doing other stuff on the other screen lol. (There are some small exceptions like KH BBS though). I think that "Force real clock sync" helps with getting less desyncs but I am not sure.

MajinDipu commented 3 years ago

Funny enough a lot of people actually don’t get this error playing online. Beacuse in online the gameplay lags. I think lag actually prevents connection lost.

anr2me commented 3 years ago

Funny enough a lot of people actually don’t get this error playing online. Beacuse in online the gameplay lags. I think lag actually prevents connection lost.

May be they happened to use the same platform, all windows or all android

ghost commented 3 years ago

Funny enough a lot of people actually don’t get this error playing online. Beacuse in online the gameplay lags. I think lag actually prevents connection lost.

online its so super laggy its not even worth playing lol.

MajinDipu commented 3 years ago

Funny enough a lot of people actually don’t get this error playing online. Beacuse in online the gameplay lags. I think lag actually prevents connection lost.

May be they happened to use the same platform, all windows or all android

Using same platform helps not getting disconnected?

anr2me commented 3 years ago

Funny enough a lot of people actually don’t get this error playing online. Beacuse in online the gameplay lags. I think lag actually prevents connection lost.

May be they happened to use the same platform, all windows or all android

Using same platform helps not getting disconnected?

Yes, if the issue is related to VFPU.

anr2me commented 3 years ago

@MajinDipu i've been trying to reproduce this without success, playing Android vs Windows PC. I tested this on Free battle mode (no custom characters), 1vs1 (disabling 3rd & 4th CPU player) Goku vs Vegeta, i choose the first map, but i only use the rectangle and triangle button to attack. Btw, i restore PPSSPP settings to default, and didn't overclock my CPU (auto), i also tested with by both answering Yes and No when it asked me for compatibility with PSP-1000, but i didn't test using different answer on each player tho, since it doesn't make sense, so both players choose the same answer.

Although it was a bit strange that restoring PPSSPP setting on Android defaulted to PSP-1000 while on Windows it's defaulted to PSP-2000/3000, causing unable to see the game room, and i'm using PSP-2000/3000 for this test.

PS: My android phone have a ARMv8 CPU with 2.3Ghz, so it doesn't struggle running this game full speed without frameskipping, if your phone couldn't get a stable 30 FPS during gameplay, it might cause stability issue.

MajinDipu commented 3 years ago

No my phone can easily run it at 30 FPS and at full speed. Did you ever try it Android vs Android tho? I can test it same PC with 2 PPSSPP window using localhost but I only have one phone. I just want to know if the problem occurs between 2 phones that can run it at full speed

MajinDipu commented 3 years ago

@MajinDipu i've been trying to reproduce this without success, playing Android vs Windows PC.

OK English is not my first language. 😅 Did you mean you tried to recreate the problem and it didn’t disconnect for you? Or did you mean you couldn’t success on finding a solution and it always got disconnected for you?

anr2me commented 3 years ago

It never disconnect on my test.

This is what i did, please try this too: 1). Restore PPSSPP settings to default on both Android and Windows PC. 2). Make sure PSP Model is PSP-2000/3000 (apparently on Android the default is PSP-1000) 3). Enable WLAN, Enable built-in Adhoc Server, and setup your pro Adhoc Server IP address 4). Set Port Offset to 5000 5). Don't change anything else, and play the game.

In-game: 1). Select Multiplayer, and answer "No" when asked about compatibility with PSP-1000 2). Player1 Create Free battle mode, No custom characters 3). Player2 Join the room, and choose Team B 4). Disable (X) Player3 & Player4 CPU 5). Select Goku and Vegeta 6). Select the first Map, and start the game 7). Attack each other, it never disconnects in the middle of battle on my test.

MajinDipu commented 3 years ago

Hmm, OK. So I keep android to PSP-1000?

anr2me commented 3 years ago

Hmm, OK. So I keep android to PSP-1000?

No, use PSP-2000/3000 on both of them.

MajinDipu commented 3 years ago

Alright I will do it

anr2me commented 3 years ago

Btw, please use the latest version at https://buildbot.orphis.net/ppsspp/ for testing this.

MajinDipu commented 3 years ago

I am using one of the latest version of the orphis builds not exactly the build that was released an hour ago tho.

Anyway I tested multiplayer 2 windows on one PC and there was absolutely no issue at all. Then I did 1v1 Android vs PC and it was fine. We also had an intense shot exchange the game lagged a bit but it was fine. Then I did 2v1 (2 Human vs CPU) and connection lost occured. I also played 2v1 in PC vs PC but it was clearly fine. I need to test more 1v1 in Android vs PC. (I switched to OpenGL on android from Vulkan. Kinda feel like it helped connection lost happening later than earlier.)

MajinDipu commented 3 years ago

Now, did you test android vs android? I need to find my rich friend and 1v1 with his high end mobile. If it doesn't disconnect then I will be sure the problem is happening in Android vs PC for me. And if it still disconnects I will have to find 2 high end mobile and test. And if I see that the problem stopped occurring between high end phones then I gotta say, maybe my phone gameplay secretly slows down during multiplayer hence all this connection lost.

anr2me commented 3 years ago

I am using one of the latest version of the orphis builds not exactly the build that was released an hour ago tho.

Anyway I tested multiplayer 2 windows on one PC and there was absolutely no issue at all. Then I did 1v1 Android vs PC and it was fine. We also had an intense shot exchange the game lagged a bit but it was fine. Then I did 2v1 (2 Human vs CPU) and connection lost occured. I also played 2v1 in PC vs PC but it was clearly fine. I need to test more 1v1 in Android vs PC. (I switched to OpenGL on android from Vulkan. Kinda feel like it helped connection lost happening later than earlier.)

From this statement, it seems it only disconnects when there are CPU players. Is this CPU Player using a different character other than Goku/Vegeta? Might be the disconnection only happened with a certain character.

And, no i don't have 2 phone to test with.