Page 1 of 1

LAN Game Server Finder

#1 Ald0s  Icon User is offline

  • New D.I.C Head
  • member icon

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 21-September 14

Posted 23 September 2014 - 10:05 PM

Hi D.I.C,
This will be my first tutorial. This topic is something that used to fascinate me, and so now that I understand it, I will teach you how to do it. It isn't complicated and it's beginner friendly. Are there any issues with my tutorial? Does the end solution not work correctly? Notify me in the replies below. You're allowed to quote this page as long as you paste the link to the page/my profile underneath your post.

Note: Since this is my first tutorial, I invite you to comment on how I do things. For example, I prefer the least bracket formatting when it comes to my code. I can change these things if it would make my code easier to read.

This tutorial will teach you:
- The basics of the Udp protocol.
- The basics of the Broadcast packet type.

- Basic C# knowledge
- .NET Framework, I'm using 3.5 but even 2.0 should work fine.

I will be interacting with Halo: Combat Evolved, which uses the Gamespy protocol. You may choose your own though. At this link (results may vary depending on the game):
GameQ - PHP Game Server Status Library

Once you have downloaded the ZIP file, unzip it. From the root directory, go to GameQ. The two files you need most are games.ini and packets.ini. To find a game, follow these steps:
1. Open "games.ini"
2. Search the text for your game name, I'm looking for Halo: Combat Evolved. Once you've found your game, you should have something like this:
name = "Halo: Combat Evolved"
port = 2302
prot = "gamespy"

Note: I had to correct the port and protocol for Halo: Combat Evolved as the text file has it wrong. The above snippet is what you should use for this game.

From this, we can conclude that Halo: Combat Evolved uses the Gamespy protocol and has a default port of 2302, but we are not done yet. We must find the packet that represents the "status" message. So, open "packets.ini"
For Halo: Combat Evolved, just search for "gamespy", and this is what we are presented with:
status = "\\status\\"
players = "\\players\\"
basic = "\\basic\\"
info = "\\info\\"

Save this information, as we'll need it later. We can now begin programming!

Part 1: The User Interface

It's time for a break. Go grab a drink and walk around for a while.

Welcome back. We have completed our User Interface. Now comes the exciting part!

Part 2: Finding servers and reading the replies

It's time for a break. Go grab a drink and walk around for a while.

Part 3: Using our formatted data

Congratulations! You've just completed the tutorial!

Attached Image

Optional Reading
Conditional (?:)/>/> Operator

Is This A Good Question/Topic? 0
  • +

Page 1 of 1