Alternative methods for server listings

Blitz3D Forums/Blitz3D Programming/Alternative methods for server listings

RifRaf(Posted 2011) [#1]
Right now I'm using a modified gnet listing on my website to hold server listings.. but couldn't you use other free services for listings, I'm not sure how to use IRC from code but couldn't each server create a user in this channel with the ip info stored in the name or something, then just log off irc if the server closes.. then clients could check connected servers via irc chat room ??

could that work? if you have any other ideas please share them

Last edited 2011


Rroff(Posted 2011) [#2]
Your suggesting creating each server a client thats connected to a chat room? its feasible and a simple IRC client is actually quite simple to create and you can store information in the client info (other clients can right click on the name and show info on that "person")


RifRaf(Posted 2011) [#3]
Rroff, yes but I don't actually want a chat room visible or anything .. just use code to connect a game server to an IRC server and keep them alive in there with the minimal amount of communication to the irc server.

Then the game clients can (in code as well, no real chat room) connect , retrieve the connected servers (irc clients) info and disconnect from irc

that was my idea anyway, not sure how easy or hard it would be.

I would like to make this for B3D in an include where it can all be achieved in the background with just a few commands such as

IRC_CreateClient(irc_address$,my_clientinfo$)
IRC_KEEPALIVE()
IRC_DISCONNECT()
IRC_RETRIEVESERVERLIST(irc_address$,my_clientinfo$)

Last edited 2011


Rroff(Posted 2011) [#4]
Yeah its fairly trivial to write a very simple IRC client inside your game server that does the minimal to connect to an IRC server, join a channel and idle in it.

I used the RFC and other technical links from the middle box at the bottom of this page to write a simple IRC client.

http://www.mirc.com/help.html

Unfortunatly I coded the IRC client inside mIRC using mIRC's built in scripting capabilities just out of interest and its part of a more complicated "bot" script but I'll reproduce it here if your interested (tons of ancillary code tho).


Essentially you open a socket to the IRCd and send:

NICK <name> CRLF
USER <name> localhost localhost :<clientinfo string> CRLF

It will probably then fail IDENT unless you setup IDENT but most IRC servers will still let you join.

You can join a channel with JOIN <channel name> CRLF and exit the server with QUIT :<reason> CRLF

Obviously you don't send CRLF but a carriage return/line feed... from B3D may not even need to manually enforce it.

You will need to monitor for (and in some cases respond to) a small numer of IRC events tho like: PRIVMSG, PING, VERSION, FINGER and various codes for handling NICK clashes/enforced changes like 431, 432, 433 and 436 or you will get booted off the server.

You probably need to handle client mode changes as well.

Last edited 2011


Rroff(Posted 2011) [#5]
Oh for the game client retrieving server list again pretty trivial - connect and join the same channel on the IRC server and then get the connected user list and walk those users pulling information off each one pertaining to the currently active servers.


RifRaf(Posted 2011) [#6]
Thanks for the information Rroff, ill tinker with this later tonight.


Rroff(Posted 2011) [#7]
The RAW numeric reference here is invaluable

http://www.mirc.net/raws/


RifRaf(Posted 2011) [#8]
wow, looks like some nice person already posted an IRC lib in the achives.
Thanks for that.
http://www.blitzbasic.com/codearcs/codearcs.php?code=2804

Is there a list of dependable IRC hosts that may be better used than others for this purpose ??

Last edited 2011


Rroff(Posted 2011) [#9]
Oh nice that even covers getting the nicklist - tho you probably need to add a couple more event monitor states as well as ping for stuff like nick collisions, etc. otherwise your client will get thrown off the network relatively frequently.

AFAIK the biggest (UK) game related network is http://www.quakenet.org/ and been operating a fair few years... tho for your useage you'd probably have to get permission to use a channel in that way.

EDIT: Also his code seems to try to join a channel either immediatly after connect or after an enforced wait... afaik neither of those methods is reliable (and probably why he had problems with it) or a good way to do it, instead monitor for either a 001 RAW event (welcome to server) or better if the server is configured correctly wait for the server to either return 422 or 376 (should check for either) which marks when the server has finished sending MOTD at which point it will be ready and waiting for your commands then try to join channels.

EDIT2: Actual nicknames usually have to conform to certain character regulations and are limited in length so putting a server IP or other data into the name itself isn't going to work most likely, however this info can be packed into the client info area which has fields for things like first name, last name, email address, etc. which can be got from a simple query on that nick.

Last edited 2011