![]() |
Adding /roll - Printable Version +- Limelight Forums (https://limelightgaming.net/forums) +-- Forum: Feedback (https://limelightgaming.net/forums/forum-612.html) +--- Forum: Suggestions (https://limelightgaming.net/forums/forum-239.html) +---- Forum: Finished (https://limelightgaming.net/forums/forum-242.html) +---- Thread: Adding /roll (/thread-5783.html) Pages:
1
2
|
Re: Adding /roll - Rayts5 - Aug 26, 2015 (Aug 26, 2015, 03:36 PM)Voluptious link Wrote: [quote author=Rayts5 link=topic=1167.msg12981#msg12981 date=1440595827] Its easier to read and debug if you do it this way, I do things like this aswell [/quote] It is, but you are moving a var to a register which is slower than just calling the retrieved thing itself. There is no need to store more stuff to our base pointer. Re: Adding /roll - Lord Octagon - Aug 26, 2015 (Aug 26, 2015, 03:38 PM)Rayts5 link Wrote: [quote author=Voluptious link=topic=1167.msg12983#msg12983 date=1440596209] Its easier to read and debug if you do it this way, I do things like this aswell [/quote] It is, but you are moving a var to a register which is slower than just calling the retrieved thing itself. There is no need to store more stuff to our base pointer. [/quote] ![]() What are you on about. All these words. What's a 'var', can you eat it? Re: Adding /roll - Spai - Aug 26, 2015 (Aug 26, 2015, 03:30 PM)Rayts5 link Wrote: ... What? Why are you utilizing two network variables for this? It does not give sense any sense, you are making the server handle both net.Receive and net.Start lol. I'll go at it piece by piece since there are a few things, one thing first by no means in this script perfect and I pretty happy someone actually decided to say there was something wrong with it. Because it is by no means perfect. Also if I misunderstand you throughout the post my bad, just correct me again ^^ I presume you're talking about the net library when you say I'm handling two network variables server side. There is a if SERVER check so net strings at cached on the server and the receivers are set up on the client side. So I'm not really sure what you are getting at there. I think I have a rough idea looking at it again. I think you're talking about the use of two net strings which I agree is completely unnecessary (mentioned in comments iirc) that's due to me rethinking how it was going to be done mid way, but it doesn't make much difference performance wise. I'll make the change anyways. I'm not networking any variables on the player, they are being index to the player. This is done so we can get there last roll if for some reason chat is cleared or the player intended to receive the role didn't see it. Literally what you describe is done next. There are two console commands, (there could be one but I was lazy, check comments ^^) that handle the rolling server side. So as you said I am storing the variable on the player and it is not being networked. There is actually another mistake I noticed thanks for pointing it out thought I changed it. You currently cannot see who rolled, I thought I add the players name to the start. Either way you are correct here and it servers no other use than being easier to change and read. On the note of overflowing the stack with the creation of tables. We don't have to worry about shit like that fortunately as lua runs it's gc periodically getting rid of variables it can no longer access (iirc? Correct me if need be). Though saying that your way would be better, as far I'm aware though there will be no noticeable performance difference. I don't have a great deal of knowledge in low level programming, I'd love to learn and will probably start more when I get back. Thanks for the heads up with your points I'll make a second version incorporating your ideas. I'll post it I'm the next few days depending on timings etc.. Sorry if this came off the wrong way, this was all typed on my phone so it's hard to read back and make changes. Anyways thanks for the help I'll post a new version soonish Re: Adding /roll - Rayts5 - Aug 26, 2015 (Aug 26, 2015, 04:42 PM)Lord Octagon link Wrote: [quote author=Rayts5 link=topic=1167.msg12984#msg12984 date=1440596281] Its easier to read and debug if you do it this way, I do things like this aswell [/quote] It is, but you are moving a var to a register which is slower than just calling the retrieved thing itself. There is no need to store more stuff to our base pointer. [/quote] ![]() What are you on about. All these words. What's a 'var', can you eat it? [/quote] Low level programming, don't you worry. ![]() (Aug 26, 2015, 05:08 PM)Spy link Wrote: [quote author=Rayts5 link=topic=1167.msg12981#msg12981 date=1440595827] I'll go at it piece by piece since there are a few things, one thing first by no means in this script perfect and I pretty happy someone actually decided to say there was something wrong with it. Because it is by no means perfect. Also if I misunderstand you throughout the post my bad, just correct me again ^^ I presume you're talking about the net library when you say I'm handling two network variables server side. There is a if SERVER check so net strings at cached on the server and the receivers are set up on the client side. So I'm not really sure what you are getting at there. I think I have a rough idea looking at it again. I think you're talking about the use of two net strings which I agree is completely unnecessary (mentioned in comments iirc) that's due to me rethinking how it was going to be done mid way, but it doesn't make much difference performance wise. I'll make the change anyways. I'm not networking any variables on the player, they are being index to the player. This is done so we can get there last roll if for some reason chat is cleared or the player intended to receive the role didn't see it. Literally what you describe is done next. There are two console commands, (there could be one but I was lazy, check comments ^^) that handle the rolling server side. So as you said I am storing the variable on the player and it is not being networked. There is actually another mistake I noticed thanks for pointing it out thought I changed it. You currently cannot see who rolled, I thought I add the players name to the start. Either way you are correct here and it servers no other use than being easier to change and read. On the note of overflowing the stack with the creation of tables. We don't have to worry about shit like that fortunately as lua runs it's gc periodically getting rid of variables it can no longer access (iirc? Correct me if need be). Though saying that your way would be better, as far I'm aware though there will be no noticeable performance difference. I don't have a great deal of knowledge in low level programming, I'd love to learn and will probably start more when I get back. Thanks for the heads up with your points I'll make a second version incorporating your ideas. I'll post it I'm the next few days depending on timings etc.. Sorry if this came off the wrong way, this was all typed on my phone so it's hard to read back and make changes. Anyways thanks for the help I'll post a new version soonish [/quote] It did not come out the wrong way at all. ^^ I might have been too sharp in my first comment too, in terms of reviewing the code. What I wanted to say, was the fact that it is not necessary to use the Net library at all as it can simply be stored on the player variable; concommands are usually handled server-side after all. I can however give a super thumbs up for continuing to improve the code. Some would see that it works, and then just carry on, despite its looks. I am not sure about how good the current gc is in Lua, but you are correct that a garbage collector removes variables which points to unused memory. If you need help with lower level programming, also, I can help you with it. Ever since I got into low level programming (several months ago), I have started to see everything at that level. Which, is also quite useful when coding C++. Re: Adding /roll - Spai - Aug 26, 2015 The net library use was purely so it could be outputted into chat for others to see (limited to those around) that was the only way of doing off the top of my head. I'm sure this gamemode has some built in functions to remove the need for mine, unfortunately I don't have any experience with this gamemode ![]() Re: Adding /roll - Rayts5 - Aug 26, 2015 (Aug 26, 2015, 05:54 PM)Spy link Wrote: The net library use was purely so it could be outputted into chat for others to see (limited to those around) that was the only way of doing off the top of my head. I'm sure this gamemode has some built in functions to remove the need for mine, unfortunately I don't have any experience with this gamemode Aaah, I see why you wanted to use the Net library then. You can grab all players in X radius around you, and SendLua the chat command too. EDIT: Christ I am tired, I missed the "else" and saw your net.Receive which means that it is handled on the client *nodnod*, it must have been due to the code tags on the forum... Thingy. Alright, that changes everything. Personally, I wouldn't add a network string for that task, but it can be done however. You can also turn it into one network string. The reason for why I wouldn't, is because the network library can handle up to a size of 64kb, aka 64000 characters. You won't need 64kb for that task. ![]() Re: Adding /roll - Spai - Aug 28, 2015 (Aug 26, 2015, 06:03 PM)Rayts5 link Wrote: Aaah, I see why you wanted to use the Net library then. You can grab all players in X radius around you, and SendLua the chat command too. Meh if I were to send a 64kb string there is a pretty large chance I'll overflow the net channel. Won't be a problem either way, latest version limits rolls. Using SendLua I'm this case will probably be more effort as it will lead to a lua injection. Anyways I implemented your suggestions regarding optimisations as well as fixing the issues are I mentioned earlier. Thanks of the help I credited you ^^. Code: -- Created by Spy (steamcommuntiy.com/id/Snappey) This should be good to go I *think* added a small list of todos mainly relating to the gamemode functions that I don't have access to. If anyone else notices any problems let me know I'll be happy to change it (or you can I don't mind, just leave credits in). Re: Adding /roll - Voluptious - Oct 3, 2015 Finished, live on next crash. Re: Adding /roll - Brynn - Oct 3, 2015 Moved and locked. |