I have been trying to figure this out for the past 2 day pls help ;(

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
Kjunix
Prole
Posts: 3
Joined: Tue Dec 24, 2019 10:59 pm

I have been trying to figure this out for the past 2 day pls help ;(

Post by Kjunix » Tue Dec 24, 2019 11:13 pm

Okay so I'm bugged, I don't know which library to use for the multiplayer. Is it socket or enet?

I have created a "ping/pong" program that constantly sends "ping" to a server and "pong" to a client both in socket and enet.
Now the problem is that when I start 10 clients the socket one starts getting really slow(only 2 of 10 clients receive "pong" and the other 8 don't receive anything), but with enet every 10 clients receive "pong".

But the thing that bugs me is that enet one, needs to receive every time a packet otherwise the client disconnects(it uses the "while event do" loop) is there any possible way to fix that, I don't want to send every time a packet, I want to send them in delays(1 second...) but if I do it the server doesn't receive anything and stops sending the client packets.

The code I used for the enet is: https://love2d.org/wiki/lua-enet


So to wrap things up, which library is better for multiplayer games socket or enet?
And is it possible to send a delayed packet using enet without stopping the while event do loop? Could you provide code?
...I have been trying to figure this thing out for the past 2 days so I decided to jump on forums(I googled it everywhere, didn't help)...

User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: I have been trying to figure this out for the past 2 day pls help ;(

Post by raidho36 » Wed Dec 25, 2019 5:40 am

Enet works on top of sockets. So you just need to program your game properly. And networking just happens to be the hardest part of programming a game, so you should expect tons of problems like this.

You must program it to allow missing a packet and continue running anyway. As for most of your peer not receiving packets, you're probably doing something very silly; under normal circumstances the socket library is more than well suited to handle thousands of active connections.

PGUp
Party member
Posts: 105
Joined: Fri Apr 21, 2017 9:17 am

Re: I have been trying to figure this out for the past 2 day pls help ;(

Post by PGUp » Fri Dec 27, 2019 3:11 pm

Just use sock.lua, it's a wrapper on top of enet.. even easier
-

Post Reply

Who is online

Users browsing this forum: No registered users and 16 guests