<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://wiki.minegoboom.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Goldeye</id>
		<title>ASSS Wiki - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="http://wiki.minegoboom.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Goldeye"/>
		<link rel="alternate" type="text/html" href="http://wiki.minegoboom.com/index.php/Special:Contributions/Goldeye"/>
		<updated>2026-05-05T17:50:52Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.28.2</generator>

	<entry>
		<id>http://wiki.minegoboom.com/index.php?title=PHP_ping_client&amp;diff=5857</id>
		<title>PHP ping client</title>
		<link rel="alternate" type="text/html" href="http://wiki.minegoboom.com/index.php?title=PHP_ping_client&amp;diff=5857"/>
				<updated>2007-12-26T13:16:26Z</updated>
		
		<summary type="html">&lt;p&gt;Goldeye: Added category:utilities&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Version 1.0 of this PHP class was produced by Goldeye on 12/26/07.  It provides functions to report on the number of players logged on -- as well as the number playing -- in an ASSS zone or specific arenas.&lt;br /&gt;
It is currently only compatible with ASSS's new [[Ping_Protocol]].&lt;br /&gt;
It's intended function is to put this information on a zone's website.&lt;br /&gt;
&lt;br /&gt;
The code at the top is demonstration using SSCE and it's two most active arenas.  It can be removed without affecting the class.&lt;br /&gt;
Basic PHP knowledge is required to adapt the script &lt;br /&gt;
&lt;br /&gt;
Feel free to contact the author with any requests or bugs with the script.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
  //ServerPopulation.php v1.0 &lt;br /&gt;
  // by Goldeye 12/26/07&lt;br /&gt;
  // Goldeye.Ichiban@gmail.com&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  //Errors are silent and the recv times out default 100ms.&lt;br /&gt;
  //Updates occur no more than once in 60 sec by default anyway. &lt;br /&gt;
$hz = new ServerPopulation(&amp;quot;67.19.122.82&amp;quot;,7502);&lt;br /&gt;
$total = $hz-&amp;gt;get_server_total();&lt;br /&gt;
$playing = $hz-&amp;gt;get_server_playing();&lt;br /&gt;
$spec = $total-$playing;&lt;br /&gt;
$pub0=$hz-&amp;gt;get_arena(&amp;quot;0&amp;quot;);&lt;br /&gt;
$fb=$hz-&amp;gt;get_arena(&amp;quot;football&amp;quot;);&lt;br /&gt;
//Note: name automatically lowercased before it gets here.&lt;br /&gt;
print &amp;quot;Total: $playing playing, $spec spectating, $total logged in.\n&amp;quot;;&lt;br /&gt;
print &amp;quot;(Public 0): $pub0[playing] playing, $pub0[spec] spectating, $pub0[total] logged in.\n&amp;quot;;&lt;br /&gt;
print &amp;quot;Football: $fb[playing] playing, $fb[spec] spectating, $fb[total] logged in.\n&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
class ServerPopulation&lt;br /&gt;
{&lt;br /&gt;
  var $host;&lt;br /&gt;
  var $port;&lt;br /&gt;
  var $last_time;&lt;br /&gt;
  var $update_time;&lt;br /&gt;
  var $timeout;&lt;br /&gt;
  var $arenas = array();&lt;br /&gt;
  var $total;&lt;br /&gt;
  var $playing;&lt;br /&gt;
&lt;br /&gt;
  function ServerPopulation($host,$port,$update_time=60,$timeout=100)&lt;br /&gt;
  { //For PHP4&lt;br /&gt;
    $this-&amp;gt;__construct($host,$port,$update_time,$timeout);&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  function __construct($host,$port,$update_time=60,$timeout=100)&lt;br /&gt;
  { //For PHP5&lt;br /&gt;
    $this-&amp;gt;host = $host;&lt;br /&gt;
    $this-&amp;gt;port = $port;&lt;br /&gt;
    $this-&amp;gt;update_time=$update_time;&lt;br /&gt;
    $this-&amp;gt;timeout=$timeout*1000;&lt;br /&gt;
    $this-&amp;gt;update();&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  function get_server_total()&lt;br /&gt;
  {&lt;br /&gt;
    return $this-&amp;gt;total;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  function get_server_playing()&lt;br /&gt;
  {&lt;br /&gt;
    return $this-&amp;gt;playing;&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
  function get_arena($name)&lt;br /&gt;
  {&lt;br /&gt;
    return $this-&amp;gt;arenas[$name];&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  function get_arena_array()&lt;br /&gt;
  {&lt;br /&gt;
    return $this-&amp;gt;arenas;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  function update()&lt;br /&gt;
  {&lt;br /&gt;
    if(time()-$this-&amp;gt;last_time &amp;lt; $this-&amp;gt;update_time)&lt;br /&gt;
      return;&lt;br /&gt;
      &lt;br /&gt;
    $socket = socket_create(AF_INET, SOCK_DGRAM, 0);&lt;br /&gt;
    $rcvtimeo[&amp;quot;sec&amp;quot;]=0;&lt;br /&gt;
    $rcvtimeo[&amp;quot;usec&amp;quot;]=$this-&amp;gt;timeout;&lt;br /&gt;
    socket_set_option($socket,SOL_SOCKET,SO_RCVTIMEO,$rcvtimeo);&lt;br /&gt;
    $result = socket_connect($socket,$this-&amp;gt;host,$this-&amp;gt;port);&lt;br /&gt;
    if(!$socket || !$result) return;&lt;br /&gt;
    $out=pack(&amp;quot;VV&amp;quot;,0,0x01|0x02);&lt;br /&gt;
    socket_write($socket, $out, 8);&lt;br /&gt;
    if(@socket_recv($socket,&amp;amp;$in,512,0) &amp;lt; 1)&lt;br /&gt;
      return;&lt;br /&gt;
    $res = unpack(&amp;quot;Vtime/Voptions&amp;quot;,$in);&lt;br /&gt;
    $opt = $res[&amp;quot;options&amp;quot;];&lt;br /&gt;
    if($opt &amp;amp; 0x01) // Server info included.&lt;br /&gt;
      {&lt;br /&gt;
	$in = substr($in,8);&lt;br /&gt;
	$res = unpack( &amp;quot;Vtotal/Vplaying&amp;quot;,$in);&lt;br /&gt;
	$this-&amp;gt;total = $res[&amp;quot;total&amp;quot;];&lt;br /&gt;
	$this-&amp;gt;playing = $res[&amp;quot;playing&amp;quot;];&lt;br /&gt;
      }&lt;br /&gt;
    if($opt &amp;amp; 0x02) // Arena info included.&lt;br /&gt;
      {&lt;br /&gt;
	$in = substr($in,8);&lt;br /&gt;
	do &lt;br /&gt;
	  {&lt;br /&gt;
	    $n = strpos($in,0x00);&lt;br /&gt;
	    $name = strtolower(substr($in,0,$n));&lt;br /&gt;
	    $in = substr($in,$n+1);&lt;br /&gt;
	    $res = unpack(&amp;quot;vtotal/vplaying&amp;quot;,$in);&lt;br /&gt;
	    $res[&amp;quot;spec&amp;quot;]=$res[&amp;quot;total&amp;quot;]-$res[&amp;quot;playing&amp;quot;];&lt;br /&gt;
	    $in = substr($in,4);&lt;br /&gt;
	    $this-&amp;gt;arenas[$name]=$res;&lt;br /&gt;
	  }	  &lt;br /&gt;
	while(strlen($in)&amp;gt;1);&lt;br /&gt;
      }&lt;br /&gt;
    $this-&amp;gt;last_time=time();&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
?&amp;gt;&amp;lt;/pre&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
[[Category:Utilities]]&lt;/div&gt;</summary>
		<author><name>Goldeye</name></author>	</entry>

	<entry>
		<id>http://wiki.minegoboom.com/index.php?title=PHP_ping_client&amp;diff=5856</id>
		<title>PHP ping client</title>
		<link rel="alternate" type="text/html" href="http://wiki.minegoboom.com/index.php?title=PHP_ping_client&amp;diff=5856"/>
				<updated>2007-12-26T13:14:06Z</updated>
		
		<summary type="html">&lt;p&gt;Goldeye: Initial -- pasted the code&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Version 1.0 of this PHP class was produced by Goldeye on 12/26/07.  It provides functions to report on the number of players logged on -- as well as the number playing -- in an ASSS zone or specific arenas.&lt;br /&gt;
It is currently only compatible with ASSS's new [[Ping_Protocol]].&lt;br /&gt;
It's intended function is to put this information on a zone's website.&lt;br /&gt;
&lt;br /&gt;
The code at the top is demonstration using SSCE and it's two most active arenas.  It can be removed without affecting the class.&lt;br /&gt;
Basic PHP knowledge is required to adapt the script &lt;br /&gt;
&lt;br /&gt;
Feel free to contact the author with any requests or bugs with the script.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
  //ServerPopulation.php v1.0 &lt;br /&gt;
  // by Goldeye 12/26/07&lt;br /&gt;
  // Goldeye.Ichiban@gmail.com&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  //Errors are silent and the recv times out default 100ms.&lt;br /&gt;
  //Updates occur no more than once in 60 sec by default anyway. &lt;br /&gt;
$hz = new ServerPopulation(&amp;quot;67.19.122.82&amp;quot;,7502);&lt;br /&gt;
$total = $hz-&amp;gt;get_server_total();&lt;br /&gt;
$playing = $hz-&amp;gt;get_server_playing();&lt;br /&gt;
$spec = $total-$playing;&lt;br /&gt;
$pub0=$hz-&amp;gt;get_arena(&amp;quot;0&amp;quot;);&lt;br /&gt;
$fb=$hz-&amp;gt;get_arena(&amp;quot;football&amp;quot;);&lt;br /&gt;
//Note: name automatically lowercased before it gets here.&lt;br /&gt;
print &amp;quot;Total: $playing playing, $spec spectating, $total logged in.\n&amp;quot;;&lt;br /&gt;
print &amp;quot;(Public 0): $pub0[playing] playing, $pub0[spec] spectating, $pub0[total] logged in.\n&amp;quot;;&lt;br /&gt;
print &amp;quot;Football: $fb[playing] playing, $fb[spec] spectating, $fb[total] logged in.\n&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
class ServerPopulation&lt;br /&gt;
{&lt;br /&gt;
  var $host;&lt;br /&gt;
  var $port;&lt;br /&gt;
  var $last_time;&lt;br /&gt;
  var $update_time;&lt;br /&gt;
  var $timeout;&lt;br /&gt;
  var $arenas = array();&lt;br /&gt;
  var $total;&lt;br /&gt;
  var $playing;&lt;br /&gt;
&lt;br /&gt;
  function ServerPopulation($host,$port,$update_time=60,$timeout=100)&lt;br /&gt;
  { //For PHP4&lt;br /&gt;
    $this-&amp;gt;__construct($host,$port,$update_time,$timeout);&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  function __construct($host,$port,$update_time=60,$timeout=100)&lt;br /&gt;
  { //For PHP5&lt;br /&gt;
    $this-&amp;gt;host = $host;&lt;br /&gt;
    $this-&amp;gt;port = $port;&lt;br /&gt;
    $this-&amp;gt;update_time=$update_time;&lt;br /&gt;
    $this-&amp;gt;timeout=$timeout*1000;&lt;br /&gt;
    $this-&amp;gt;update();&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  function get_server_total()&lt;br /&gt;
  {&lt;br /&gt;
    return $this-&amp;gt;total;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  function get_server_playing()&lt;br /&gt;
  {&lt;br /&gt;
    return $this-&amp;gt;playing;&lt;br /&gt;
  }&lt;br /&gt;
  &lt;br /&gt;
  function get_arena($name)&lt;br /&gt;
  {&lt;br /&gt;
    return $this-&amp;gt;arenas[$name];&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  function get_arena_array()&lt;br /&gt;
  {&lt;br /&gt;
    return $this-&amp;gt;arenas;&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
  function update()&lt;br /&gt;
  {&lt;br /&gt;
    if(time()-$this-&amp;gt;last_time &amp;lt; $this-&amp;gt;update_time)&lt;br /&gt;
      return;&lt;br /&gt;
      &lt;br /&gt;
    $socket = socket_create(AF_INET, SOCK_DGRAM, 0);&lt;br /&gt;
    $rcvtimeo[&amp;quot;sec&amp;quot;]=0;&lt;br /&gt;
    $rcvtimeo[&amp;quot;usec&amp;quot;]=$this-&amp;gt;timeout;&lt;br /&gt;
    socket_set_option($socket,SOL_SOCKET,SO_RCVTIMEO,$rcvtimeo);&lt;br /&gt;
    $result = socket_connect($socket,$this-&amp;gt;host,$this-&amp;gt;port);&lt;br /&gt;
    if(!$socket || !$result) return;&lt;br /&gt;
    $out=pack(&amp;quot;VV&amp;quot;,0,0x01|0x02);&lt;br /&gt;
    socket_write($socket, $out, 8);&lt;br /&gt;
    if(@socket_recv($socket,&amp;amp;$in,512,0) &amp;lt; 1)&lt;br /&gt;
      return;&lt;br /&gt;
    $res = unpack(&amp;quot;Vtime/Voptions&amp;quot;,$in);&lt;br /&gt;
    $opt = $res[&amp;quot;options&amp;quot;];&lt;br /&gt;
    if($opt &amp;amp; 0x01) // Server info included.&lt;br /&gt;
      {&lt;br /&gt;
	$in = substr($in,8);&lt;br /&gt;
	$res = unpack( &amp;quot;Vtotal/Vplaying&amp;quot;,$in);&lt;br /&gt;
	$this-&amp;gt;total = $res[&amp;quot;total&amp;quot;];&lt;br /&gt;
	$this-&amp;gt;playing = $res[&amp;quot;playing&amp;quot;];&lt;br /&gt;
      }&lt;br /&gt;
    if($opt &amp;amp; 0x02) // Arena info included.&lt;br /&gt;
      {&lt;br /&gt;
	$in = substr($in,8);&lt;br /&gt;
	do &lt;br /&gt;
	  {&lt;br /&gt;
	    $n = strpos($in,0x00);&lt;br /&gt;
	    $name = strtolower(substr($in,0,$n));&lt;br /&gt;
	    $in = substr($in,$n+1);&lt;br /&gt;
	    $res = unpack(&amp;quot;vtotal/vplaying&amp;quot;,$in);&lt;br /&gt;
	    $res[&amp;quot;spec&amp;quot;]=$res[&amp;quot;total&amp;quot;]-$res[&amp;quot;playing&amp;quot;];&lt;br /&gt;
	    $in = substr($in,4);&lt;br /&gt;
	    $this-&amp;gt;arenas[$name]=$res;&lt;br /&gt;
	  }	  &lt;br /&gt;
	while(strlen($in)&amp;gt;1);&lt;br /&gt;
      }&lt;br /&gt;
    $this-&amp;gt;last_time=time();&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
?&amp;gt;&amp;lt;/pre&amp;gt;&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Goldeye</name></author>	</entry>

	<entry>
		<id>http://wiki.minegoboom.com/index.php?title=Ping_Protocol&amp;diff=5855</id>
		<title>Ping Protocol</title>
		<link rel="alternate" type="text/html" href="http://wiki.minegoboom.com/index.php?title=Ping_Protocol&amp;diff=5855"/>
				<updated>2007-12-26T13:03:00Z</updated>
		
		<summary type="html">&lt;p&gt;Goldeye: Added link to PHP_ping_client&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;There are two ping protocols currently in use. The old ping protocol, supported by [[ASSS]], [[Subgame]], [[Continuum]], and [[Directory server]]s, allows one to receive information about the number of players in a [[zone]]. The new ping protocol, supported by ASSS, can be used to retrieve specific information on the distribution of the players in each [[arena]] within a zone. &lt;br /&gt;
&lt;br /&gt;
A PHP class to use the new ping protocol to obtain a zone's information is available at [[PHP_ping_client]].&lt;br /&gt;
&lt;br /&gt;
The following is from doc/ping.txt which you can find inside the ASSS distro.&lt;br /&gt;
&lt;br /&gt;
However, the latest version can always be found at http://www.sscx.net/asss/ping.txt&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ping/information protocol&lt;br /&gt;
version 1.0&lt;br /&gt;
grelminar@yahoo.com&lt;br /&gt;
&lt;br /&gt;
-------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
all communication happens over udp on the port one higher than the game&lt;br /&gt;
protocol port. byte order is little-endian. no packet will be larger&lt;br /&gt;
than 512 bytes. everything is stateless.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
option one (the old ping protocol):&lt;br /&gt;
&lt;br /&gt;
client sends a 4 byte packet to the server's ping port. typically the 4&lt;br /&gt;
bytes will be a timestamp, but the server doesn't interpret them.&lt;br /&gt;
&lt;br /&gt;
struct C2SSimplePing {&lt;br /&gt;
	u32 timestamp;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
the server replies with 8 bytes:&lt;br /&gt;
&lt;br /&gt;
struct S2CSimplePing {&lt;br /&gt;
	u32 total;&lt;br /&gt;
	u32 timestamp;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
where total is the current number of fully-connected clients (including&lt;br /&gt;
bots but not including server-internal fake players). timestamp is a&lt;br /&gt;
copy of the client's timestamp.&lt;br /&gt;
&lt;br /&gt;
for asss virtual zones, the total will be the number of fully-connected&lt;br /&gt;
clients in all the arenas belonging to that virtual zone.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
option two (new asss ping protocol):&lt;br /&gt;
&lt;br /&gt;
client sends an 8 byte packet to the server's ping port.&lt;br /&gt;
&lt;br /&gt;
struct C2SNewPing {&lt;br /&gt;
	u32 timestamp;&lt;br /&gt;
	u32 options;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
again, the timestamp isn't interpreted by the server.&lt;br /&gt;
&lt;br /&gt;
options is a bitfield where each bit indicates a request for a certain&lt;br /&gt;
type of information to be returned.&lt;br /&gt;
&lt;br /&gt;
the current defined bits are:&lt;br /&gt;
&lt;br /&gt;
PING_GLOBAL_SUMMARY = 0x01 - global player count information&lt;br /&gt;
PING_ARENA_SUMMARY  = 0x02 - by-arena player count information&lt;br /&gt;
&lt;br /&gt;
the server responds with a variable-length packet.&lt;br /&gt;
&lt;br /&gt;
the first 8 bytes are always the following:&lt;br /&gt;
&lt;br /&gt;
struct S2CNewPingHeader {&lt;br /&gt;
	u32 timestamp;&lt;br /&gt;
	u32 options;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
the timestamp is copied from the client. the options bitfield indicates&lt;br /&gt;
what data is present, and how the following bytes should be interpreted.&lt;br /&gt;
&lt;br /&gt;
note that the options returned might not be the same as the options&lt;br /&gt;
requested, although typically they will be.&lt;br /&gt;
&lt;br /&gt;
if PING_GLOBAL_SUMMARY is included, the next 8 bytes will be:&lt;br /&gt;
&lt;br /&gt;
struct S2CNewPingGlobalSummary {&lt;br /&gt;
	u32 total;&lt;br /&gt;
	u32 playing;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
where total is the number of fully-connected clients, and playing is the&lt;br /&gt;
number of clients that are actually flying around in ships.&lt;br /&gt;
&lt;br /&gt;
if PING_ARENA_SUMMARY is included, the next variable-length sequence of&lt;br /&gt;
bytes will be a series of blocks of this format:&lt;br /&gt;
&lt;br /&gt;
struct S2CNewPingArenaSummaryChunk {&lt;br /&gt;
	char name[]; // variable-length and null-terminated&lt;br /&gt;
	u16 total;&lt;br /&gt;
	u16 playing;&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
arena names that consist of only digits are considered &amp;quot;public arenas&amp;quot;&lt;br /&gt;
and should probably be displayed as &amp;quot;(Public %d)&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
a one-byte chunk with a zero-length name (that is, a single nul byte)&lt;br /&gt;
indicates the end of the series.&lt;br /&gt;
&lt;br /&gt;
note that the sums of the data in the arena chunks may not add up to the&lt;br /&gt;
values in the global summary because of the presence of hidden arenas.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category: Protocol]]&lt;/div&gt;</summary>
		<author><name>Goldeye</name></author>	</entry>

	</feed>