-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add go version to increase performance #1
Conversation
I got to tell I have no experience in go but this looks really well written compared to the python one, like don't have to relaunch proxy when switching server, and the ping is low too, but I did run into a few issues while running this:
|
@tamilpp25 I'm grateful that you take time to review it! (maybe just have a try ) I will try to reproduce the problem at night and fix some unreasonable parts (such as strong reliance on handshake packets to close) |
Issue I saw with packets not processing was, once you enter game it works fine for like 10-20 seconds but after that it won't and ends up trying to reconnect, probably issue with kcp? as this has happened in python version multiple times like the kcp crashes midway |
Hi @tamilpp25, glad to sync the progress with you now. With some work I solved a bunch of issues and it's now running on my computer with amazing stability (only 2 ms latency). You can check the change with this commit.
BTW, now you can dump all packets when quitting server :-D. Have fun! |
…en quiting server
This is really awesome, ping is greatly reduced, and packets seem to be processed right on time but after playing for a while it looks like the kcp crashes and I get this error, this happened twice like after 2-3mins of entering game and playing around
also this is where the error seem to happen:
after which the program exits with |
Unfortunately, this seems to be a problem with goroutine racing, maybe the KCP object is not concurrency/multi-threading safe, so I may need to lock the KCP object when reading and writing operations, which may cause refactoring... I'll watch at this issue and make some goroutine race tests tomorrow night, thanks for the feedback! |
Okay... KCP is not multi-threading safe, quote for skywind3000/kcp#190 (comment) and skywind3000/kcp#207, It may be the same reason for your python version crash too. I will refactor that tomorrow, now just go to bed :-P |
Hi @tamilpp25, I added a mutex to the operation of the KCP object in a simple way, and the game ran stably for 10+ minutes. This doesn't seem to affect performance much so I didn't refactor in a lock-free way. Please check if the issue still exists when you are free. You may be interest to check the change with this commit. |
Tested for almost half an hour, the KCP doesn't crash and the gameplay is smooth 👍🏻 |
also I'd like you to add a few more parameters while saving the dump file so that it matches the format [
{
"index": int,
"packetId": int,
"protoName": string,
"source": string,
"time": float,
"object": protobuf object
}
] |
I will update the record format tonight, may you do more tests to find more issues I can fix together? |
sure |
Hi @tamilpp25, I have updated the record format in this commit. |
Awesome, looks good to me and nice logger too 👍🏻 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO for me:
- Use this as main and remove the python version later
BTW, I have no experience in reversing the mhy protocol and I may be overwhelmed once mhy has updated their protocol, so maybe you may keep your python version for a while and I can keep working on translating your python code until you have got enough experience in go. :-D |
Alright sure, If you want to contact me message on discord: |
latency jitter 50ms=>20ms