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

So the disconnetion issue is very specific huh? sound weird.

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.)

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.

I don't think it happens due to certain characters. But one thing for sure that it is guaranteed to happen with CPU character. And in 1v1 it’s like a lottery weather it will happen or not. Let's forget the CPUs. Why does it happen in 1v1 is the real question

anr2me commented 3 years ago

If you are only using Goku and Vegeta characters, did it ever disconnects? When you are getting the disconnection, which characters are there in the game (other than Goku/Vegeta)? and which map being selected? also how long is the count down timer being set?

I need to be able to reproduce the issue in order to find out what happened, and need a more detailed step-by-step setup like the test i did that never gets disconnected on my earlier post above.

If you're changing anything else other than what's pointed on the step-by-step test i posted above, the issue might be related to those other changes, and we need to know what changes did you made outside of my step-by-step test guide.

MajinDipu commented 3 years ago

Hmm listen. I am gonna get my buddy and have 10 competitive 1v1 matches. Spamming button alone with 2 device won't give me specific result. Each time we r gonna try different characters and different map with 240 sec countdown. Clock shouldn’t be an issus and I am 100% sure about it. If we get disconnected I am gonna note it down what move was delivered moments before it happened. I would record the matches if I can. If we get disconnected then we will play on that same map with same characters 3 more times again. We will also try to recreate the problem by doing exact same move. I am gonna go all out now! Hopefully I will find something important about this crap.

MajinDipu commented 3 years ago

Also I remember last night when I was doing Vegeta vs Goku everything was ok for a while. Then I hit Goku with a single ki attack (Which is done by pressing simply triangle) and it got disconnected as soon as it made contact. It is to be noted that both men were hitting each other with countless ki attacks before in that match but it was all good.

PS:- No changes were made other than your settings

anr2me commented 3 years ago

Well out of many possible numbers on a floating point, only a few of them (special values) could be inconsistent across different platform, so that hit that cause a disconnection might bumped into such values/numbers, might be happened during collision calculation.

I'll try to create a test build with /fp:fast instead of /fp:precise since it will handle special values differently (ie. if x = NaN, x - x = 0 on /fp:fast, while x - x = NaN on /fp:precise), since it's normal for games to be compiled with faster preference over precision, hopefully it will get results closer to what the game expected. https://devblogs.microsoft.com/cppblog/do-you-prefer-fast-or-precise/

Update: You can use this Windows builds for testing: https://www.dropbox.com/s/2v0vw9hm5gv7se9/PPSSPP_1.11-testbuild-fpfast_Win32x64.zip?dl=0 For Android you can use the latest one at https://buildbot.orphis.net/ppsspp/ (hopefully Android built using Neon, and hopefully Neon prioritize faster performance over precision accuracy)

MajinDipu commented 3 years ago

Even though I don’t understand coding I think I am starting to understand a lot. Good luck with that build. Who knows maybe you will solve a problem that happens in all Arena Fighting games on the PSP. Save this genre with your test build!! 🙏🏻😭

MajinDipu commented 3 years ago

Update: You can use this Windows builds for testing: https://www.dropbox.com/s/2v0vw9hm5gv7se9/PPSSPP_1.11-testbuild-fpfast_Win32x64.zip?dl=0 For Android you can use the latest one at https://buildbot.orphis.net/ppsspp/ (hopefully Android built using Neon, and hopefully Neon prioritize faster performance over precision accuracy)

Oh it’s here? Man you are fast. It's past my bedtime lol. I am gonna test with these two builds as soon as I wake up 😂😅

anr2me commented 3 years ago

I'll remove that previous testbuild, here is a new link where Windows build is compiled using /fp:fast Android: https://www.dropbox.com/s/b41bm43mtn1gpnn/PPSSPP_1.11-testbuild_ARMv7.apk?dl=0 Windows: https://www.dropbox.com/s/2t3mtdhb0f045cn/PPSSPP_1.11-testbuild_Win32x64.zip?dl=0 This test build will also shows a message saying "Time is going backward: xxxx -> xxxx" on screen if there is an issue with timestamp, just in case the disconnections were related to an issue where time can go backward on PPSSPP (ie. disconnects after this message appeared)

ghost commented 3 years ago

If this fixes the Dissidia issue @zakilj3 might be interested.

anr2me commented 3 years ago

The only disconnection i had on DBZ TTT was when the fight is over and the screen is showing Rematch menu, if i didn't choose anything sometimes it shows disconnection message, even with multiple instance.

Here is the log on the Host side: image

And this is the log on Joining side: image

Based on the log, it seems the host is sending data and expecting a reply within 33~34ms (probably because it's a 30 FPS game), if it didn't get a reply it try to resend again, however near the disconnection (indicated by sceNetAdhocPdpDelete) the host is getting the reply after 68ms (which is more than 2 frames difference) and considered it as too late (timedout), and the game seems to try to re-send only once.

So the main issue is probably because sometimes the packet is taking too long to arrived after the game is no longer attempt to retry (ie. the Client is sending it at 08:829 but arrived on Host side at 08:862, and this was tested on localhost) In this case, i'm not sure what kind of "trick" i should do to make sure there is always incoming data within a frame duration (even if it's a duplicate of previous packet, pretending a packet from a retry) in order to prevent disconnection, increasing the recv buffer size might not work, since the game will try to recv again within 1ms until the buffer is empty (based on the log on Joining side)

MajinDipu commented 3 years ago

OK in our first test match using Goku vs Vegeta in the first map the game disconnected when Goku hit me with a ki attack. We were throwing Ki attacks before but nothing was wrong. It was like day before yesterday situation. Also your time is going backward message didn’t show up. However it showed up when I started the game again on android. Here is the screenshot. Screenshot_20210419_193508_org ppsspp ppsspp

It is also happening Everytime I am booting the game.

MajinDipu commented 3 years ago

So the main issue is probably because sometimes the packet is taking too long to arrived after the game is no longer attempt to retry (ie. the Client is sending it at 08:829 but arrived on Host side at 08:862, and this was tested on localhost) In this case, i'm not sure what kind of "trick" i should do to make sure there is always incoming data within a frame duration (even if it's a duplicate of previous packet, pretending a packet from a retry) in order to prevent disconnection, increasing the rec buffer size might not work, since the game will try to recv again within 1ms until the buffer is empty (based on the log on Joining side)

Damn! You got it! At least you are the first person in the world to know what's the main problem here. So is it unfixable? A whole genre is depending on this question!

anr2me commented 3 years ago

OK in our first test match using Goku vs Vegeta in the first map the game disconnected when Goku hit me with a ki attack. We were throwing Ki attacks before but nothing was wrong. It was like day before yesterday situation. Also your time is going backward message didn’t show up. However it showed up when I started the game again on android. Here is the screenshot. Screenshot_20210419_193508_org ppsspp ppsspp

It is also happening Everytime I am booting the game.

Hmm.. that is strange to get the current time = 0 (ie. previous -> current), might be because the FPS/VPS is 0 too.

Edit: i guess it's normal for the time to reset back to 0 if you're reseting/rebooting the game.

MajinDipu commented 3 years ago

Yeah maybe u r right

MajinDipu commented 3 years ago

OK I also saw the "Time is going backwards" message while waiting in the lobby alone for like 30 sec. I missed the screenshot but it was here. Screenshot_20210419_194326_org ppsspp ppsspp

anr2me commented 3 years ago

Yeah, the time going backward issue is a bit random, but as long it doesn't cause disconnection, it should be fine.

anr2me commented 3 years ago

So the main issue is probably because sometimes the packet is taking too long to arrived after the game is no longer attempt to retry (ie. the Client is sending it at 08:829 but arrived on Host side at 08:862, and this was tested on localhost) In this case, i'm not sure what kind of "trick" i should do to make sure there is always incoming data within a frame duration (even if it's a duplicate of previous packet, pretending a packet from a retry) in order to prevent disconnection, increasing the rec buffer size might not work, since the game will try to recv again within 1ms until the buffer is empty (based on the log on Joining side)

Damn! You got it! At least you are the first person in the world to know what's the main problem here. So is it unfixable? A whole genre is depending on this question!

It can only be fixed by a workaround, probably by duplicating previous packet if recv buffer is empty on every frame. But i don't like workaround too much, and the game can also get confused if the packet keeps appearing on every frame.

MajinDipu commented 3 years ago

OK can you tell me what does this workaround mean? workaround in PPSSPP or the game file?

ghost commented 3 years ago

If you make the game output 60 fps all the time there wont be any issue no? As a workaround ofc. Maybe a cheat code that could allow that or a mode in the game. Seeing as changing the CPU clock helps maybe that too. I also noticed the menus run at 60 fps while ingame is 30 fps , so it could be the switch between 30 to 60 fps that could cause that issue.

MajinDipu commented 3 years ago

Hey Mojo, I also heard there's many 30 fps games that suffers in multiplayer. Adding a 60 FPS cheat helps. But the problem is there's not a option to make the game run at 60 FPS(Maybe it’s not possible to have a option like that?). Instead someone gotta make a specific cheat for a specific game to make sure it runs at 60 FPS all the time. So it is kinda hard. I wish I knew how to make a 60 FPS cheat. Oh I didn’t search on the internet if a cheat like this exist for DBZ TTT.

MajinDipu commented 3 years ago

No feedback in almost 4 days? So is this a dead end?

hrydgard commented 3 years ago

4 days is nothing :)

MajinDipu commented 3 years ago

OK I was getting used to hourly replies :)

anr2me commented 3 years ago

There won't be any update anytime soon, since i can't test whether duplicating the packet going to work or not due to we currently doesn't manage/keep track socket's buffer.

But i was planning to create a PSPSocket class to be used for infrastructure mode and merging the socket with AdhocSocket, thus we can manage each socket buffer on the class (i was planning to use it to detects DNS queries and faking the reply packet when resolving it through hosts file). Probably after i'm done working with infrastructure API.

For the meantime, if you can test whether cheat for 60 FPS can help preventing the disconnection issue (in case it will cause data sync to be done at a shorter interval, to make sure there will always be packet received within 33ms), it would be nice, if you can find the cheat code that is :)

PS: I was planning to create the 60 FPS cheat myself for testing purpose, but i forgot which syscall was it that can be used to wait for VBlank😅 Anyone remember? The one where the arg is 1 for 60 FPS dan 2 for 30 FPS.

unknownbrackets commented 3 years ago

sceDisplayWaitVblankStartMulti() is the one.

-[Unknown]

MajinDipu commented 3 years ago

It's cool ANR2ME. Take your time. And I searched the whole internet for the 60 FPS cheat code without any luck. Also asking people if they ever made any patch/cheat for this game to run at 60 FPS but again no luck :(

anr2me commented 3 years ago

Hmm.. looks like the reason why it didn't get the packet after 2 frames and deleting the socket, because it wasn't even trying to recv the packet on one of them frame ... i wondered why it skipped doing any networking on that frame other than checking the WLAN switch state at 01:648~01:682 image Or may be there is a timeout for idling too long on "Rematch" menu...

Edit: LOL it did have a count down timer during "Rematch menu" 😅 i didn't noticed it because i was using 1x Window and the timer is covered by FPS info So i guess the disconnection during "Rematch menu" is normal, and now we're back to square one... don't know why some attack could cause disconnection, since i can't reproduce it (yet)

anr2me commented 3 years ago

Hmm.. i'm not sure how to create the cheat properly. This is the code (li a0,0x2) which set the FPS to 30 when multiplayer game started, where this 0x00000002 value will be stored at 0x08A78E0C and being read as arg of sceDisplayWaitVblankStartMultiCB image After multiplayer ended the game will set the value at 0x08A78E0C to 1 (60 FPS) using the same function (z_un_08837a00)

I tried to create the cheat like this:

_S ULUS-10537
_G DBZ TTT [US] 
_C1 60 FPS
_L 0x08AB7EC8 0x34040001
_L 0x08A78E0C 0x00000001

But when i checked the instruction and the value stored in memory, they're not changing :( did i use the address in the wrong way? (in case the cheat have a base address)

PS: Replacing the instruction should be sufficient, replacing the vblank value in memory isn't really needed.

Update: Looks like i need to subtract the PSP address with 0x08800000 and added it with 0x20000000 So the correct cheat is:

_S ULUS-10537
_G DBZ TTT [US] 
_C1 60 FPS
_L 0x202B7EC8 0x34040001

But the animation seems to be moving too fast.. probably not a good idea to use 60 FPS other than for testing purpose.

MajinDipu commented 3 years ago

Edit: LOL it did have a count down timer during "Rematch menu" 😅 i didn't noticed it because i was using 1x Window and the timer is covered by FPS info So i guess the disconnection during "Rematch menu" is normal, and now we're back to square one... don't know why some attack could cause disconnection, since i can't reproduce it (yet)

Are you sure that the disconnection in match and after the match happens for different reasons? Yes I know it has a countdown timer but do you think that packet and floating point things might be same in 2 situations? Or just completely different?

MajinDipu commented 3 years ago

Update: Looks like i need to subtract the PSP address with 0x08800000 and added it with 0x20000000 So the correct cheat is:

_S ULUS-10537
_G DBZ TTT [US] 
_C1 60 FPS
_L 0x202B7EC8 0x34040001

But the animation seems to be moving too fast.. probably not a good idea to use 60 FPS other than for testing purpose.

Bruh, I guess it’s so complex to make a 60 FPS cheat for this game that everyone who tried failed. Indeed this is one weird game. Anyway I will use the cheat. For testing purposes only lol

Update: Well it looks like your cheat tricked this game to run at 2x speed. And ah... It got disconnected when Frieza was powering up 😅

anr2me commented 3 years ago

Edit: LOL it did have a count down timer during "Rematch menu" 😅 i didn't noticed it because i was using 1x Window and the timer is covered by FPS info So i guess the disconnection during "Rematch menu" is normal, and now we're back to square one... don't know why some attack could cause disconnection, since i can't reproduce it (yet)

Are you sure that the disconnection in match and after the match happens for different reasons? Yes I know it has a countdown timer but do you think that packet and floating point things might be same in 2 situations? Or just completely different?

The disconnection after the match is normal because it happened after the countdown ended, while the one during battle is not normal, i'm still suspecting it has something to do with collision calculation when an attack hit the target based on the symptom similarity to GvG Next Plus which was suspected to be related to VROT/VCOS.

Anyway, it's difficult to fix since i haven't been able to reproduce it my self during battle, thus unable to check the log.

anr2me commented 3 years ago

Btw, if it happened quite often on your test, could you test disabling some of the JIT feature on both players, like this: image If it didn't disconnect during battle, try removing each section (SIMD, LSU, FPU, VFPU) on each test to findout whether it's related to JIT or not, if it ever get disconnected it might be related. (btw, checklisted = disabled JIT)

MajinDipu commented 3 years ago

Btw, if it happened quite often on your test, could you test disabling some of the JIT feature on both players, like this: image If it didn't disconnect during battle, try removing each section (SIMD, LSU, FPU, VFPU) on each test to findout whether it's related to JIT or not, if it ever get disconnected it might be related. (btw, checklisted = disabled JIT)

Will do. But everything is already unticked. I will enable everything then try disabling everything one by one.

Edit:- Umm, I thought checked means enabled but it actually means disabled. Didn’t read your last part. So OK.... Will do the work

ghost commented 3 years ago

There is that PR here that chagnes stuff related to VFPU : https://github.com/hrydgard/ppsspp/pull/14406 Maybe it helps with this issue if it is related to VFPU...

MajinDipu commented 3 years ago

It's merged. Does this mean if it’s related to VFPU and I use latest versions the problem might be fixed?

MajinDipu commented 3 years ago

@ANR2ME Hey man, I got a tips to reproduce that connection lost thing. It's not in 1v1 tho. And requires a CPU But might help. Here's what you have to do. 1) Setup a 2v1 battle. Have 2 human players in one team and 1 CPU on the other. 2) Set CPU difficulty to very weak. 3) Pick any characters and any stage 4) When the match starts both human player should approach CPU immediately. Very much possible to do alone. 5) When 2 human players are close to the enemy, start punching and kicking (square button) simultaneously. Don't do the punch punch smash away and teleport kick thing. Hit 2 punch then take a breath then 2 punch again. 2 human should do it simultaneously. 5) Other things that you can do are ki attacks together both from close range and far away. Or use your super attacks together like Kamehameha and Gallick Gun to the CPU at the same time. Have one player do the kamehameha while other one does dragon rush. etc

This has 100% success rate of disconnecting. Good luck.

anr2me commented 3 years ago

It's merged. Does this mean if it’s related to VFPU and I use latest versions the problem might be fixed?

Have you tried with the latest version to see whether that PR fixed this issue?

Btw, i'm not familiar with DBZ games, other than regular attack (close combat and ki) i don't know any other moves LOL i don't even understand what "punch punch smash" mean :D And since i'm playing this alone, it's kinda difficult to do this simultaneously on Android & PC. Also, you didn't mention in your step-by-step when is the expected disconnection to happen? on step 7?

MajinDipu commented 3 years ago

Oops. Ok I didn’t test it on the latest build. To answer your 2nd question disconnection can occur in step 5 or step 6. Step 6 is divided into two parts but it might happen simply with ki attacks. So I hope kamehameha or gallick gun is not needed. I know it is hard to simultaneously control both android and PC but I said in step 4 it is very much possible if you set CPU's difficulty to very weak. At least you know how to punch and kick. That will be it.

MajinDipu commented 3 years ago

@ANR2ME Yoooo, you gotta check this out! The latest build made this game unstable in multiplayer. Everything is sooo fast and acting weird all of a sudden. Here's the video link -> https://youtu.be/NCbTLKTJEuQ Needs testing by others with this build before creating a new issue. Who knows it might be my device. Please anyone who sees this, u gotta try multiplayer with the latest build. In case you are wondering if it is happening with other games then no. Tested Tekken 6 and it was fine and just as before. Not sure about other Arena fighters like Dissidia or Gundam tho.

unknownbrackets commented 3 years ago

Is it fine in v1.11.2-550-gdbe665880 and bad in v1.11.2-558-g0ccc63b43? That does look potentially like some kind of not good sin/cos problem...

-[Unknown]

MajinDipu commented 3 years ago

I think I had v1.11.2-543 before and it was good. Not sure about 550

unknownbrackets commented 3 years ago

Well, I'm surprised we didn't have a vrot test for cos(2 * pi/2). Sorry, will be fixed in a84df2536.

-[Unknown]

MajinDipu commented 3 years ago

GG

anr2me commented 3 years ago

So did the latest version right now fixed this disconnection issue?

MajinDipu commented 3 years ago

OK only tested 2 match. 1st match was the cleanest match we had in a long time. Everything went perfectly. Also we tried to do many things to force disconnection but it was all good. After the 1st match we pressed rematch. In the 2nd match again that disconnection occurred. Needs more testing but rn Imma sleep. I have this weird feeling that the connection might've actually improved. But that's too early to say bcz only played 2 match. But damn! That 1st match was magical!

anr2me commented 3 years ago

May be the game uses more VFPU other than VROT and VCOS/VSIN (i'm not sure what kind of calculation usually used to checks for collision, but usually the colliders are in simple shape like box, sphere, and capsule). But it's nice to know you had your first ever stable gameplay :D

ghost commented 3 years ago

Tried to find out what happens with Android to PC on Dissidia 012... WIth the latest dev build it will disconnect not long after the match starts. But if you disable the VFPU stuff from the JIT the match seems to last longer but will still disconnect. I noticed that the intro animation when the battle begins is a bit wonky with the VFPU stuff disabled and its kinda funny lol. Tried overclocking to the max cpu limit of 1000 mhz but I am not sure if it helped or not (the match still lasted a bit longer).

ghost commented 2 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.

Found out that using IR Interpreter only on the PC side seem to solve this issue for now and only for GvG. I only tried 1vs1 Android to PC though BTW I remember trying JPCSP vs PSP and it still disconnected there recently...

anr2me commented 2 years ago

Does using IR interpreter on both Android and PC also worked better?