Ok so I am making a mini multiplayer game
https://github.com/cohadar/tanks-of-harmony-and-love
Using lua-enet for networking.
Never made multiplayer game before, but I think I did netcode right, just not sure.
It works like this:
Love FPS is 60, I sample and send user commands to server at 30 FPS, server works at 60 FPS but updates clients at 10 FPS.
Clients and servers are in lockstep, they all have tick counter updated every 60 FPS.
When state on client and server gets different a resync is forced on client ( I display sync text on screen for debugging )
So far it is working fine, I just thought to ask nevertheless.
Am I doing something wrong? Could I be doing something better?
My netcode is working, but I have a question
Re: My netcode is working, but I have a question
Fps isn't a good way to count because if fps is ever lower than 60 there will be a lot of mismatches. Unfortunately, I don't know how it should be done either... What I would do it have a separate thread on the client that will try to ask server for an update and send updates every so many seconds using socket.sleep. This sub thread would communicate with the main thread via messages. The server would be written in pure lua + luasocket (so no love callbacks) and would be willing to get a message from its clients at any time.
My Tox ID: 0F1FB9170B94694A90FBCF6C4DDBDB9F58A9E4CDD0B4267E50BF9CDD62A0F947E376C5482610
Who is online
Users browsing this forum: No registered users and 3 guests