KostyaEsmukov / GameQ3

A PHP Gameserver Status Query Library
15 stars 8 forks source link

Squad protocol doesn't work #20

Closed Maverick87Shaka closed 7 years ago

Maverick87Shaka commented 7 years ago

Hi, Thanks for this great job! I would like to use GameQ3 to write a simple page with statistics for my own Squad Server.

I try to use list.php to get some info about the Squad protocol, but seams it doesn't works. My environment is Win2008R2 IIS + PHP 7.1 ( with all required module enabled )

The output of list.php is: PHP Warning: Declaration of GameQ3\protocols\Ship::_parseDetailsExtension(GameQ3\Buffer &$buf, $appid) should be compatible with GameQ3\protocols\Source::_parseDetailsExtension(&$buf, $appid) in C:\inetpub\wwwroot\gameq3\protocols\ship.php on line 48 PHP Warning: Declaration of GameQ3\protocols\Ut3::_parse_arrays_break(&$buf) should be compatible with GameQ3\protocols\Gamespy3::_parse_arrays_break(GameQ3\Buffer &$buf) in C:\inetpub\wwwroot\gameq3\protocols\ut3.php on line 245

And if I try to use the example query used for CS server i get this error: addServer exception: Both query and connect ports must be defined for this protocol

I think I have to use more variable then the 'connect_host' used for cs type server, but I can't find the documentation for Squad server.

Thanks

KostyaEsmukov commented 7 years ago

Hi @Maverick87Shaka,

There's a known issue with squad servers: they have changed query protocol recently #19.

Kindly asking Simon @ClundXIII to recap what did they change and what needs to be done in order to fix the squad query protocol.

ClundXIII commented 7 years ago

As discussed here e.g.: http://forums.joinsquad.com/topic/18473-querying-your-server-using-gameq3/

It is a bug. An update will fix this soon. Unfortunately there is no documentation at all. All I can say is that it is prettx much the steam protocol: https://developer.valvesoftware.com/wiki/Server_Queries However, if you clone my repository, I created a workaround. But you have to query players aswell and the implementation filters all players with empty names out of the playercount.

In general, the Squad protocol works, we are actively using it on our website ;)

@KostyaEsmukov do I need to implement anything so that the Protocol appears in list.php? Maybe thats the problem.

KostyaEsmukov commented 7 years ago

Regarding the list.php: These warnings are not related to the squad protocol. I think they are present on PHP 7 only. Anyway they are just harmless warnings.

However what is related is that both query and connect ports are required for a squad protocol to work due to the PT_UNKNOWN port type. Is this intended, i.e. one can't predict the other port by knowing only one? If they are the same, then the PT_SAME port type should be used, so that only one port must be defined in a game server info.

Description of port types: https://github.com/KostyaEsmukov/GameQ3/blob/master/gameq3/protocols.php#L28

Source protocol (which uses PT_SAME ports type): https://github.com/KostyaEsmukov/GameQ3/blob/master/gameq3/protocols/source.php#L34

ClundXIII commented 7 years ago

It uses another port for query and the query port can pretty much not be predicted.

TacTicToe66 commented 7 years ago

This other GameQ V3 seems to have gotten it to work.

https://github.com/KostyaEsmukov/GameQ3/blob/master/gameq3/protocols/squad.php

KostyaEsmukov commented 7 years ago

@ClundXIII Hmm, okay then.

@Maverick87Shaka So, to sum up:

  1. The warnings you saw are not related to the squad
  2. In order to query squad servers, you need to pass query_port and connect_port options. See https://github.com/KostyaEsmukov/GameQ3#addserver-options
  3. Squad protocol implementation might not work properly currently due to the changes in the protocol itself #19.
Maverick87Shaka commented 7 years ago

Thanks for the help, finally I've managed to connect to my server using:

$gq = new \GameQ3\GameQ3(); try { $gq->addServer(array( 'id' => 'Banshee Squad Server', 'type' => 'squad', 'connect_host' => '127.0.0.1', 'connect_port' => '27015', 'query_host' => '127.0.0.1', 'query_port' => '27165' )); }

Using the "short" version:

query_addr (alias addr) - host:port

seams doesn't works on my server, actually I can't reproduce with another environment, but on IIS and PHP7 I've got this message:

addServer exception: Wrong address (IPv4 and hostname filters failed): 127.0.0.1:27165