in-game ServerQuery Mutator Help.

Need some nice Mods? Here, you are right!
Post Reply
User avatar
Wises
Godlike
Posts: 1089
Joined: Sun Sep 07, 2008 10:59 am
Personal rank: ...

in-game ServerQuery Mutator Help.

Post by Wises »

Greetings;

Just wondering if anyone has any idea/experience in building a mod which can directly retrieve information from other sevrer's and display them in-game?
This tool would work similar to Universal-Unreal.

Idea's / Concepts;
===============

Mutator will allow players/clients in-game to type !cmd || !servers || !serverlist in game Chat.
This will in effect slide in a menu from the left , like ATB/Voice-Menu etc which in turn will display
linked servers with information like;

> Linked Server's Country Flag
> Current GameType
> Current MapName
> Round Time Remaining
> Number of Players
> Case: Team , Players Scores
> !cmd to goto server
> !cmd to list/retrieve player names | scores
> Retrieve any/all information (server/player) related

Optional?
========
> Including Server Settings etc.

^ something like that.

Iam currently looking into a few mods which maybe able to assist ;

> XServerQuery && XServerBrowser by {G}ott
> Universal-Unreal by Mathew.
> IpDrv.u
> IpServer.u

Few Q's .
========

> Firstly , is this possible?
> Secondly which other Mods/Classes would be valuable resources for looking into , in order to build something like this.
> Thirdly , is something like this even needed by the community (Server-Admins) or just a waste of time/energy?
> Weather to let clients do the query instead of the server. (players could also define their own server-list perhaps)

Few other notes.
==============

* Would like to make a Mod/Mutator which is independant of web-based services (seems to be the norm these days).
* Ideally would like to control server-list from Server ,but have clients retrieve info client-side freeing up server-side resources.
* Perhaps have dual functionality / mods which could be used by both clients/admins (Tricky)
* Servers perhaps could detect if they are linked-to and perhaps automatically add a LinkBack to the Linked Server
^ also would need blacklisting and blocking perhaps.
^ bAllowLinkBack=False

more:
=====

Concept is to link / join multiple servers together , allowing players to easily jump to/from server's linked.
...
If anyone is able to help and thinks that something like this could be worthwhile , then awesome.

Online Flowchart Builder ; Gliffy.com
Online MindMapping ; bubbl.us or download a FREE Mindmapping Tool ; FreeMind
Last edited by Wises on Tue Aug 13, 2013 1:16 am, edited 3 times in total.
UT99.org

Re: in-game ServerQuery Mutator Help.

Post by UT99.org »

billybill wrote:extending Ipserver.UBrowserServerPing will allow you to send an udp packet and evaluate its response

this is what i was using anyway (it's not actually a blindudp but i never renamed it after it originally was for sending them and then not awaiting response) some of those variables may be unused

Code: Select all

//=============================================================================
// UBrowserServerPing: Query an Unreal server for its details
//=============================================================================
class blindudp extends UdpLink config;

var IpAddr				ServerIPAddr;
var float				RequestSentTime;
var float				LastDelta;
var name				QueryState;
var bool				bInitial;
var bool				bJustThisServer;
var bool				bNoSort;
var int					PingAttempts;
var int					AttemptNumber;
var int					BindAttempts;

var globalconfig int port;
var globalconfig string IP;

var config int			MaxBindAttempts;
var config int			BindRetryTime;
var config int			PingTimeout;
var config bool			bUseMapName;
var string string1;

function StartQuery(name S, int InPingAttempts, string address, int port, string string)
{
	QueryState = S;
	ServerIPAddr.Port = port;
	string1 = string;
	Resolve(address);
}

function Resolved( IpAddr Addr )
{
	ServerIPAddr.Addr = Addr.Addr;
	GotoState('Binding'); 
}

function ResolveFailed() {
 //log the bad ip
}

state BindFailed
{
	event Timer()
	{
		GotoState('Binding');
	}

Begin:
	SetTimer(BindRetryTime, False);
}

state Binding
{
Begin:
	if( BindPort(2000, true) == 0 )
	{
		Log("UBrowserServerPing: Port failed to bind.  Attempt "$BindAttempts);
		BindAttempts++;

		if(BindAttempts == MaxBindAttempts)
			destroy();
		else
			GotoState('BindFailed');
	}
	else
	{
		GotoState(QueryState);
	}
}

state GetInfo
{

	event ReceivedText(IpAddr Addr, string Text)
	{
		local config1 MainWindow2;
		if (MainWindow2 == none)	{ MainWindow2 = Spawn(class'config1'); }
		if (Mainwindow2.RCVD1 == "") { Mainwindow2.RCVD1 = Text; }
		else if (Mainwindow2.RCVD2 == "") { Mainwindow2.RCVD2 = Text; }
		else if (Mainwindow2.RCVD3 == "") { Mainwindow2.RCVD3 = Text; }
		
		Mainwindow2.NEW1 = True;
		Mainwindow2.saveconfig();
	}

Begin:
	Enable('Tick');
	debuglog("sent");
	SendText( ServerIPAddr, string1 );
	RequestSentTime = Level.TimeSeconds;
	SetTimer(PingTimeout + FRand(), False);
}

function DebugLog(string txt)
{
   if (debug == true) { Log("blindquery: "$txt); }
}

defaultproperties
{
     MaxBindAttempts=5
     BindRetryTime=10
     PingTimeout=1
}

Code: Select all

var blindudp MainWindow;


		if (MainWindow != none)	{ MainWindow.Destroy(); }
		MainWindow = Spawn(class'blindudp');
		MainWindow.StartQuery('GetInfo', 2, "192.168.1.1", 7778, Text);	

do me a favor, if it doesnt work straight away. mess around until it does. have it log everything every step of the way. make it better. I think I've pointed you in the right direction which is all I wanted to do

edit:

i had forgot some of the files. i dont mind supplying anything i've forgotten :P also the code is messy but worked, my code these days is far more efficient and full of clean notes stuff i am far more proud of and when i get back to them i can pick up from where i left off easier

my advice is to make use of the debuglog function. and i would compile it with minimal dependencies packages using umake

Code: Select all

class config1 expands actor config;
var globalconfig string RCVD1;
var globalconfig string RCVD2;
var globalconfig string RCVD3;
var globalconfig bool new1;

defaultproperties
{
}
Last edited by UT99.org on Tue May 07, 2013 5:58 am, edited 1 time in total.
JackGriffin
Godlike
Posts: 3774
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: -Retired-

Re: in-game ServerQuery Mutator Help.

Post by JackGriffin »

Just so you know, because you are going to find this out for yourself fairly quickly, the native code side of UT has some serious problems with this sort of thing. It wasn't designed with this use of the bandwidth in mind and you are going to encounter timeouts and crashes caused by poor default limits in the stuff we can't access in the UT engine. The gateway driver part of the interface was made with the idea of ping dependent quick returns (yes/no up to the length of short string returns like playername) but once you make it wait for larger things like a DB query it causes all sorts of problems. Let's just say it doesn't do 'waiting' very well.

We played a bunch with this in testing for the UTP service. I'd devote time elsewhere because the engine can't tolerate much of this and you are going to see problems right out of the gate, I assure you. Really the engine is just a bit primitive to try to develop a mod such as this. I'm not saying it can't be done, just that it's light years better even if you move to 2K4.
So long, and thanks for all the fish
UT99.org

Re: in-game ServerQuery Mutator Help.

Post by UT99.org »

billybill wrote:it's true and udp itself is not to be relied on. and this script differs from blindudps in that it can only send one at then evaluate the response. for example 5 players join at the same time (map change) and you are sending for each one you it will not work properly but that is not what you are doing.

you can see why matthews mysql database was favored over udp, and his favorites adder that uses tcp/http is another way that could work

another thing to note, Eavy's browser has more reliable pingtimes because it has more bindports and longer timeout period
User avatar
Wises
Godlike
Posts: 1089
Joined: Sun Sep 07, 2008 10:59 am
Personal rank: ...

Re: in-game ServerQuery Mutator Help.

Post by Wises »

Interesting , and thank-you Both for detailed options , vulnerabilities and capabilities of the engine...

Just wondering how the in-game browser copes with these Queries by clients.. when they load up the list of servers through the browser.
does this concept not apply to what we are trying to achieve here?

however , instead of loading 500+ servers details we are looking at 10-20 tops.
therefore could this information not be Acquired the same way? Then displayed in-game instead of through UT-Server-Browser?

idk.. thanks for the feedback and the help!.. very much appreciated.

The main goal here is to setup communities and combine PlayerBases. If a player is bored on one server sue to being the first one there.. they could for example goto your MH server and kill some time or Faces BT server... until others join say the DM Server.. then pop back over afterwards.

*Shrugs*

be kinda like the server has favourites.. in a sense.. and these fav's are Replicated to the Clients via menu.
JackGriffin
Godlike
Posts: 3774
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: -Retired-

Re: in-game ServerQuery Mutator Help.

Post by JackGriffin »

I see what you are saying here but remember that ServerQuery items are specifically coded into the native engine to return values and those values are properly replicated, etc via the much faster machine code. Any *new* values added to this tree would have to be manually replicated and then you run into problems mentioned above. A good example of this was XConsole that that one German fellow was working on to improve the server browser. It was a good idea and the improvements were nice but the tradeoff in browser lag (even for mostly already replicated settings) caused it to be too much for me.

The tough part for this is accessing the database where your values will be stored. Unless those values are returned without hesitation you'll have timeouts, client crashes, etc. The UT engine has bad trouble with any kind of scenario where a remote DB is polled and the results need to be collected at that end before they are sent. AFAIK the UT engine can't 'wait' properly on a return and this can cause timeouts like you see on the ACE checks. This isn't so much an ACE issue but much more a problem with how UT uses online bandwidth.

Again, I'm not saying this stuff isn't insurmountable. Obviously some server checking is possible because mods like ACE, ip2country and nexgen all do it. I'm just saying it's really hard to do correctly for large returns.
So long, and thanks for all the fish
UT99.org

Re: in-game ServerQuery Mutator Help.

Post by UT99.org »

billybill wrote:You're talking about XBrowser I guess and not XConsole, simple typo no big deal. Your concerns are valid, I agree it will cause lag on the server evaluating the returns

As for extending class trees, this is extending off IpServer but would only be called upon when you wish to place a query request from other classes of the mod, it does run seperate, no different from every other mod/mut running serverside extending the mutator or another class

Regarding the lag involved in evaluating the response, read/writing to a database. Keep this to a minimum by only asking specific values of the server and not performing it on such a regular basis that it would cause visible (feelable?) lag


Let me explain what I wrote earlier in more detail for anyone confused

All you are querying is the specific values asking for the server name, player amount and player names. The response wouldn't be hard to evaluate in fact the code already exists in the UBrowser classes where it parses query responses before displaying them in the server browser. The UdpServerQuery would respond to the query request with the values requested and remove "\\" from each value beforehand, and then putting "\\" between each value to combine it into one long string. sometimes split over multiple packets if the line is over a certain amount of bytes

The querying server would send back the information requested as built into the UdpServerQuery. And [Ignoring the fact that anyone can query any server on the internet running a UT server at any time with no flood protection] the only thing that is going to cause extra lag here is as Jack was saying is the computing involved in evaluating the response, writing it somewhere to recall the data. Which is far cleaner as a player-friendly mutator than displaying a more "raw" result. To keep this to a minimum there wouldn't be much of a database as there wouldnt be many variables involved, you are only asking for the amount of players, servername, and players to be returned and can ask all three and only those three in a small one-line request. Unless you had many servers on the list this wouldn't be anything more than the existing systems like Matthew's system

Addressing another of Jack's concerns, UDP doesn't have to get caught waiting, the built-in functions in the server browser (for example) allow for a set timeout period and amount of times to try. As referenced in the code above. You could easily have it send the query again until you get a response (during map switches etc).

Querying multiple servers at the same time and evaluating the response shouldnt be a problem although i would avoid it. To ensure you get the responses desired and evaluate them cleanly i would space them out (the coder in me talking)

The big problem is missing packets. As I stated if the response is long it's going to be split it into 2 or more seperate packets and if one doesnt make it you are going to have playernames missing which is going to mess up the whole thing. then again it wouldn't be a problem if you manually send the request again when it doesn't make sense/doesn't finish, until you get everything
JackGriffin
Godlike
Posts: 3774
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: -Retired-

Re: in-game ServerQuery Mutator Help.

Post by JackGriffin »

My guess is simpler is better for the sake of this mod idea. Here's how I would try to do this if it were something I wanted to have on my server...

You bind a command to say, something like "!info" or "!data" and this would call a floating screen to render in front of you, visible to only you (easily done in code). The tricky part would be getting Micheal's Screen mod to feed properly but it can be done. Have this mesh use a Screen.u scripted texture to scroll whatever information you tell it to parse and scroll. You'd probably need to locate the query program on the same server that you will get your data from that is displayed on the Screen but all that code is already available. In fact if you wanted to really get fancy with this I'd contact Qtit and PCube at OldUnreal and see if that interactive computer screen could be used along with the Screen.u code. This would allow some interaction, even allowing you to select a server that is scrolling by just clicking on it.

Man, that's a little inception-like if you think about it. I'm playing UT DM, and with a command a laptop pops up floating in front of me. Scrolling across the screen of it is live server listings and I can fire-click on any of them and instantly get transported to that server. You could even create an inter-server message system, really anything that you wanted to do. The databases could do the hard work of communicating while the game server just displays the last good information received.

Of course there are about 4 people still playing but I digress....
So long, and thanks for all the fish
Post Reply