TCP Networking
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
TCP Networking
Is there any way I can make my multiplayer game use TCP instead of UDP without remaking luasocket in TCP or something weird like that?
while true do end;
Re: TCP Networking
This might help (BTW I simply googled "luasocket TCP" ).
Tutorial here: http://w3.impa.br/~diego/software/luaso ... ction.html
API Documentation: http://w3.impa.br/~diego/software/luasocket/tcp.html
Tutorial here: http://w3.impa.br/~diego/software/luaso ... ction.html
API Documentation: http://w3.impa.br/~diego/software/luasocket/tcp.html
My Tox ID: 0F1FB9170B94694A90FBCF6C4DDBDB9F58A9E4CDD0B4267E50BF9CDD62A0F947E376C5482610
Re: TCP Networking
The tutorial makes use of while true do... that completely stops my game and server, why would it ever do that? It's pretty much a useless tutorial. I tried putting the while true do stuff in love.update but that didn't work. Yes I am using Love for the server. No I am not going to change that.
while true do end;
- Positive07
- Party member
- Posts: 1014
- Joined: Sun Aug 12, 2012 4:34 pm
- Location: Argentina
Re: TCP Networking
Well that means you didnt even read the tutorial and have no idea how to use the library because I totally made it work just with that example. So I guess its not the tutorial that is useless but you, the problem you are having is probably due to the timeout and also check if you received something otherwise keep going like nothing happen. THINK dont make people resolve your issuesRonanZero wrote:The tutorial makes use of while true do... that completely stops my game and server, why would it ever do that? It's pretty much a useless tutorial. I tried putting the while true do stuff in love.update but that didn't work. Yes I am using Love for the server. No I am not going to change that.
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
Re: TCP Networking
the problem im having is due to while true do...Positive07 wrote:Well that means you didnt even read the tutorial and have no idea how to use the library because I totally made it work just with that example. So I guess its not the tutorial that is useless but you, the problem you are having is probably due to the timeout and also check if you received something otherwise keep going like nothing happen. THINK dont make people resolve your issuesRonanZero wrote:The tutorial makes use of while true do... that completely stops my game and server, why would it ever do that? It's pretty much a useless tutorial. I tried putting the while true do stuff in love.update but that didn't work. Yes I am using Love for the server. No I am not going to change that.
while true do end;
Re: TCP Networking
I agree somewhat with positive07 here... This is a TUTORIAL it is showing you how to use the functions that the library provides. I think what your actual issue with the tutorial is that you don't know how to keep your game running while running one of the loops. Just run it in another thread. Your problem could also be that you are afraid that it will use 100% of the CPU... if this is what you are thinking this is just plain wrong and shows that you don't understand what the functions do... The functions pause and wait for the operating system to return with the information. This can mean waiting for information to arrive. Read the tutorial and the api hold back from quick judgement until you completely understand what is happening. If the while true do end really was a problem people wouldn't use luasocket and it is widely used so the while true do end probably isn't a problem. Internet messaging requires a different kind of thinking.RonanZero wrote:the problem im having is due to while true do...Positive07 wrote:Well that means you didnt even read the tutorial and have no idea how to use the library because I totally made it work just with that example. So I guess its not the tutorial that is useless but you, the problem you are having is probably due to the timeout and also check if you received something otherwise keep going like nothing happen. THINK dont make people resolve your issuesRonanZero wrote:The tutorial makes use of while true do... that completely stops my game and server, why would it ever do that? It's pretty much a useless tutorial. I tried putting the while true do stuff in love.update but that didn't work. Yes I am using Love for the server. No I am not going to change that.
My Tox ID: 0F1FB9170B94694A90FBCF6C4DDBDB9F58A9E4CDD0B4267E50BF9CDD62A0F947E376C5482610
-
- Party member
- Posts: 730
- Joined: Sat Apr 26, 2014 7:46 pm
Re: TCP Networking
You do not need the while true do. Love has one at its heart just place it in love.update. When ever you need something to repeat indefinitely place it in update. Just like in this case it uses an infinite loop. Place it in update. Also I think you have to set timeout to zero I think.
- Positive07
- Party member
- Posts: 1014
- Joined: Sun Aug 12, 2012 4:34 pm
- Location: Argentina
Re: TCP Networking
He wants us to post a working port on how this is done in LÖVE, but I dont intend to do so, we are not here to code your game you see? We are here to help, you need to do the rest. That tutorial express that this is how you do it when you dont have a main loop, but if you have one you just need to put the content of while true do inside of your main loop (as RonanZero, BobbyJones and I said before, just put that in love.update) then it says that the functions lock until the timeout is met or data is received, so that basically means you have to reduce the timeout in order not to block your game, just set the timeout to 0 as BobbyJones and I said. THATS IT! BUT YOU DIDNT EVEN READ IT!
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
Re: TCP Networking
Is there a reason why you can't use UDP? TCP is normally not recommended for use in games, from what I've read. Especially if its real-time. Have you tried using enet?RonanZero wrote:Is there any way I can make my multiplayer game use TCP instead of UDP without remaking luasocket in TCP or something weird like that?
Who is online
Users browsing this forum: Ahrefs [Bot] and 1 guest