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...
LUBE (Networking Library)
Re: LUBE (Networking Library)
- Attachments
-
- networking.zip
- (17.93 KiB) Downloaded 214 times
Re: LUBE (Networking Library)
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?
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: LUBE (Networking Library)
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.
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: LUBE (Networking Library)
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.
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)
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.
- TechnoCat
- Inner party member
- Posts: 1611
- Joined: Thu Jul 30, 2009 12:31 am
- Location: Milwaukee, WI
- Contact:
Re: LUBE (Networking Library)
There are a couple options for table serialization:BURGINABC wrote:How do you do pack nested tables with lube.bin:pack?
http://love2d.org/wiki/TLTools
http://love2d.org/wiki/Serial
- bartbes
- Sex machine
- Posts: 4946
- Joined: Fri Aug 29, 2008 10:35 am
- Location: The Netherlands
- Contact:
Re: LUBE (Networking Library)
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.
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.
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: LUBE (Networking Library)
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
Help us help you: attach a .love.
Re: LUBE (Networking Library)
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.
As for TSerial, it didn't work for me. It kept calling my indexes invalid.
As for TSerial, it didn't work for me. It kept calling my indexes invalid.
- zipperipper
- Prole
- Posts: 45
- Joined: Thu Jan 14, 2010 7:59 pm
- Location: UK
Re: LUBE (Networking Library)
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
It prints the client list every time, you see I am eventually left with just client 1
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
It prints the client list every time, you see I am eventually left with just client 1
Error 404, consciousness not found.
Who is online
Users browsing this forum: No registered users and 2 guests