Code Monkey home page Code Monkey logo

Comments (6)

ZynoXelek avatar ZynoXelek commented on August 10, 2024

We have another answer here to confirm :
https://stackoverflow.com/questions/19727606/how-to-differentiate-tcp-udp-when-programming-sockets

from haunted-chronicles.

ZynoXelek avatar ZynoXelek commented on August 10, 2024

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

from haunted-chronicles.

ZynoXelek avatar ZynoXelek commented on August 10, 2024

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)

from haunted-chronicles.

ZynoXelek avatar ZynoXelek commented on August 10, 2024

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.

from haunted-chronicles.

ZynoXelek avatar ZynoXelek commented on August 10, 2024

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 !

from haunted-chronicles.

ZynoXelek avatar ZynoXelek commented on August 10, 2024

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.

from haunted-chronicles.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.