Skip to content
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

Make the connections UDP #23

Open
ZynoXelek opened this issue Nov 16, 2023 · 6 comments
Open

Make the connections UDP #23

ZynoXelek opened this issue Nov 16, 2023 · 6 comments
Labels
enhancement New feature or request

Comments

@ZynoXelek
Copy link
Collaborator

Verify that the game uses UDP protocol for communications.
If not, implement it.

This link may be useful to do so : https://wiki.python.org/moin/UdpCommunication

@ZynoXelek ZynoXelek added the enhancement New feature or request label Nov 16, 2023
@ZynoXelek
Copy link
Collaborator Author

@ZynoXelek
Copy link
Collaborator Author

Currently, both our clients and server sockets are using socket.SOCK_STREAM (a.k.a TCP) in their constructor.
We just have to replace it with socket.SOCK_DGRAM (a.k.a UDP) !

@ZynoXelek
Copy link
Collaborator Author

Problem : listen and accept do not exist for UDP sockets.
Need for a central socket (MAINSOCKET) to process clients inputs and share them to the server, which will then use a predefined socket to send data back.
On the client side, may need to have two sockets : one for listening and one for sending. (But not sure it is required)

@ZynoXelek
Copy link
Collaborator Author

Good improvements today.
Yet, still need to stop the dissociation between new connections and old clients.
In the future, only two threads will be necessary : the socket one and the server management one.

@ZynoXelek
Copy link
Collaborator Author

Still need to improve the way our UDP works :
Client side :

  • A thread permanently listens for state of the game which is sent periodically after periodically moving players.
  • Another thread send inputs only when there is inputs to send. Remove "." input which certainly floods the server a lot !

@ZynoXelek
Copy link
Collaborator Author

Tried to implement two threads on the client side. WIP and need improvements.
Yet periodically moving players is a good improvement and need to be improved. Same for stopping sending "." for no reason and still having feedback from the server !

I'm not sure threads really are necessary on the client side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant