Coincidentally just answered a PM about this very subject. Simply put, I've perfected it using only the scripts\code we have available to us now, but it's buried in an incomplete version of GameOvermind, and is A LOT of work to rebuild (by another capable modder). What is best is for the devs to just add a function to the Lua-scripts to allow modders to set what num of slots will be sent out by the query-responder.
The system I had created does work (i think) and seems to work reasonably well, its just somewhat annoying for users as you can connect to the server and fully load into the game, only to get kicked about 2 seconds after (need to wait so that the client actually gets the message about being kicked for reserve slot). Without having any way to provide a message to a client on disconnect (kick/ban really needs this too), or a way to modify the query response (or interact with the client much earlier in the connection process) it will always remain a slightly quirky solution at best.
WyzcrakPot Pie AficionadoJoin Date: 2002-12-04Member: 10447Forum Moderators, Constellation, NS2 Playtester, Squad Five Blue
<b>UWE DEV Request:</b>
Please give modders an easy way to lie to people about a server's maximum slots. A setter/mutator method for manipulating the behind-the-scenes number your server engine is reporting to server queries would be <i>delicious</i>. (Correct me if I'm wrong, but) I think Build 216 gives us everything else we need to build a first-class reserved slots system.
<b>Rationale:</b>
Build 216 doesn't provide any Lua API for fabricating the number that's reported to server queries as the number of maximum slots. To build a proper reserved slots solution, you need to be able to lie, claiming you have one or two fewer available slots than you actually do.
I was thinking about writing a "proxy" application that would pretend to be an ns2 server, but really forward connections and queries to a real server. The idea was to implement a queuing system to join full servers for my <a href='index.php?showtopic=120313'>server browser</a>, but I think it could also be used to do reserved slots too.
If GameOvermind can already do a lot of this stuff, that'd be fantastic. Anyway if anyone would like to collaborate on something like this let me know.
ScardyBobScardyBobJoin Date: 2009-11-25Member: 69528Forum Admins, Forum Moderators, NS2 Playtester, Squad Five Blue, Reinforced - Shadow, WC 2013 - Shadow
+1
However, realistically UWE is unlikely to get to this anytime soon. You'll likely have to wait/rely on a mod (player's revised OM if/when it gets continued or Dragon's mod).
Though, if you could figure out how to write this in lua, UWE does accept community code submissions sometimes (its not guaranteed, however).
My reserve slot system is pretty hacky, because its all in lua. Without a way to intercept client connect early and/or lie about the maximum players I cannot think of a good way to do this. Currently mine lets the client connect fully before it can check their status, which it then sends a message if they will be kicked, and waits 2 seconds before kicking them. It also uses a buffer slot so that people can always connect, and needs to be configured with the maximum number of players on the server (since you cannot even read it in lua).
Here are the contents of a PM I sent earlier, describing my (perfected) method in more detail:
I did manage to perfect reserved-slots, but it required quite a bit of work to accomplish, and may be a bit out of most modders' league.
What I did is disable NS2's query-responder, replace it with my own on a different port, and build a mastergameserver-communicator on the same socket to make it show up in the serverbrowser-list. The code-base is in shambles at the moment, because I was rewriting the whole thing at the time I decided to stop due to lack of motivation, so I can't really help you out by providing snippets.
What you need to do: Disable NS2's query-responder (using the <a href="http://hg.opensteamworks.org/open-steamworks/src" target="_blank">Steam-API</a>). Learn how to use the <a href="http://www.lua.org/pil/index.html#P4" target="_blank">Lua C-API</a> (or use something like Luabind) Build a query-responder using the <a href="https://developer.valvesoftware.com/wiki/Server_queries" target="_blank">SourceEngine-protocol</a>. Build a MasterServer-Communicator (<a href="https://developer.valvesoftware.com/wiki/Master_Server_Query_Protocol#Game_server_to_master_server" target="_blank">protocol</a>).
It's a ton of work to do from scratch, the unreleased GameOvermind is over 100.000 lines large using a dozen libraries. It's probably easier to maybe ask Max (or another UWE developer) to just introduce a SetMaxSlots-function to the Lua-scripts.
i didnt relize i wood get so much feed back me and my fello clan members donot want to do any 3ed party stuff with the server just if ns2 allready had sumthing to help wih my problem im amased a dev wood post in hear and if any 1 wants to come play with us im the leader of oNoes and atm our server is 1 of the most populat in australia we are trying to get in to the pro sean we v MR on sunday best of for they beat us but we has sume glichy isheys and olney got to play 2 games im loveing this game
ps i know my spelling is bad no need to tell me c u guys on soom
<!--quoteo(post=1966595:date=Aug 25 2012, 07:20 AM:name=player)--><div class='quotetop'>QUOTE (player @ Aug 25 2012, 07:20 AM) <a href="index.php?act=findpost&pid=1966595"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->What you need to do: Disable NS2's query-responder (using the <a href="http://hg.opensteamworks.org/open-steamworks/src" target="_blank">Steam-API</a>). Learn how to use the <a href="http://www.lua.org/pil/index.html#P4" target="_blank">Lua C-API</a> (or use something like Luabind) Build a query-responder using the <a href="https://developer.valvesoftware.com/wiki/Server_queries" target="_blank">SourceEngine-protocol</a>. Build a MasterServer-Communicator (<a href="https://developer.valvesoftware.com/wiki/Master_Server_Query_Protocol#Game_server_to_master_server" target="_blank">protocol</a>).<!--QuoteEnd--></div><!--QuoteEEnd--> Can you elaborate on step #1 a bit? I've checked out OpenSteamWorks, there's a pair of classes that look suitable for this, ISteamGameServer and ISteamMasterServerUpdater. They both seem to share a lot of functionality, and both have a method for controlling heartbeats, so I don't know which to use, although I suppose I could try both. Anyway how exactly would I go about using these interfaces? ns2.exe will already have initialised the steamclient api by the time my code would load, so if OSW is loaded as normal via it's CSteamLoader api, would it hook into the existing interfaces created by ns2? Next, I'd probably have to detour some of these functions, such as EnableHeartbeats and replace them with no-ops.
Imo that seems to be the hard part. Assuming those wiki pages are accurate re-implementing the protocols would be fairly straightforward.
Load steam_api.dll. Because your Lua-DLL mod loads long after the NS2.exe-process has already worked with steam_api.dll, you will be sharing the same instance. Fetch the "SteamGameServer"-symbol, and cast it into the function-prototype: <!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->typedef ISteamGameServer011* ( *getSteamGameServer )( void );<!--c2--></div><!--ec2-->and execute the function to recieve the pointer to the Steam-API construct.
Then call the function: <!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->EnableHeartbeats( false );<!--c2--></div><!--ec2--> You should then be set to build your own systems.
Comments
Please give modders an easy way to lie to people about a server's maximum slots. A setter/mutator method for manipulating the behind-the-scenes number your server engine is reporting to server queries would be <i>delicious</i>. (Correct me if I'm wrong, but) I think Build 216 gives us everything else we need to build a first-class reserved slots system.
<b>Rationale:</b>
Build 216 doesn't provide any Lua API for fabricating the number that's reported to server queries as the number of maximum slots. To build a proper reserved slots solution, you need to be able to lie, claiming you have one or two fewer available slots than you actually do.
If GameOvermind can already do a lot of this stuff, that'd be fantastic. Anyway if anyone would like to collaborate on something like this let me know.
However, realistically UWE is unlikely to get to this anytime soon. You'll likely have to wait/rely on a mod (player's revised OM if/when it gets continued or Dragon's mod).
Though, if you could figure out how to write this in lua, UWE does accept community code submissions sometimes (its not guaranteed, however).
I did manage to perfect reserved-slots, but it required quite a bit of work to accomplish, and may be a bit out of most modders' league.
What I did is disable NS2's query-responder, replace it with my own on a different port, and build a mastergameserver-communicator on the same socket to make it show up in the serverbrowser-list. The code-base is in shambles at the moment, because I was rewriting the whole thing at the time I decided to stop due to lack of motivation, so I can't really help you out by providing snippets.
What you need to do:
Disable NS2's query-responder (using the <a href="http://hg.opensteamworks.org/open-steamworks/src" target="_blank">Steam-API</a>).
Learn how to use the <a href="http://www.lua.org/pil/index.html#P4" target="_blank">Lua C-API</a> (or use something like Luabind)
Build a query-responder using the <a href="https://developer.valvesoftware.com/wiki/Server_queries" target="_blank">SourceEngine-protocol</a>.
Build a MasterServer-Communicator (<a href="https://developer.valvesoftware.com/wiki/Master_Server_Query_Protocol#Game_server_to_master_server" target="_blank">protocol</a>).
It's a ton of work to do from scratch, the unreleased GameOvermind is over 100.000 lines large using a dozen libraries. It's probably easier to maybe ask Max (or another UWE developer) to just introduce a SetMaxSlots-function to the Lua-scripts.
ps i know my spelling is bad no need to tell me c u guys on soom
<!--quoteo(post=1966595:date=Aug 25 2012, 07:20 AM:name=player)--><div class='quotetop'>QUOTE (player @ Aug 25 2012, 07:20 AM) <a href="index.php?act=findpost&pid=1966595"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->What you need to do:
Disable NS2's query-responder (using the <a href="http://hg.opensteamworks.org/open-steamworks/src" target="_blank">Steam-API</a>).
Learn how to use the <a href="http://www.lua.org/pil/index.html#P4" target="_blank">Lua C-API</a> (or use something like Luabind)
Build a query-responder using the <a href="https://developer.valvesoftware.com/wiki/Server_queries" target="_blank">SourceEngine-protocol</a>.
Build a MasterServer-Communicator (<a href="https://developer.valvesoftware.com/wiki/Master_Server_Query_Protocol#Game_server_to_master_server" target="_blank">protocol</a>).<!--QuoteEnd--></div><!--QuoteEEnd-->
Can you elaborate on step #1 a bit?
I've checked out OpenSteamWorks, there's a pair of classes that look suitable for this, ISteamGameServer and ISteamMasterServerUpdater. They both seem to share a lot of functionality, and both have a method for controlling heartbeats, so I don't know which to use, although I suppose I could try both.
Anyway how exactly would I go about using these interfaces? ns2.exe will already have initialised the steamclient api by the time my code would load, so if OSW is loaded as normal via it's CSteamLoader api, would it hook into the existing interfaces created by ns2? Next, I'd probably have to detour some of these functions, such as EnableHeartbeats and replace them with no-ops.
Imo that seems to be the hard part. Assuming those wiki pages are accurate re-implementing the protocols would be fairly straightforward.
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->typedef ISteamGameServer011* ( *getSteamGameServer )( void );<!--c2--></div><!--ec2-->and execute the function to recieve the pointer to the Steam-API construct.
Then call the function:
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->EnableHeartbeats( false );<!--c2--></div><!--ec2-->
You should then be set to build your own systems.