• The New Net Library
    94 replies, posted
  • Avatar of DylanWilson
  • [QUOTE=twoski;33480819]Updated the OP with more recent code and examples.[/QUOTE] awesome, thank you sir. out of curiosity, is there only a send to player function? or is there anything similar to recipient filters from usermessages?
  • Avatar of -TB-
  • Garry already said there will be a way to send to a player, send to multiple players, send to all players, and don't send to specific players.
  • [QUOTE=DylanWilson;33481118]awesome, thank you sir. out of curiosity, is there only a send to player function? or is there anything similar to recipient filters from usermessages?[/QUOTE] There is net.SendOmit although i have not tried messing with it yet. I'll take a look in a bit.
  • Avatar of Deco Da Man
  • I'm having difficulty with the net.Send* functions. A test on a server with two players: [code] lua_run player.GetAll()[1]:SendLua("net.Receive('abc',function(l)RunConsoleCommand('say','abc:'..l)end)") > player.GetAll()[1]:SendLua("net.Receive('abc',function(l)RunConsoleCommand('say','abc:'..l)end)")... lua_run player.GetAll()[2]:SendLua("net.Receive('abc',function(l)RunConsoleCommand('say','abc:'..l)end)") > player.GetAll()[2]:SendLua("net.Receive('abc',function(l)RunConsoleCommand('say','abc:'..l)end)")... > lua_run net.Start("abc") net.Broadcast() > net.Start("abc") net.Broadcast()... Deco: abc:16 Chewgum: abc:16 > lua_run net.Start("abc") net.Send() > net.Start("abc") net.Send()... > lua_run net.Start("abc") net.Send(Player(1)) > net.Start("abc") net.Send(Player(1))... > lua_run net.Start("abc") net.Send(Player(2)) > net.Start("abc") net.Send(Player(2))... Deco: abc:16 Chewgum: abc:16 > lua_run net.Start("abc") net.Send(Entity(1)) > net.Start("abc") net.Send(Entity(1))... Deco: abc:16 Chewgum: abc:16 > lua_run net.Start("abc") net.Send(Entity(2)) > net.Start("abc") net.Send(Entity(2))... Deco: abc:16 Chewgum: abc:16 > lua_run net.Start("abc") net.Send({Player(1)}) > net.Start("abc") net.Send({Player(1)})... Deco: abc:16 Chewgum: abc:16 > lua_run net.Start("abc") net.Send({Player(2)}) > net.Start("abc") net.Send({Player(2)})... Deco: abc:16 Chewgum: abc:16 > lua_run net.Start("abc") net.Send({}) > net.Start("abc") net.Send({})... Deco: abc:16 Chewgum: abc:16 > lua_run net.Start("abc") net.Send(nil) > net.Start("abc") net.Send(nil)... > lua_run net.Start("abc") net.Send(1) > net.Start("abc") net.Send(1)... > lua_run net.Start("abc") net.Send(1337) > net.Start("abc") net.Send(1337)... > lua_run net.Start("abc") net.Send(true) > net.Start("abc") net.Send(true)... > lua_run net.Start("abc") net.SendOmit({}) > net.Start("abc") net.SendOmit({})... Deco: abc:16 Chewgum: abc:16 > lua_run net.Start("abc") net.SendOmit({Player(1)}) > net.Start("abc") net.SendOmit({Player(1)})... Deco: abc:16 Chewgum: abc:16 [/code] There seems to be no way to send to a specific set of players. I've tried CRecipientFilters too. Are these functions not working yet?
  • Avatar of Hugabuga
  • So basicly the Net Library is a improved "datastream"? Sadly I haven't got a Beta key, as I can't fix some stuff that I'm using datastream for. (Sending pretty big text shit, ya'll know..)
  • Avatar of Deco Da Man
  • [QUOTE=Persious;33490783]So basicly the Net Library is a improved "datastream"?[/QUOTE] net.WriteTable is like a new datastream, but the rest of the library is like the old usermessage system.
  • Avatar of garry
  • net.Send and SendOmit should take a { ply, ply, ply } or just a ply If it doesn't then post a bug in the beta forum
  • Avatar of DylanWilson
  • awesome, thanks garry. any general guestimate on a release date so I can know when to start fixing my gamemode?
  • Avatar of TheJjokerR
  • [QUOTE=Drew P. Richard;33492027]I'm sorry if this has been asked before, but are you replacing usermessage with the net library as well?[/QUOTE] I was wondering this, is the net library faster for short messages as well? Or should we continue to use usermessages for that?
  • Avatar of pennerlord
  • [QUOTE=thejjokerr;33492123]I was wondering this, is the net library faster for short messages as well? Or should we continue to use usermessages for that?[/QUOTE] I don't know if the are faster but they have an increased max data limit.
  • Avatar of lexic
  • He said somewhere that they're sent instantly, whereas user messages are sent on frame updates. (afaik) I also suspect that a lot of small net messages will lag less than a lot of small umsgs, which will be nice. Incidentally, has the NWVar system been moved from umsgs to this new system?
  • Avatar of TheJjokerR
  • By the way I couldn't find this in the thread anywhere, but the net.Receive callback is actually also gives another variable, which is a table: [CODE]1 = Player [1][[RV] TJjokerR] n = 1[/CODE] The sending player and something else?
  • Avatar of TheJjokerR
  • [QUOTE=maurits150;33494572]The n probably means the number of variables send.[/QUOTE] No matter how many variables I send it stays at 1.
  • Avatar of FPtje
  • [QUOTE=maurits150;33494572]The n probably means the number of variables send.[/QUOTE] [url=http://www.facepunch.com/threads/1089200?p=32974347&viewfull=1#post32974347]Number of bytes.[/url]
  • Avatar of TheJjokerR
  • [QUOTE=FPtje;33494717][url=http://www.facepunch.com/threads/1089200?p=32974347&viewfull=1#post32974347]Number of bytes.[/url][/QUOTE] Updated my post sorry, what I meant is that it's given a table which contains 2 variables. The player and "n", which always seems to be 1.
  • [QUOTE=DylanWilson;33491965]awesome, thanks garry. any general guestimate on a release date so I can know when to start fixing my gamemode?[/QUOTE] Post whatever code relies on usermessages or datastream and i could convert it to use the net library if you want. It's actually really easy. [QUOTE=Drew P. Richard;33492027]I'm sorry if this has been asked before, but are you replacing usermessage with the net library as well?[/QUOTE] It's a bit redundant seeing as the net library is basically like usermessages 2.0, but if usermessages were removed it would probably break every older script that sends things to clients. So usermessages will be there for legacy support more or less.
  • Avatar of TheJjokerR
  • [QUOTE=Banana Lord.;33496711]So can I use RecipientFilter here or is there some sort of filtering thing I missed[/QUOTE] [QUOTE=garry;33491924]net.Send and SendOmit should take a { ply, ply, ply } or just a ply If it doesn't then post a bug in the beta forum[/QUOTE]
  • Avatar of Drew P. Richard
  • Are there any future plans to make it use RecipientFilter? Or is there a way to get members of a RecipientFilter? I'm planning to make usermessages and datastream use the net library and they both can take them in.
  • Avatar of lorde banana
  • From what I saw earlier today it's still there, but I haven't tested it yet. I think Drakehawke came to the conclusion that it didn't though
  • Avatar of TheJjokerR
  • [QUOTE=Drew P. Richard;33497132]Are there any future plans to make it use RecipientFilter? Or is there a way to get members of a RecipientFilter? I'm planning to make usermessages and datastream use the net library and they both can take them in.[/QUOTE] I'd just override the recipientfilter metatable to store added players so you can get them later.
  • Avatar of Drew P. Richard
  • [QUOTE=thejjokerr;33497316]I'd just override the recipientfilter metatable to store added players so you can get them later.[/QUOTE] Ah shit you're right, I'm not thinking straight, thanks!
  • [QUOTE=garry;33491924]net.Send and SendOmit should take a { ply, ply, ply } or just a ply If it doesn't then post a bug in the beta forum[/QUOTE] Will it support PVS and PAS? Maybe net.SendPVS() and net.SendPAS()?
  • Avatar of CmdrMatthew
  • [QUOTE=Jinto;33498446]Will it support PVS and PAS? Maybe net.SendPVS() and net.SendPAS()?[/QUOTE] It already does support PVS.