• Personal NWvars replacement
    47 replies, posted
[QUOTE=wizardsbane;35758832]It's not [I]me[/I]. Oh! Heavens no. I'm just putting forth that if such a practise doesn't cripple or harm the systems and clients it interacts with, it shouldn't be demonised or decried so quickly. This is not to say that I'm going to look at someone's code sending a 32 byte object every tick and think "a deity must have coded this amazing block of text." I can see where you and DarkSunrise are coming from, and I agree: no one should ever need to send 32 bytes of data every tick, but actually doing so is somewhat valid as it has no real negative impact on the systems or clients that it functions on.[/QUOTE] the point isn't that it doesn't impact users, it's bad practice and still a waste of bandwidth.
[QUOTE=Banana Lord.;35760967]the point isn't that it doesn't impact users, it's bad practice and still a waste of bandwidth.[/QUOTE] Yeah. Like I said, I'm agreeing to this. However, as you admit it has no impact, it is still valid to use. It may not be a [I]proper[/I], [I]pragmatic[/I], or [I]effective[/I] use, but it is still acceptable to utilise fully.
[QUOTE=wizardsbane;35761478]Yeah. Like I said, I'm agreeing to this. However, as you admit it has no impact, it is still valid to use. It may not be a [I]proper[/I], [I]pragmatic[/I], or [I]effective[/I] use, but it is still acceptable to utilise fully.[/QUOTE] My last statement to this extremely dumb argument, but I never said it had no impact. Once again the impact is wasted bandwidth, processing time, and bad practices.
[QUOTE=Banana Lord.;35764322]My last statement to this extremely dumb argument, but I never said it had no impact. Once again the impact is wasted bandwidth, processing time, and bad practices.[/QUOTE] I suppose it's extremely dumb, because it's impossible for there to be alternatives to your mode of thought. You continue to say that it has no actual impact, and then turn around and say that its impact is "wasted" bandwidth. What is "wasted" supposed to mean, exactly? If the use of all 32 bytes does not impact performance or completely cripple the connection involved, this argument is completely irrelevant. The same applies to the "wasted processing time" argument. If there isn't an impact, there isn't an impact. It doesn't matter if it's inefficient or not. The viability of using all 32 bytes should be determined on its impact, not on whether it's a programming pearl or not is all I'm saying.
Can someone point out where am I sending 32 bytes of data every tick? Also Banana Lord, read the OP. You voted me boxes just because you don't like my script. [editline]30th April 2012[/editline] Is there gonna be any difference if I use usermessages? Also do you think that client side NW Vars should stay client side? [editline]30th April 2012[/editline] Updated code. I added a third argument: 1. If you don't parse anything as a third argument server-side stuff will be sent using user messages, else it would be sent via net message; 2. If you don't parse anything as a third argument client-side the nwvars you set will stay client-side, else it will be sent to the server and then to all clients. Note: SetNWString [I]is going [/I]to use net library if the string is 255 bytes or more when sending strings to clients no matter what. It is also going to use net.* library under certain conditions (it calculates lengths). I think everybody should be satisfied now.
[QUOTE=wizardsbane;35765247]I suppose it's extremely dumb, because it's impossible for there to be alternatives to your mode of thought. You continue to say that it has no actual impact, and then turn around and say that its impact is "wasted" bandwidth. What is "wasted" supposed to mean, exactly? If the use of all 32 bytes does not impact performance or completely cripple the connection involved, this argument is completely irrelevant. The same applies to the "wasted processing time" argument. If there isn't an impact, there isn't an impact. It doesn't matter if it's inefficient or not. The viability of using all 32 bytes should be determined on its impact, not on whether it's a programming pearl or not is all I'm saying.[/QUOTE] Even the smallest amount of waste is bad. What happens when a server installs 20 addons that each waste a little network bandwidth? That small waste adds up, especially when the server has a lot of players on it. If you can make it more bandwidth efficient, do it. Don't waste bandwidth just because it's easier. Your script/addon/gamemode/whatever has to share bandwidth with other addons.
Is there anything stating that the net library actually utilizes all of its network capacity if the message itself doesn't amount to that? If there is then I agree that for small things, umsg would be better for efficiency's sake. But, seeing as net.Receive tells you the length of the message, I'm led to believe that net only sends messages the appropriate size for the data within. Which means that it should be the preferred method of networking. edit: If the case is true that net does utilize all it has, there's still a point where even for small things umsg shouldn't be used. Whether or not individual bits of data are small, given the count of those individual bits of data, net would propose a smaller impact on cpu usage. One net message or 100 usermessages?
[QUOTE=Jcw87;35801957]Even the smallest amount of waste is bad. What happens when a server installs 20 addons that each waste a little network bandwidth? That small waste adds up, especially when the server has a lot of players on it. If you can make it more bandwidth efficient, do it. Don't waste bandwidth just because it's easier. Your script/addon/gamemode/whatever has to share bandwidth with other addons.[/QUOTE] Yeah, I totally agree. What I'm saying is, and this point is really in the details and not just the general point that Banana Lord kept pushing against me (which I understood and agreed to three posts ago) is that: while the practise wastes and is not the most efficient route of going about things, it's not a completely invalid method of getting things done. 256 bits is nothing when even the most basic 1Mbit connection can handle 1,000,000 bits. 256 bits is 0.03% of 1MBit. The impacts and waste being levied against ever using the practise are just code efficiency and programming pearl related concerns, they're not presenting any sort of real-world impact. The practise is entirely legitimate, even if it is inefficient, wasteful, and not suggested is all I'm saying.
[QUOTE=Jcw87;35801957]Even the smallest amount of waste is bad. What happens when a server installs 20 addons that each waste a little network bandwidth? That small waste adds up, especially when the server has a lot of players on it. If you can make it more bandwidth efficient, do it. Don't waste bandwidth just because it's easier. Your script/addon/gamemode/whatever has to share bandwidth with other addons.[/QUOTE] Jcw, you are an awesome coder (I have seen your projects). Could you point out my mistakes and suggest a solution? [editline]3rd May 2012[/editline] [QUOTE=KingofBeast;35802166]Is there anything stating that the net library actually utilizes all of its network capacity if the message itself doesn't amount to that? If there is then I agree that for small things, umsg would be better for efficiency's sake. But, seeing as net.Receive tells you the length of the message, I'm led to believe that net only sends messages the appropriate size for the data within. Which means that it should be the preferred method of networking. edit: If the case is true that net does utilize all it has, there's still a point where even for small things umsg shouldn't be used. Whether or not individual bits of data are small, given the count of those individual bits of data, net would propose a smaller impact on cpu usage. One net message or 100 usermessages?[/QUOTE] I have added the 3rd arguments so that you can chose between umsg and net. Although if net messages are more efficent I will make the net messages a default option but I don't know if they are.
[QUOTE=wizardsbane;35802171]Yeah, I totally agree. What I'm saying is, and this point is really in the details and not just the general point that Banana Lord kept pushing against me (which I understood and agreed to three posts ago) is that: while the practise wastes and is not the most efficient route of going about things, it's not a completely invalid method of getting things done. 256 bits is nothing when even the most basic 1Mbit connection can handle 1,000,000 bits. 256 bits is 0.03% of 1MBit. The impacts and waste being levied against ever using the practise are just code efficiency and programming pearl related concerns, they're not presenting any sort of real-world impact. The practise is entirely legitimate, even if it is inefficient, wasteful, and not suggested is all I'm saying.[/QUOTE] You are assuming that those 32 bytes would only be sent once per second. With an actual server, you you are going to have many players who also need a copy of the data. If the data needs constant updating, it could be sent 20, 33, or even 66 times per second, depending on how you are sending the data and how the server is configured. Include several instances of this data (such as entities), and the amount of data per second starts to get significantly higher very quickly, creating a [i]real-world impact[/i]. This is why it is important to only give clients the absolute minimal amount of data that you can get away with, and only when they absolutely need it.
Guys, not being offensive, STOP arguing about some 32 bytes of data and please point out why and where my script is inefficent.
They already pointed out why your code is inefficient.
You guys to seem be assuming umsg is faster, so ill just leave this here for you.... [url]http://facepunch.com/threads/1181378?p=35809824&viewfull=1#post35809824[/url]
Can they point the block of code which is inefficent again cause I kinda lost this part of the thread due to like 3 people complaining over someone sending 32 bytes of data every second (I thought it was me but I'm not doing so). It would be good if the people that find my code inefficent suggest an efficent solution (like Divran did). Also I updated the server side code so now net messages are the default option. I have left the 3rd argument for all the umsg lovers.
Having an option to use either umsg or the net library makes it less efficient (although not a lot). And there's really no reason to have this option. Ignore the haters and choose whichever one you like more. :)
Suggestion: Add a check to not send the data again if it hasn't changed. And remove umsg.
Thanks for the feedback guys. I'm thinking of making a system that checks if the client is missing any data but I think it won't be efficent. My idea is to make it so that when you use GetNWBlah and the client is missing this nwvar it sends a request to the server. Also I will remove umsg right now, since garry himself said in the thread I created that the net library is faster. [editline]4th May 2012[/editline] Great news. Google are being dicks and I used google account to login to pastebin. Now for some reason it doesn't let me login and wants me to create a new account... [editline]4th May 2012[/editline] Ok, managed to log in. Updated server-side code.
Added Divran and MadDog to the credits list. You deserve it guys. Sorry for double post, I expected something else to happen.
Sorry, you need to Log In to post a reply to this thread.