| Mirage Source http://web.miragesource.net/forums/ |
|
| Socket.UBound http://web.miragesource.net/forums/viewtopic.php?f=201&t=2938 |
Page 1 of 1 |
| Author: | William [ Wed Oct 24, 2007 3:26 pm ] |
| Post subject: | Socket.UBound |
I know I asked this before, but I don't remember the answer. Why don't we use Code: for i=1 to socket.ubound instead of Code: for i=1 to MAX_PLAYERS ? |
|
| Author: | Lea [ Wed Oct 24, 2007 3:43 pm ] |
| Post subject: | Re: Socket.UBound |
why don't we? |
|
| Author: | William [ Wed Oct 24, 2007 4:13 pm ] |
| Post subject: | Re: Socket.UBound |
Dave wrote: why don't we? Was that some sarcastic thing or something xD ? |
|
| Author: | Matt [ Wed Oct 24, 2007 4:16 pm ] |
| Post subject: | Re: Socket.UBound |
William wrote: Dave wrote: why don't we? Was that some sarcastic thing or something xD ? Have you tested it at all to see if it works just as good? Maybe test it out on your next beta for K2H and give us some feedback. Or if you want, I can test it out on M:R. That seems to have players on quite a bit. It would prolly just be a matter of seeing how it reacts when you login, someone else logs in, you logout, and login again. |
|
| Author: | William [ Wed Oct 24, 2007 4:19 pm ] |
| Post subject: | Re: Socket.UBound |
I don't see why it wouldn't work since the uBound (upperbound I think it is). Gets the new index before highindex does if thats now added. Well it's pretty simple to test, so I might do it. Just wanted to know why people havn't thought of it before. Etc.. |
|
| Author: | Lea [ Wed Oct 24, 2007 5:15 pm ] |
| Post subject: | Re: Socket.UBound |
Thinking mroe about it The socket.ubound is determined in the server start to be = MAX_PLAYERS Therefore, they're teh same thign. |
|
| Author: | William [ Wed Oct 24, 2007 5:18 pm ] |
| Post subject: | Re: Socket.UBound |
Where exactly is that done? |
|
| Author: | Lea [ Wed Oct 24, 2007 5:20 pm ] |
| Post subject: | Re: Socket.UBound |
CAnt tell exactly, but probably when the Socket array is created. |
|
| Author: | Aranshada [ Wed Oct 24, 2007 5:54 pm ] |
| Post subject: | Re: Socket.UBound |
So simply create the socket array with only a single element in the beginning. Then when new sockets are needed, we can simply add a socket (with the MAX_PLAYERS simply setting a number that the server will not exceed). Then when someone disconnects, check to see what the highest socket number is that is in use, and unload all sockets above that number. Basically, you'd simply load sockets when you need them and unload the ones that you don't need (as long as they're not in the middle of the array... I made that mistake one time). Or you could just leave them loaded and not unload them. It'd still reduce the number of sockets you have loaded within the first moments of the server being up (depending on how popular the game is, if you never have more than 5 people at a time, then the server will never have more than 5 sockets loaded at a time... minus the listening socket which doesn't really count). |
|
| Author: | William [ Thu Oct 25, 2007 9:13 am ] |
| Post subject: | Re: Socket.UBound |
Eh, something is wrong with ubound. I made a server so people using rpg toolkit could play online. And ubound works there, but it doesn't seem to work in ms. I need to try a little more later. |
|
| Page 1 of 1 | All times are UTC |
| Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |
|