Very short; I just bought this game, setup a server and is now messing around with it. Does there exist a query protocol for this game?
Query protocol
- DennisMidjord
- Closed
- Thread is marked as Resolved.
-
-
On port (your game port - 1) is the http port. For example, I run my game at win.thedeadlands.net:30500. If I want to access the http xml services, I just point to the following:
http://win.thedeadlands.net:30499/
http://win.thedeadlands.net:30499/details/
http://win.thedeadlands.net:30499/playerlist/
I hope that's what you meant. -
On port (your game port - 1) is the http port. For example, I run my game at win.thedeadlands.net:30500. If I want to access the http xml services, I just point to the following:
http://win.thedeadlands.net:30499/
http://win.thedeadlands.net:30499/details/
http://win.thedeadlands.net:30499/playerlist/I hope that's what you meant.
Hi Absalom, and thanks for your answer!I already use 30499 as the query port (thanks for confirming that it's correct btw). However, most multiplayer games use a query protocol. You send a query to the game server on the query port using the protocol, and you get useful information back.
We hope to host servers for Rising World in the near future, but we need to be able to 'control' that the user doesn't change the slots to more than he has paid for - and a query protocol would do the job. It would be able to return how many online players the server has, how many slots, what the servername is and what not.I see that the xml service does reply with this, but I'm not entirely sure on how to have TCAdmin get this information. Oh well, I'm going to contact them and see if they can do something smart with the xml response
-
I see what you are saying. I am sure others here would like to hear their response to you as well if you wouldn't mind sharing.
-
I see what you are saying. I am sure others here would like to hear their response to you as well if you wouldn't mind sharing.
Well, if Luis manages to implement something that can read the XML response, then there's really nothing to share The query method will be implemented, and the game config will be uploaded to TCAdmins forums. -
It shouldn't be difficult in php. That's what I did here: https://thedeadlands.net/serverstatus.php
-
It shouldn't be difficult in php. That's what I did here: https://thedeadlands.net/serverstatus.php
Yeah, but that's not how a query really works, I guess You're sending small 'queries' to the server, and then the server will respond.That's at least what I was told a couple of months back.
-
A server query, in the context that we are discussing, is just a query to a server for specific information over a specific port or ports. In this case the response is in XML format over http. Other servers may send the response in JSON structure, or some other structure and over tcp, udp, or other protocols.
-
I had a talk with Luis, and he implemented a working method to have the query response shown in TCAdmin. We're testing it right now, and it will be included in the next update
-
Very nice.
-
Quote
Absalom wrote:It shouldn't be difficult in php. That's what I did here: thedeadlands.net/serverstatus.php
Would you mind sharing the php code you used please - I can only get it partially working (using SimpleXML) but it's not working 100%.
Thanks in advance!
Mart
-
PHP
-
That's fantastic !
Thanks very much ! Hope i can return the favour sometime in the future.
Is it at all possible to display the online players as well ... I couldn't figure out how to work with the player id's so assumed it's probably alot more difficult to parse to php.
-
That's just one xml document. You can get more by changing the URI portion of the URL like so:
http://win.thedeadlands.net:30499/playerlist
or
http://win.thedeadlands.net:30499/details
One of the devs said they expanded the data too. Not sure what else they added though.
-
We added new http information: [url]/luascripts
-
Thanks for the help!
I'm trying to list all players online but I can only get the first player to show up on the list.
Using ...PHPLastly, is it possible to incorporate all xml's into one php script at all?
-
Yes. Each simplexml_load_string is building the $xml object. Once you have that object (i.e. $xml, $xmlDetails, $xmlPlayerList) then all you need to do is build a structure or structures from them. For example, from $xmlPlayers list, you could iterate through the players in the xml object, build an object of Player type (Player would be a class you write to represent a player with methods like setName and getName), and then use those player objects however you see fit (e.g. build a list of player objects to use to populate part of a web page).
-
PHP
And just keep adding blocks of code as you need them for each request.
-
Thanks Absalom, that helped no end. Much appreciated for your time
-
No problem. Enjoy! YOu might want to look at some object oriented PHP tutorials or books, and modularize your app. For example, you could encapsulate the logic above in multiple objects if you want. A Server class could provide methods to get that data so that you could do something like $server = new Server(); then you can $playerList = $server->getPlayerList(); or something like that.
Participate now!
Don’t have an account yet? Create a new account now and be part of our community!