Query protocol

  • 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.


    Well, if Luis manages to implement something that can read the XML response, then there's really nothing to share :P The query method will be implemented, and the game config will be uploaded to TCAdmins forums. :)

  • 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 :)

  • 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

  • That's fantastic ! 8o


    Thanks very much ! Hope i can return the favour sometime in the future. :thumbsup:


    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.

  • 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 ...


    Lastly, 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).


  • And just keep adding blocks of code as you need them for each request.

  • No problem. Enjoy! :D 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!