LUBE (Networking Library)

Showcase your games and demos, and discuss ongoing projects.

LUBE (Networking Library)

Postby bartbes on Thu Oct 23, 2008 10:18 am

Here's my networking library named LUBE, this post is now used for project status.

Current version: 1.0
Version 1.0 (press 'raw' for download, or check out the repo and use the 'LUBE-1.0' tag)
Version 1.0 docs

Development version
Development version docs

Old releases:
LUBE.zip
0.7.1
053010
(14.3 KiB) Downloaded 1387 times

LUBE.zip
0.7.0
011510
(14.27 KiB) Downloaded 601 times


Lag-o-meter 3000 -> page 12
TechnoCat's awesome introductory writeup
Last edited by bartbes on Tue Jul 21, 2009 10:04 am, edited 55 times in total.
Cowardly acts and the eating of birds must not be the deeds of a Hero of Storms.
User avatar
bartbes
Sex machine
 
Posts: 4517
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands

Re: Networking Library

Postby TsT on Thu Oct 23, 2008 12:09 pm

bartbes wrote:Any suggestions for a name?


Maybe UdpClient ?
My projects current projects : dragoon-framework (includes lua-newmodule, lua-provide, lovemodular, , classcommons2, and more ...)
User avatar
TsT
Party member
 
Posts: 161
Joined: Thu Sep 25, 2008 7:04 pm
Location: France

Re: Networking Library

Postby bartbes on Thu Oct 23, 2008 12:30 pm

Thanks! I'll look at other suggestions (if any) before going with this name though.
Last edited by bartbes on Thu Oct 23, 2008 1:51 pm, edited 1 time in total.
Cowardly acts and the eating of birds must not be the deeds of a Hero of Storms.
User avatar
bartbes
Sex machine
 
Posts: 4517
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands

Re: Networking Library

Postby bartbes on Thu Oct 23, 2008 1:51 pm

Moved changelog to first post, added host.
Cowardly acts and the eating of birds must not be the deeds of a Hero of Storms.
User avatar
bartbes
Sex machine
 
Posts: 4517
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands

Re: Networking Library

Postby u9_ on Thu Oct 23, 2008 3:14 pm

Hi, i'm new here, so not really sure if this is applicable what i'm saying, if you are making a network library for LOVE, you should stick to LOVEs naming convention, i.e. function names start with lower case letters.

Personally i prefer starting with a capital letter, but I think maintaining a standard is much better then everyone going in his own direction.

/u9
u9_
Citizen
 
Posts: 54
Joined: Thu Oct 23, 2008 7:12 am

Re: Networking Library

Postby bartbes on Thu Oct 23, 2008 3:41 pm

You're right :D

Added to list.
Cowardly acts and the eating of birds must not be the deeds of a Hero of Storms.
User avatar
bartbes
Sex machine
 
Posts: 4517
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands

Re: Networking Library

Postby bartbes on Fri Oct 24, 2008 1:51 pm

Suggestion for binary packing:
Code: Select all
1 byte identifier (S=string, N=number, etc)
byte with value 1
name
byte with value 1
value
byte with value 0

this is basically
Code: Select all
id-1-name-1-value-0

So? Do you agree? Or do you have other ideas about packing? Post!
Cowardly acts and the eating of birds must not be the deeds of a Hero of Storms.
User avatar
bartbes
Sex machine
 
Posts: 4517
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands

Re: Networking Library

Postby TsT on Sun Oct 26, 2008 3:29 pm

Let's see my new network tcp client lib version.
Sample of code
Code: Select all

function j2h_parseline(line)
   
[...]

   if cmd == "ping" then
      log("receive ping sending pong...n-i-y");
      network:execCmd("pong", line);
      return 0;
   end
   if cmd == "pong" then
      local lag = os.difftime (os.time(), line);
      log("pong reply(" .. tostring(line) .. ") lag = " .. tostring(lag) .. " s");
      return 0;
   end

[...]

   return 1;
end

function j2h_db_update(datafound)
   if datafound then
      log("data found ... here you can show number of updated lines ..."
   --else
   --   you can also do something here, when data found but nothing require update
   end
end

function load()
   love.filesystem.require( "network.lua" );
   config.host = "myhost.domain.com";
   config.port = 1234;

   socket = require("socket");
   network = Network:New("tcp-client");
   network:setLogHandler(
      function(...)
         print("network: " .. ...);
      end
   );
   network:Setup(config.host, config.port);
   network:setParseHandler(j2h_parseline); -- execute for each line received
   network:setEndHandler(j2h_db_update); -- execute after parse all line

   network:addCmd("getall",
      function(self)
         local lines = "GET *";
         self:Send(lines);
         j2h_log("send getall request");
      end
   );

   network:addCmd("ping",
      function(nw)
         local time = os.time();
         local lines = "ping " .. tostring(time) .. "\n"
         nw:Send(lines);
         j2h_log("ping " .. tostring(time));
      end
   );
   network:addCmd("pong",
      function(nw, data)
         nw:Send("pong", data);
      end
   );

   network:Setup(config.host, config.port);
   network:Enable()
   network:execCmd("getall");
end

function j2h_quit()
   network:Disable();
   love.system.exit();
end


function update(dt)
   network:Update(dt);
end



network.lua
j2h network lib v0.1.2 (r266)
(4.56 KiB) Downloaded 407 times
My projects current projects : dragoon-framework (includes lua-newmodule, lua-provide, lovemodular, , classcommons2, and more ...)
User avatar
TsT
Party member
 
Posts: 161
Joined: Thu Sep 25, 2008 7:04 pm
Location: France

Re: Networking Library

Postby funcoot on Mon Oct 27, 2008 1:19 am

Hey, I had an idea for a name, but it is generic. "LÖVE CÖNNECTION"

Anyways I also a had another proposition. If you can actually get this project off the ground with a working example in a game, I would be happy to contribute a web site. If I had the free time. I do web design.
funcoot
Prole
 
Posts: 1
Joined: Mon Oct 27, 2008 1:17 am

Re: Networking Library

Postby bartbes on Mon Oct 27, 2008 12:27 pm

Yeah, this topic actually started at http://love2d.org/forum/viewtopic.php?f=3&t=225, I was talking about a game there too.
And as I said there, I'm not going to code an entire game myself (as I just plain suck at graphics), however I would help as much as possible when (NOT IF!) someone starts a project.
And this will actually help this lib <insert name here>, because the best way to create a library is by actually using it.
So.. volunteers?

@funcoot: noted the name suggestion, I'll wait for a little longer and start a poll
Cowardly acts and the eating of birds must not be the deeds of a Hero of Storms.
User avatar
bartbes
Sex machine
 
Posts: 4517
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands

Next

Return to Projects and Demos

Who is online

Users browsing this forum: No registered users and 3 guests