BDwinsAlt wrote: |
TWCore and Hybrid are bot cores written in Java. So we know it will work. |
Half wrote: |
get a player count for a zone |
Mine GO BOOM wrote: |
[..]
Any language with sockets will work with Subspace. Its not like you are trying to mount a Ford motor in a VW Bug. |
Mine GO BOOM wrote: |
PHP has Sockets which will let you connect with UDP. Just look at the source for some bot cores or on the Wiki for packet information. You can check player counts for a zone just by using the Ping Protocol which will tell you the current ping to a zone and the player count, just like on the main menu of Continuum. |
Code: Show/Hide <?php
$host = "66.36.241.110"; $port = 5901; $fp = fsockopen("udp://".$host, $port); fwrite($fp, pack("V",time()), 4); $total = fread($fp, 4); $timestamp = fread($fp, 4); fclose($fp); echo array_pop(unpack("V", $total)); ?> |
Bob Dole.. Bob Dole... Bob Dole...... bob dole.... bob... dole.... wrote: |
Checks the current population of SSCU 17th Parallel |
Mine GO BOOM wrote: |
[..]
Might as well check the ping while you are at it, as it requires so little code. |
Code: Show/Hide require 'socket'
ip = "66.36.241.110" port = 5901 socket = UDPSocket.open socket.connect ip, port socket.send [Time.now.to_i].pack("V"), 4 data = socket.recvfrom 8 total,timestamp = data.first.unpack("VV") puts "Population: #{total}\n" |
Bob Dole.. Bob Dole... Bob Dole...... bob dole.... bob... dole.... wrote: |
Despite of what Dr. Brain said, could someone add the ping code? |
Code: Show/Hide <?php
function get_ms() { list($msec, $sec) = explode(" ", microtime()); return round(($sec + $msec) * 1000) & 0x7FFFFFFF; } $host = "66.36.241.110"; $port = 5901; $fp = fsockopen("udp://".$host, $port); fwrite($fp, pack("V", get_ms()), 4); $total = fread($fp, 4); $timestamp = fread($fp, 4); fclose($fp); $population = array_pop(unpack("V", $total)); $ping = get_ms() - array_pop(unpack("V", $timestamp)); echo "Population: " . $population . "<br>\n"; echo "Ping: " . $ping . " ms<br>\n"; ?> |
Bob Dole.. Bob Dole... Bob Dole...... bob dole.... bob... dole.... wrote: |
Using the timestamp that the server sent back has no real advantage in such a small script, hasn't it?
The only advantage I see is when you ping multiple zones at once? |
Donkano wrote: |
MGB, that script does work on Windows. Tested it on a Windows 2003 Server computer.
I tried targetting it on SSDV Into the moat and STFU Anything Goes and both timed out. Do you know why? |
Donkano wrote: |
Here is something that I would like to see done:
PHP does the following: Connects to a directory server. Finds all zones starting with with a specific string (to target networks/groups) Lists all those zones with their IP/Port, ping and population Would look something like this for output: SSDV Into the moat - IP: 69.93.119.226 - Port: 3000 - Population: 4 - Ping: 90ms If anyone has the time for this, I would appreciate it. I would like to put it on the SSDV website so that it can display zone information. |
Donkano wrote: |
Here is something that I would like to see done:
PHP does the following: Connects to a directory server. |
Smong wrote: |
[..]
I don't think that's a good idea. There's only one dirserv and a webpage that talks to it could easily be abused. |
Bob Dole.. Bob Dole... Bob Dole...... bob dole.... bob... dole.... wrote: |
Is http://wiki.minegoboom.com/index.php/Directory_Client_Protocol the only information available about the protocol? |
Smong wrote: |
I don't think that's a good idea. There's only one dirserv and a webpage that talks to it could easily be abused. |
Mine GO BOOM wrote: |
There is a feature called caching. If someone goes to the page, and it hasn't been updated in around 5 minutes, check the directory server for a new list. |