Page 28 of 34

Re: LUBE (Networking Library)

Posted: Sun May 29, 2011 4:08 pm
by Bambo
Hey, i got it kinda working! Not sure if its right though...

the one bug i'm having trouble with is that when a user leaves the server, if there is another person connected when they try to move it gives an error on line 64 serverside. other than that its pretty cool...

Re: LUBE (Networking Library)

Posted: Wed Aug 10, 2011 4:39 pm
by tsturzl
LUBE offers UDP but only server-client style connecting. UDP is connectionless... Why can I not create 2 clients that send udp to eachother, or can I? If so, how do I do this? Have all the hosts that are connected in use a server object? So server to server?

Re: LUBE (Networking Library)

Posted: Wed Aug 10, 2011 6:19 pm
by bartbes
The way LUBE is set up is it assumes that one of the two is 'in charge', i.e. it being the server, there is nothing preventing you from running multiple servers and/or clients though. If you're not looking for this, you should consider using luasocket directly.

Re: LUBE (Networking Library)

Posted: Mon Aug 29, 2011 2:49 pm
by bartbes
A new version in testing. Not just a new version, a complete rewrite.
Anyway, no real new features, except for the fact it now uses proper classes, courtesy of Class Commons.

(To those uninitiated, this means that it can be used with all participating class libraries, which, at the moment of writing, are SECS, Slither and HUMP. (And MiddleClass?))

Find the new version here: https://github.com/bartbes/love-misc-li ... E/LUBE.lua.

Re: LUBE (Networking Library)

Posted: Tue Oct 25, 2011 7:57 pm
by BURGINABC
How do you do pack nested tables with lube.bin:pack? I know it has something to do with lube.bin:setseperators, but the documentation wasn't exactly clear on how you go about it. I spent some time trying to figure out a solution on my own, even printed a packed-table string to console to look at the structure, but I haven't gotten anything to work. Please help, and if there is a solution you should probably make the documentation in the wiki or included html files more detailed/specific, so people don't have to ask you. What there is now, in terms of documentation, just isn't enough for a novice like me to figure out.

Re: LUBE (Networking Library)

Posted: Tue Oct 25, 2011 8:04 pm
by TechnoCat
BURGINABC wrote:How do you do pack nested tables with lube.bin:pack?
There are a couple options for table serialization:
http://love2d.org/wiki/TLTools
http://love2d.org/wiki/Serial

Re: LUBE (Networking Library)

Posted: Tue Oct 25, 2011 8:10 pm
by bartbes
Well, the idea is that you start at the furthest embedded table, pack it, set the separators to new values, go up in the tree a step (so to the table that contains that/those), pack, and repeat the process until you've reached the end.

This is not very user-friendly, and lube.bin hasn't made the rewrite either. For your convenience, and mine, probably, you should really look at other serialization options. I've heard the name TSerial mentioned quite a bit, here is its wiki page.

Ninja'd, I tip my hat to the, TechnoCat.

Re: LUBE (Networking Library)

Posted: Tue Oct 25, 2011 9:04 pm
by Robin
Note that not all implementations of table serialisation can detect cycles, and can get into an infinite loop if you pass a table like:

Code: Select all

t = {}
t[1] = t

Re: LUBE (Networking Library)

Posted: Tue Oct 25, 2011 9:06 pm
by BURGINABC
thanks TechnoCat, "serial" actually works! It creates a function for reconstructing the table and crams it inside a string. the recipient's end declares the function by loadstring-ing the string, then calls the function to reconstruct the table. It may be a tad inefficient, but it certainly works better, for me at least, than the data format used by lube.bin:pack, because it doesn't break when you feed it nested tables. Well, problem solved. :awesome:

As for TSerial, it didn't work for me. It kept calling my indexes invalid.

Re: LUBE (Networking Library)

Posted: Fri Feb 17, 2012 10:39 pm
by zipperipper
Any reason when a player disconnects that it sets the index of a player to 0?
it seems to screw up the whole list of clients, which is making it difficult to work with disconnections :I
edit:
In my server, if client 2 disconnects, it leaves me with clients 1 and 3, as it should, but then client 3 times out
Image
It prints the client list every time, you see I am eventually left with just client 1