1. Post #41
    Drew P. Richard's Avatar
    April 2010
    760 Posts
    I'm sorry if this has been asked before, but are you replacing usermessage with the net library as well?

  2. Post #42
    ASK ME ABOUT MY SAM 6420 FETISH
    ArmageddonScr's Avatar
    July 2011
    691 Posts
    He's keeping the usermessage library as far as I know.

    edit: But removing datastream
    Reply With Quote Edit / Delete Reply Windows XP United States Show Events Agree Agree x 2Informative Informative x 1 (list)

  3. Post #43
    Gold Member
    thejjokerr's Avatar
    December 2007
    2,146 Posts
    I'm sorry if this has been asked before, but are you replacing usermessage with the net library as well?
    I was wondering this, is the net library faster for short messages as well? Or should we continue to use usermessages for that?
    Reply With Quote Edit / Delete Reply Windows 7 Netherlands Show Events Agree Agree x 1 (list)

  4. Post #44
    pennerlord's Avatar
    February 2011
    504 Posts
    I was wondering this, is the net library faster for short messages as well? Or should we continue to use usermessages for that?
    I don't know if the are faster but they have an increased max data limit.
    Reply With Quote Edit / Delete Reply Windows 7 Germany Show Events Agree Agree x 1 (list)

  5. Post #45
    Gold Member
    Lexic's Avatar
    March 2009
    6,123 Posts
    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?
    Reply With Quote Edit / Delete Reply Windows 7 United Kingdom Show Events Informative Informative x 2 (list)

  6. Post #46
    Gold Member
    thejjokerr's Avatar
    December 2007
    2,146 Posts
    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
    The sending player and something else?

  7. Post #47
    Gold Member
    maurits150's Avatar
    February 2007
    1,818 Posts
    The n probably means the number of variables send.
    Reply With Quote Edit / Delete Reply Windows 7 Netherlands Show Events Disagree Disagree x 1 (list)

  8. Post #48
    Gold Member
    thejjokerr's Avatar
    December 2007
    2,146 Posts
    The n probably means the number of variables send.
    No matter how many variables I send it stays at 1.

  9. Post #49
    Get your own DarkRP Server!
    FPtje's Avatar
    January 2006
    5,726 Posts
    The n probably means the number of variables send.
    Number of bytes.
    Reply With Quote Edit / Delete Reply Windows 7 Netherlands Show Events Disagree Disagree x 1 (list)

  10. Post #50
    Gold Member
    thejjokerr's Avatar
    December 2007
    2,146 Posts
    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.

  11. Post #51
    I hide under your bed
    Dennab
    July 2011
    1,877 Posts
    awesome, thanks garry.

    any general guestimate on a release date so I can know when to start fixing my gamemode?
    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.

    I'm sorry if this has been asked before, but are you replacing usermessage with the net library as well?
    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.

  12. Post #52
    Gold Banana
    Banana Lord.'s Avatar
    May 2010
    6,852 Posts
    So can I use RecipientFilter here or is there some sort of filtering thing I missed
    Reply With Quote Edit / Delete Reply Windows 7 United States Show Events Dumb Dumb x 1 (list)

  13. Post #53
    Gold Member
    thejjokerr's Avatar
    December 2007
    2,146 Posts
    So can I use RecipientFilter here or is there some sort of filtering thing I missed
    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
    Reply With Quote Edit / Delete Reply Windows 7 Netherlands Show Events Agree Agree x 2 (list)

  14. Post #54
    Gold Banana
    Banana Lord.'s Avatar
    May 2010
    6,852 Posts
    Pfff, RecipientFilter was cooler
    Reply With Quote Edit / Delete Reply Windows 7 United States Show Events Disagree Disagree x 7Agree Agree x 1Dumb Dumb x 1 (list)

  15. Post #55
    Drew P. Richard's Avatar
    April 2010
    760 Posts
    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.
    Reply With Quote Edit / Delete Reply Windows 7 United States Show Events Agree Agree x 1Funny Funny x 1 (list)

  16. Post #56
    Gold Banana
    Banana Lord.'s Avatar
    May 2010
    6,852 Posts
    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
    Reply With Quote Edit / Delete Reply Windows 7 United States Show Events Dumb Dumb x 1 (list)

  17. Post #57
    Gold Member
    thejjokerr's Avatar
    December 2007
    2,146 Posts
    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.
    I'd just override the recipientfilter metatable to store added players so you can get them later.
    Reply With Quote Edit / Delete Reply Netherlands Show Events Lua Helper Lua Helper x 2 (list)

  18. Post #58
    Drew P. Richard's Avatar
    April 2010
    760 Posts
    I'd just override the recipientfilter metatable to store added players so you can get them later.
    Ah shit you're right, I'm not thinking straight, thanks!

  19. Post #59
    dill pickle pringle EXTREME

    May 2005
    479 Posts
    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
    Will it support PVS and PAS? Maybe net.SendPVS() and net.SendPAS()?
    Reply With Quote Edit / Delete Reply Windows 7 United States Show Events Late Late x 1 (list)

  20. Post #60
    CmdrMatthew's Avatar
    August 2010
    1,181 Posts
    Will it support PVS and PAS? Maybe net.SendPVS() and net.SendPAS()?
    It already does support PVS.
    Reply With Quote Edit / Delete Reply Windows 7 United States Show Events Agree Agree x 1 (list)

  21. Post #61
    DylanWilson's Avatar
    January 2010
    273 Posts
    Will it support PVS and PAS? Maybe net.SendPVS() and net.SendPAS()?
    check the comments on my profile, twoski put a dump of the net library there, PAS and PVS are implemented

    (thanks twoski)

  22. Post #62
    Gold Banana
    Banana Lord.'s Avatar
    May 2010
    6,852 Posts
    And PAS


  23. Post #63
    dill pickle pringle EXTREME

    May 2005
    479 Posts
    It already does support PVS.
    Excellent.
    Reply With Quote Edit / Delete Reply Windows 7 United States Show Events Winner Winner x 2 (list)

  24. Post #64
    L33T Lau Coder
    Science's Avatar
    April 2011
    1,813 Posts
    [h2]Im Currently Working On The Wiki Page If Anyone Wants To Help[/h2]

    http://wiki.garrysmod.com/?title=Net
    Reply With Quote Edit / Delete Reply Windows 7 United Kingdom Show Events Winner Winner x 2Friendly Friendly x 2Optimistic Optimistic x 1 (list)

  25. Post #65
    Get your own DarkRP Server!
    FPtje's Avatar
    January 2006
    5,726 Posts
    I know PVS, but what is PAS?

  26. Post #66
    L33T Lau Coder
    Science's Avatar
    April 2011
    1,813 Posts
    I know PVS, but what is PAS?
    PVS and PAS, what are they both?

  27. Post #67
    garry's Avatar
    September 2001
    12,435 Posts
    PVS is what you can see from that spot, PAS is what you can hear from that spot
    Reply With Quote Edit / Delete Reply Windows 7 Show Events Informative Informative x 8Lua King Lua King x 1Winner Winner x 1 (list)

  28. Post #68
    L33T Lau Coder
    Science's Avatar
    April 2011
    1,813 Posts
    PVS is what you can see from that spot, PAS is what you can hear from that spot
    Oh my god. You just made me cum a little.

    This is amazing.
    Reply With Quote Edit / Delete Reply Windows 7 United Kingdom Show Events Optimistic Optimistic x 6Agree Agree x 3Dumb Dumb x 1 (list)

  29. Post #69
    dill pickle pringle EXTREME

    May 2005
    479 Posts
    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
    The sending player and something else?
    Programming in Lua: 19.1 - Array Size posted:
    Usually, a call table.setn(t, n) associates t with n in an internal (weak) table and a call table.getn(t) retrieves the value associated with t in that internal table. However, if the table t has a field "n" with a numeric value, setn updates this value and getn returns it. The getn function still has a last option: If it cannot get an array size with any of those options, it uses the naive approach: to traverse the array looking for its first nil element. So, you can always use table.getn(t) in an array and get a reasonable result.
    Reply With Quote Edit / Delete Reply Windows 7 United States Show Events Informative Informative x 1 (list)

  30. Post #70

    February 2010
    31 Posts
    Would anyone know what would cause the following behavior?

    Net lib wont start sending messages (from server) until I execute sv_allowdownload 1 in server console. This was tested in both listen and dedicated, where download was allowed in both upon start-up of the server.

    net.Send( ply ) sending net message to all players on server? ply being one player entity.


    I'm just wondering if anyone is experiencing anything similar while I continue to comb my gamemode for anything I have done incorrectly.

    edit:

    This actually just seems to affect the first player that connects, subsequent players start receiving net messages, but messages sent to a single player still seem to be broadcasted.

  31. Post #71

    February 2010
    31 Posts
    Sending a Table that contains a Table in Net lib causes the sub table to be sent as a number (258)

    Also seems to not send empty tables {}, can be annoying when sending tables structures.
    Reply With Quote Edit / Delete Reply Windows 7 Canada Show Events Agree Agree x 1 (list)

  32. Post #72
    Gold Member
    thejjokerr's Avatar
    December 2007
    2,146 Posts
    Sending a Table that contains a Table in Net lib causes the sub table to be sent as a number (258)

    Also seems to not send empty tables {}, can be annoying when sending tables structures.
    Sends as a different number for me, I think it's taking a character from the key string and converts it to the numerical code.

    Didn't report it as Garry said he was still working on it.

  33. Post #73

    February 2010
    31 Posts
    Sends as a different number for me, I think it's taking a character from the key string and converts it to the numerical code.

    Didn't report it as Garry said he was still working on it.
    http://www.facepunch.com/threads/114...1#post33504343

  34. Post #74
    Gold Member
    thejjokerr's Avatar
    December 2007
    2,146 Posts
    Yes. I figured that out, but when I:
    - SetType on the server (for a table)
    - read the byte on the client to check if it's a table and then net.ReadTable() it should work fine, instead it breaks at the recursive table where it gets a larger number as an index for the net.ReadVars then it should be.

    It's late, so sorry if that didn't make sense.

  35. Post #75
    quality poster
    Dennab
    August 2009
    12,242 Posts
    I have two net messages that are sent to the clients by the server.

    Code:
    net.Receive("UpdateRoundInfo", function(size)
    	ROUND_TIME = net.ReadFloat()
    	ROUND_NUMBER = net.ReadFloat()
    	print(ROUND_NUMBER)
    end)
    
    net.Receive("StartRound", function(size)
    	ROUND_TIME = net.ReadFloat()
    	ROUND_NUMBER = net.ReadFloat()
    	RoundStart()
    	print(ROUND_NUMBER)
    end)
    Here's the code I'm using to call them:

    Code:
    if ROUND_NUMBER == 0 and #player.GetAll() >= MINIMUM_PLAYERS then
    			net.Start("StartRound")
    			net.WriteFloat(ROUND_TIME)
    			net.WriteFloat(ROUND_NUMBER)
    			net.Broadcast()
    			RoundStart()
    			print("A")
    		else
    			net.Start("UpdateRoundInfo")
    			net.WriteFloat(ROUND_TIME)
    			net.WriteFloat(ROUND_NUMBER)
    			net.Broadcast()
    			print("B")
    		end
    The net message SHOULD be sent, because the server prints both A and B when they should be called.
    The client prints the round number (So it is receiving) "UpdateRoundInfo", but "RoundStart" is never called.
    I've tried printing "HI" and stuff like that, so it's not a matter of ROUND_NUMBER being nil.

    No errors or nothing it's driving me absolutely insane, plus I can't even check the Wiki since it decided to go down for a few hours.

  36. Post #76

    February 2010
    31 Posts
    My problem is similar Kopimi,

    May not be related but try issuing sv_allowdownload 1 on the server console, before sending begin round net message. I found doing this (or reconnecting) tended to make the unsent net messages suddenly start sending/receiving.

  37. Post #77
    [h2]Im Currently Working On The Wiki Page If Anyone Wants To Help[/h2]

    http://wiki.garrysmod.com/?title=Net
    Learn to spell receive please. I recreated the page Net.Receive because you had plenty of typos that would confuse people as to why net.recieve wouldn't work.

    Also I improved your example .
    Reply With Quote Edit / Delete Reply Windows 7 United Kingdom Show Events Funny Funny x 2 (list)

  38. Post #78
    MoronYard
    _nonSENSE's Avatar
    May 2010
    1,266 Posts
    It also doesn't only take a unique identifier as it's argument. It takes an identifier and a function, just like usermessage.Hook. It doesn't return a number either.
    Those inconsistencies tend to bug me...

  39. Post #79
    Cleaned up the page a bit more.
    Reply With Quote Edit / Delete Reply Windows 7 United Kingdom Show Events Friendly Friendly x 3 (list)

  40. Post #80
    Kamshak's Avatar
    July 2008
    438 Posts
    on net.Receive serverside, is there a way to know from which client the message originated? That would be good to know