-
-
Notifications
You must be signed in to change notification settings - Fork 32
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
Design new network protocol to be used for communication between server and client #70
Comments
@pehala Great ideas! But definitely a huge workload which would be better done on a new branch. Feel free to work directly on this repository instead of your fork if its easier for you, I can give you write permissions if not already granted. |
I am not sure if it's really suited here but the server-client communications needs some sort of protection against conflics/race conditions when multiple messages come in at the same time. (f.e. |
No need, I would still like someone to review the code, to make sure it is correct. I would also like to discuss this with you in more detail to make sure the design is done right and if that would be possible I would like to ask you to help me with the mapping of existing "endpoints" from client because the code is totally a mess. |
I definitely agree, that is taken care of netty (if we would use netty correctly) so it shouldn't be that hard. EDIT: Oh and we have to use special collections (CopyOnWriteArrayList etc) to make sure that it works with parallel access. |
Fine! I do not really see myself writing any "new" high level Java code as my Java skills are way behind yours and I am tbh not really into Java. Reverse Engineering the current protocol stack and help design a new concept would be a more favorable tasks If I am able to invest time in it. |
Is there any chance we can add more than 4 players? |
@capsload2 See #71! |
@pehala I digged a bit through the codebase and got a bit more familiar with some endpoints and how the connection works. I have a few open questions to you:
|
|
Maybe adding NETWORK.md with all endpoints could be a good idea, we will document it in the process which is always a good idea |
@pehala Have you already found this document? https://github.com/PhilippvK/playforia-minigolf/blob/master/doc/servertoclient.txt Its not as helpful as I wished but it contains at least a subset of endpoints... |
I did not, thanks! |
Do you think de-obfuscating the variable- and function-names in the client-side connection code would be a good initial/intermediate step or would it become obsolete when rewriting the protocol anyway? We could f.e. migrate to netty 4 with the current protocol before we replace it with a new one. I also found out that the protocol already supports server-client version verification in some way, but it is not really used at the moment :D |
Yes definitely
Probably not, it would require time to replace deprecated components which I think is not very useful since we want to scrap it all together.
Lol, nice :D I would probably not enable it or use it right now, I think we can wait with this for the new one. I would rather have polished feature later than PoC early. |
After spontaneous reserach I think we can base our protocol on top of WebSockets. Since it is using HTTP connection, we would be able to hide our server behind HTTP proxy, which is currently not possible (I have tried). |
Wow, I actually hd the same thoughs just a few days ago! I tried Porting the Client Java Applet to HTML5+JS via the CheerpJ Compiler. The problem is that Browsers can only communicate via HTTP/HTTPS/WebSockets which does not work at all with the Netty TCP Sockets. Unfortunately CheerpJ does only support native Java8 Components which means that Anyway, WebSockets would solve this issue if Java11 is supported by the tool in the future. Great Idea! Would you like to stick with Netty for realizing this approach? |
Yes I would like to stick with Netty. Quick research showed that they are already some implementation of websockets with netty, even tho I didn't test them yet. I plan to test this with a prototype once I have some free time left (=most likely my exam period over) |
Quick note: it might be possible to port existing TCP netty application to WebSockets by changing handler, which takes care of the actual protocol mapping. |
Good points! But as far as I know only the server-side of the communication uses Netty at the moment. Client uses plain sockets. I assume that we should possibly port the client to use netty as well first. |
Similar situation for me. I hope that I manage to invest some time in the project in March because exams are more important at the moment. |
Yep that will definitely be the first pain point |
It might be not really related to the Issue but I managed to get the Client Applet running using CheerpJ to compile from JAR to HTML5+JS. As mentioned before I had to write a custom Adapter to |
Nice! I would like to still like to properly rewrite client networking since we have the option and time, but this is awesome for all other minigames. |
I finally started with rewrite on top of latest Netty (4.1). Suprisingly, the pure socket client is not that hardly connected to the rest of the applet so I was able to replace it with my own. I choose to design the communication from scratch because it seemed a lot of network messages currently in use. I have currently a small PoC which so far is integrated as far as lobby select. Due to the nature of the rewrite (absolutely everything network related :D) it will be a very big PR, @PhilippvK would you like me to create draft PR which will be continuously updated so we can discuss changes early or do you want me to submit once I finish everything? |
Also regarding the websockets, since we are using Netty, it is very easy to switch underlying protocol to pure websockets if we want to also embed it into HTML |
BBoth is fine to me. But I would prefer if I can either check the current state out via the PR or by just using your fork of the repository. |
Currently, the server-client communication is based on text messages separated by tab (e.g
starttrack \t trackname...
), processed by one big if statement across multiple methods. It is a mess and sadly totally unmaintanable since we cannot read most of it and do not understand how it works at all.I would like to start designing a new proper protocol which would include all of the messages that are currently processed and that would allow extending it to for example enable user roles or even check version.
To do that I think we should have a separate branch because this is an effort that will take a long time a lot of work.
WDYT @PhilippvK ?
The text was updated successfully, but these errors were encountered: