Okay, so I spent today cleaning up the server code. I put together a version for demonstration purposes, since I don't want to put my entire game's code out in plaintext. I was able to get a consistent response where when the client joins, it shows, when the client leaves (nicely or not), it gets dropped and removed.
I get a consistent response with one client making requests on the first server start and first client connect. However, it gets very inconsistent if I add one more client, drop connections, connect back before the server realizes the client is gone. I don't really understand what is going on.
Also, I would like to know if it is a good or bad idea to have every client connection handled on its own thread, because I am noticing the server responses don't really seem as fast I want, especially when multiple clients are connected.
Thanks!
Lua Enet IPv6
Re: Lua Enet IPv6
I had a quick look, but couldn't run the client due to a syntax error.
An unrelated note: at least in one place the code looks like this:
While not exactly wrong, this construction will needlessly strain the gargabe collector and lower performance. Those functions get redefined at every loop iteration, throwing away the previous definition. Move the functions out of that loop if optimal performance is desired.
Code: Select all
Error: Syntax error: main.lua:25: 'end' expected (to close 'while' at line 17) near 'if'
Code: Select all
while true
local function abc() ... end
local function xyz() ... end
...
end
-
- Citizen
- Posts: 85
- Joined: Sat Oct 25, 2014 7:07 pm
Re: Lua Enet IPv6
I edited some code. Thank you for your function suggestion! I just need to get the code to work, then I'll work it out how to design it better.
Here is the updated LOVE code for the client that SHOULD work: Thanks!
Here is the updated LOVE code for the client that SHOULD work: Thanks!
Who is online
Users browsing this forum: Ahrefs [Bot], slime and 8 guests