CTR-tools / CTR-ModSDK

ModSDK - a modding toolkit to create mods for Crash Team Racing in C. This repository also houses an effort to fully decompile and reverse-engineer CTR in C.
https://discord.gg/WHkuh2n
306 stars 37 forks source link

OnlineCTR: Less disconnections fix approach #130

Closed ClaudioBo closed 3 months ago

ClaudioBo commented 4 months ago

Currently some people get disconnected "randomly" whether if the server is close or far away.

In my experience I even got disconnections from a localhost server, so most of the time it isn't ping related.

I edited the Client.exe to add a ping measurement to double-confirm this, and as seen here (and many more tests that I've made and also not published) I got disconnected without having a high ping:

image Tested on MEX server

I got more disconnections adding some printfs() trying to simulate a little bit of slow down on the Client.exe behalf (in localhost).

Also started streaming something else while doing these tests and got even more disconnections (in localhost).

Despite these small hiccups that I added to the code and programs that consume some of my CPU, although this is the reason for the disconnections, it should not be.

It is the OnlineCTR mod that is too strict on the Client.exe on causing a disconnect if the game wasn't updated 4 frames: https://github.com/CTR-tools/CTR-ModSDK/blob/046daf58aa901463b74f6d0b9f95bee056af4fa3/decompile/General/AltMods/OnlineCTR/thread.c#L39

This should at least make this less strict and make the game disconnect if it didn't get updated by the Client.exe for more than 4 frames, i.e. you can force a disconnection if it wasn't updated at least 30 frames.