Game Development Community

Master Server Console

by Zeph · in Torque 3D Professional · 12/30/2012 (11:01 pm) · 39 replies

Ive been working on a Master Server Console, one that loads with no interface, or pretty graphics, bells or whistles... Just trying to get a dedicated server running in the back ground, where a client can connect to the master server, and query for a list or connect directly to the game server. Without is showing up as a LAN Game.

At the moment, You need click play, and select host, in order to create a multiplayer server. Even when doing this after following countless of tutorials which every single source is outdated, on master server query's. I am stuck with master server query not being returned, and the only thing that shows up is a LAN Query.

So, Ive been attempting to rewrite the Both Main.cs, and along with All Ini.cs. So I can attempt to get a Master Server up by console, instead of having to use an outside source, or have to mess with the engine source by adding more C++ since there already is a source there in C++.

The problem is. No matter how Ive tried to rewrite those starting .cs files, initializing a dedicated server by console. The following two things happen:

1)The Black console window starts up doing what it should to do in creating a dedicated server, but freezes and crashes with a win32 proc d3d error, something about resizing windows 2 instances.

2)When I edit the "function createCanvas(%windowTitle)" to return back false, or remove it completely I end up with no error, but no console shows up, however the service process is left running in the background in services, with no master server showing up on the client when trying to connect.

Seems like the way the start up code with function parseArgs() was written was to defeat the reasoning in making a master server console.. Just seems that way..

Does anyone have any ideas, or solutions to this since everything I can find is outdated, and does not work?


Page «Previous 1 2
#1
12/31/2012 (8:15 am)
You have me confused - you're talking about a "master server" (which is a match-making service to help clients find servers) but your description is "dedicated server." To start a dedicated server you just run T3D with the -dedicated switch on the command line.

So:

T3D -dedicated -mission levels/myStartMission.mis

will start a dedicated server that matches your description perfectly (assuming your executable is named T3D). This is functionality that has worked for over a decade as-is. Attempting to do this the way it sounds like you are is going to be painful and fruitless.

If you're looking to make a master server you need to look at those resources - there are several. In this thread at post 5 I linked a couple of options and there are other resources to set up master servers in PHP and Perl all over if you search the site. You just have to know what information the client will ask for and ensure that the server sends this data to the master server. Then when the client queries the master server it will get a list of available servers.
#2
12/31/2012 (10:27 am)
NOTE:

When specifying the master server address it expects the region to be set - notice the current "2:master.garagegames.com:28002" - you need that "2:" at the beginning of the address! So, if your IP address for your master server is at 51.25.65.85 and on port 28002 then you'd need to specify "2:51.25.65.85:28002" as your master server address in both scripts/client/prefs.cs and core/scripts/server/defaults.cs. To find the line to change, search for master.garagegames.com and replace only that part with your master server's actual IP address.
#3
01/01/2013 (10:17 am)
Sorry about the confusion. When I say Master Server, I mean dedicated via a client server network. Unfortunately even on Google over the years it has come to mean many diff things.. Im kinda Old School.

A server structure like how Ultima Online connects. Either Direct via IP or a list of all available listed games that are hosted by the game company. Ultima Online list had shards. No one should be able to log in and create or host a game Other then myself which normally is up 24/7 and players can log on whenever.

I changed all the code where "2:master.garagegames.com:28002" is involved, doesnt seem to work, The Master Server Query never returns anything back, and the game shows up as a LAN. which leaves me confused.

I dont know if something has changed in the tutorials over the years vs the code, or if its my NAT preventing a server query because Im running both client, and server on the same machine behind a router. Ive done a port forward, and a DNS. I changed fire wall settings to allow certain Apps in, and out. I even totally disabled shortly all firewalls, and put m router into DMZ mode. I changed my IP to static, I tried both localhost, and by IP as well. Nothing seems to be working so Im confused as to if its my side or ISP side, or something in the code.

I attempted to borrow a friends lap top so I can trouble shoot, and find out if the problem is outside or inside but its in the shop getting repairs.

The part on T3D -dedicated -mission levels/myStartMission.mis . I attempted this via command via another tutorial, and nothing happened cmd doesnt except it returns an error. But I will attempt to try again maybe My paths were off.

I thought maybe the game was showing up as a LAN host due to clicking host to lunch the game via in game menu vs running in console mode. I thought maybe if I ran in console mode instead it will show up in a master server listing.

Just to add that I know about renting servers also, but Im just developing both client, and server on one computer. Doesnt make sense to rent a server on the internet to just see if the code works or for early development stages.
#4
01/01/2013 (11:28 am)
Richard I took a look at your script, art/gui/joinServerDlg.gui file.

I launched a game from the server client via in game menu host check boxed. Then I launched a second game clicked join on the client, and in the Join server DLG this is what I get.

The LAN Query shows up as
Server Name: mygame Ping:184 Players 1/64 version:1100 Game:EmptyRoom

Master Server Query hangs returns nothing. When I click cancel it returns as nothing. When enter Ip direct, and click query this server, it hangs, and the does give a return. It states:

Server Name: mygame Ping:178 Players 1/64 version:1100 Game:EmptyRoom

But when entering IP direct this query does not work until after clicking query LAN. If I attempt to click Query IP Direct it just hangs and sits there forever until I click cancel. Then when I click Master query nothing shows same. Then When I click LAN query it returns the information. After doing this if I click IP Direct Query it wont hang but will return the same information as the LAN Query.

I also enabled IP routing In command prompt which was off for some reason. WINS PROXY is disabled not sure if I need that on.

Three questions come to mind when making two clients, one being the server client which will run the server, and then the player client who connects to the server.

1) Does enabling Master0 = "2:master.xxx.xx.xxx.xxx:28002"; matter on either server client vs player client? Does this need to be on both or do I just enable this on the player client, and leave the server client as default to off?

2) Does launching the server host via in game menu make a huge difference in the type of multi player game vs launching the server in console mode via command prompt. In other words will launching the game server in host via in game menu check box host game always show up as a LAN Game, where as launching the server via console might show up as a master server dedicated game?

3) A person behind a router can have few types of IP addresses. You have your IP4 address (preferred), Default gateway, DNS IP address, Your Internet address the one when you Google whats myip, and then local host. Which of those IP addresses do I actually use?
#5
01/01/2013 (12:51 pm)
I also attempted to launch the server via console as
Master Server.exe is the default name of the server located on D:Program filesTorque3DMy ProjectsMaster Servergame

The default Client is named Master Server Client Test, and located under D:\Program files\Torque3D\My Projects\Master Server Client Test\game

I tried this different ways, and This is My error result in command prompt:

C:Windowssystem32>T3D -dedicated -mission levels/myStartMission.mis
'T3D' is not recognized as an internal or external command,
operable program or batch file.

C:Windowssystem32>Master Server -dedicated -mission levels/Empty Room.mis
'Master' is not recognized as an internal or external command,
operable program or batch file.

C:Windowssystem32>Master Server.exe -dedicated -mission levels/Empty Room.mis
'Master' is not recognized as an internal or external command,
operable program or batch file.
#6
01/01/2013 (3:00 pm)
Looks like the master server is currently down. That's probably your main problem.
#7
01/01/2013 (9:56 pm)
Quote:
1) Does enabling Master0 = "2:master.xxx.xx.xxx.xxx:28002"; matter on either server client vs player client? Does this need to be on both or do I just enable this on the player client, and leave the server client as default to off?

2:master.xxx.xx.xxx.xxx:28002 - ??? You should be using 2:xxx.xxx.xxx.xxx:28002 for your address - unless you're doing something really weird on your network. Re-read post 2. This needs to be set up the same for clients and servers - not a problem since the same script should be distributed with and used by both client and server anyway.

Also note that changing the location that the game looks for a master server won't do it any good unless you actually have a master server running there. Please see this thread for more information on setting up your own master server.

Quote:
C:Windowssystem32>T3D -dedicated -mission levels/myStartMission.mis
'T3D' is not recognized as an internal or external command,
operable program or batch file.

Ok, is your game compiling to "T3D.exe"? if so, is it compiling into that directory? If it is; WHY?!?

You should be at the command prompt in your project game folder (D:Program files/Torque3D/My Projects/Master Server Client Test/game per your last post).

Then you would run your game executable with the command line options specified. Levels are in the "levels" folder under the "game" folder. So, having started a command prompt and navigated to your game folder, your command line should look something like the following:

Your game executable name -dedicated -mission "levels/your preferred starting mission file name.mis"

Where Your game executable name is the name of your game executable and your preferred starting mission file name is the name of your starting mission file that you have made for your game. I'm using quotes around the mission name in case there are spaces in the file name.

To recap - you have to actually run your game executable with the specified command line options for it to start a dedicated server. I apologize for not being more specific in my earlier posts - I made several assumptions that I apparently should not have.
#8
01/02/2013 (11:18 pm)
Richard.

Ok So I made a .bat file to double test things to ensure things are running correctly, and window is finding the .exe correctly via command prompt.

This is what I used in the .bat:

@echo off

start "" "D:Program filesTorque3DMy ProjectsMaster Server.exe"

T3D launches, and loads fine to the default play menu. Then I attempt to add the -dedicated at the end on another .bat file, and the system is not recognizing which leaves:

is not recognized as an internal or external command, operable program or batch file.

I know when I have launched other games non T3D related before in the past created by other developers -dedicated works fine. But for some reason in the T3D its not working. Which is why I thought earlier something is wrong with the main, and ini code, and has changed, which required a rewrite. Ive read Your post, as well as others, and Ive noticed other people are having the same issue.

Ok so right now, Im changing Directory structures. Im going to do 2 test, and Place T3D in both the root of D:drive, and C:drive. I really dont want to use C: because I have limited space. Set it up just for O/S files. But, for testing should be ok.
#9
01/03/2013 (6:46 am)
I'm not sure why you're using
start "" "D:Program filesTorque3DMy ProjectsMaster Server.exe"
(I'm assuming your backslashes got removed by the forum) - normally a folder is created in My Projects with your project name and then within that your executable is normally located within the game sub-folder - but if you're using the MIT release this might be different.

Regardless, where are you adding the -dedicated flag? It should be outside of the quotes.

For a project I have this is the batch I created to test this, and it works fine:
"E:\Torque\Torque 3D 1.2\My Projects\RTS2\game\RTS2.exe"  -dedicated -mission "levels\empty terrain.mis
Note that I added a quotation mark in front of my level path because there are spaces in the file name. Also, I ignored the <start ""> portion entirely - I simply entered this as it would have been executed from the command line directly.
#10
01/03/2013 (8:55 am)
I highly recommend reading the command line reference - it will help greatly with this issue....
#11
01/13/2013 (5:45 pm)
Richard.

I had My quotes in the wrong place like an idiot. I had -dedicated and -mission both inside the main D: quote lol.

The Console Launches now initializing the server But it says No master servers found, and I need to take a look at the scripts/main.cs (138): Unknown command onExit.

Here is the copy, and past from the console window:

%
--------- Starting Dedicated Server ---------
Exporting server prefs...
Starting multiplayer mode
Binding server port to default IP
UDP initialized on port 28002
ParticleData - TeleporterFlash(24) - invalid value for dragCoefficient: Must be
between 0 and 5
ParticleData(GLWaterExpDust) times[2] < times[1]
ParticleData(RLWaterExpDust) times[2] < times[1]
ParticleData - RocketLauncherfiring1Particle(155) - invalid value for dragCoeffi
cient: Must be between 0 and 5
ParticleData - RocketLauncherfiring2Particle(157) - invalid value for dragCoeffi
cient: Must be between 0 and 5
Warning: shape art/shapes/weapons/Turret/Turret_Legs.DAE collision detail 0 (Col
lision-1) bounds exceed that of shape.
Warning: shape art/shapes/weapons/Turret/Turret_Legs.DAE collision detail 0 (Col
lision-1) bounds exceed that of shape.
Warning: shape art/shapes/weapons/Turret/Turret_Legs.DAE collision detail 0 (Col
lision-1) bounds exceed that of shape.
ParticleData(LightPuff) times[2] < times[1]
*** LOADING MISSION: levels\Empty Room.mis
*** Stage 1 load
*** Stage 2 load
Game -> activatePackages
*** Mission loaded
*** ENDING MISSION
1884 -> deactivatePackages
Exporting server prefs...
Exporting client prefs
Exporting server prefs
scripts/main.cs (138): Unknown command onExit.
Engine initialized...
Bad master server address: 2:master.xxx.xx.xxx.xxx:28002
No master servers found
%
#12
01/13/2013 (7:45 pm)
I tried using 127.0.0.1 , and the DNS sandboxgames.servegame.com for the IP address of the master server just to double check, and Im getting the same Bad master server address.

I was curious so I tried a tracert

Tracing route to sandboxgames.servegame.com/ [xxx.xxx.x.xxx]
over a maximum of 30 hops:

1 <1 ms <1 ms <1 ms sandboxgames.servegame.com/ [xxx.xxx.x.xxx]

Trace complete.
#13
01/14/2013 (6:03 am)
Is there a master server running at that address?
#14
01/14/2013 (11:02 pm)
Doesnt Torque set the master server up when it runs dedicated/multiplayer, just like when You click host/multiplayer?

Just as a reminder I'm doing everything on one computer for now, and design.


Update
Ok I did a bit more research. A question comes to mind. I basically will be hosting the multiplayer game, and there should be one server for all clients to connect to. When I host the game by GUI check host box it doesnt ask for a master server listing, But when I launch by console it wants to look for a master server listing.

I just wanted to be able to host the game without having to launch the game without all the graphics by console as its starting currently. I already have the ability to host a internet web site from my computer which will also host and be the game server.

I really dont need a list of multiple servers since there is one server that any player will ever see. This is not a multiplayer FPS Shooter concept with different maps to choose from. However there might be different zone clusters as players change maps automatically as they run around, and change zones. So a client never needs to see a list of servers since there is one server/one world.

The player will log into the game with a username and password by the client, and connect to the game world after clicking play. I was even thinking of using the launch game in browser window function that torque 3d offers.

Would I really need a master server for the console to work as I desire? Wouldnt a direct hard code IP connection be more in terms of what I speak of? Im trying to get the console to launch a server without showing the 3d world without a list of maps, and just one direct connection for clients to connect to. Eventually The Server will get ported over to another Machine with no graphics card.
#15
01/15/2013 (6:18 am)
No.

A "master server" has no connection to the game server except that the game server asks the master server to list it so that clients can find it, get information about it and connect to it.

World of Warcraft and Star Wars: The Old Republic use master servers - that's how they give you a list of "worlds" or "realms" to connect to.

If you use the connection GUI I linked in that other thread as an example, you could remove the ability to select or enter an address and simply call connect() directly with your server address when they click "Play" or whatever.
#16
01/15/2013 (6:53 am)
Hi Zeph...

Another way of expressing what Richard is trying to say is this:


Master Server
- this is NOT an instance of T3D, it is a stand-alone simple script or program, all it does is sit running in a command prompt window and waits for connections
- there are versions written in Perl and PHP and other languages, several to choose from depending on what environment you are running this all on
- you find one of these scripts and start it running, then let it wait for connections

Dedicated Game Server
- this is an instance of T3D, but run from a .bat file which has the "-dedicated" switch at the end of the line
- the prefs files for this server instance should be configured with their "master server" address as being the IP of the "master server" running above, with any prefix that T3d requires as well as the port (ie. 2: at the beginning should be hardcoded for the region, then the ip address, then another : and then the port... example 2:master.yourwebsite.com:28000)
- when the dedicated server is done loading, it will broadcast its location to the "master server" above, which will log that as an available game to join

Client Computer
- all client computers should have the same value for "master server" set in their prefs files, to match what the dedicated server is broadcasting to
- run T3D in normal mode from this computer, and when you click Query Lan you should see the dedicated server if it is on your LAN
- if you click Query Master, your client will connect to the IP specified in prefs as the "master server", and will ask for a list of available games... the master will send that back and they will appear in the client "join server" window


IMPORTANT NOTES:

- I have my "master server" running on my web server which is hosted on the Internet, so that people who download our game can connect to it and see who else is playing

- in this configuration, where both your dedicated server and your client are on the same LAN behind a router, and the master is out in the cloud, your client computer may get a response from the master but will likely NOT be able to join it, and may not even get a response...

-this is because the dedicated server is broadcasting its IP to the master through your router, and then the client is attempting to go out through that same router, and then connect back to the external IP address, which confuses it...

-in that scenario you would use Query LAN to connect to your dedicated server, while users out on the Internet would use Query Master - which would hit your web server to get a list of games, then would connect the user into your network through your router using the information the master server got from the broadcasting dedicated server


So... Clear as mud? This is actually pretty straight forward.

The key thing here is to note the difference between "master" and "dedicated" servers... Whatever terminology you are used to is irrelevant, your idea of a "master" is really a "dedicated" server... In the T3D world, a "master" server is not a game server at all, it is effectively just a broker that receives broadcasts from one or more game servers, and then can send that list to users who request it through Query Master...

And then it will connect users into the games. Once that has occurred it simply goes back to waiting for connections and broadcasts and queries. It never launches the game nor does any heavy processing. It's just a simple connection broker program.

Hope this helps, cheers.
Paul
#17
01/15/2013 (10:22 am)
Quote:
"- in this configuration, where both your dedicated server and your client are on the same LAN behind a router, and the master is out in the cloud, your client computer may get a response from the master but will likely NOT be able to join it, and may not even get a response...

-this is because the dedicated server is broadcasting its IP to the master through your router, and then the client is attempting to go out through that same router, and then connect back to the external IP address, which confuses it... "

i do not have a router.my connection established through a wimax modem.and my friend is hosting t3d full template from another Broadband connection through telephone line.
everytime we failed to connect.
is there any way to establish a connection between us?

i am confused about this router settings.i have no knowledge on that side.
so was wondering why battlefield or call of duty and others multiplayer games do not need a master server or a router settings ?


we simply type server ip address on their console and every time they successfully connected.
why not same happened with t3d?!
#18
01/15/2013 (11:00 am)
In addition to what Paul said, if you're hosting from behind a router you will need to ensure that your router forwards the necessary ports to your server.

Battlefield or Call of Duty are using a different (read that as "newer") connection system. I'm pretty sure it works in a similar (but transparent to the user) manner.

If your IP address changes every time you connect to the internet it makes connecting one to the other much harder - it doesn't matter what game you're playing, they need to find and match up these addresses somehow. If you look at this thread at post #8 and 9 (specifically post 9 around line 300 - the whole join() function really) you'll see that you should easily be able to connect directly to a server - that server would still have to be listening on the correct ports and those ports would have to be forwarded to the server correctly.

You can find your current IP address by accessing your router's or modem's setup address and looking for your "WAN IP address" - this is the address that is presented to the outside world. Your modem may not have this information - in that case, from the command line you can get your current IP address by typing ipconfig. This will list all network hardware addresses currently in use on the local machine.
#19
01/15/2013 (11:35 am)
"You can find your current IP address by accessing your router's or modem's setup address and looking for your "WAN IP address""

may be it have that option but i dont know.have to ask my wimax provider.


"from the command line you can get your current IP address by typing ipconfig"

it shows this:


Windows IP Configuration


Ethernet adapter Bluetooth Network Connection 3:

Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :

Ethernet adapter Local Area Connection:

Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : fe80::20ba:e54f:9052:2349%11
IPv4 Address. . . . . . . . . . . : 192.168.1.139
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.1.1

Tunnel adapter isatap.{56336509-F1A8-41B7-BFF7-24E451B2B0B3}:

Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :

Tunnel adapter isatap.{7BCE30C8-E3E9-4CC8-9FB0-98F82A40717F}:

Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :

Tunnel adapter Teredo Tunneling Pseudo-Interface:

Connection-specific DNS Suffix . :
IPv6 Address. . . . . . . . . . . : 2001:0:9d38:6ab8:3832:1993:c59e:89c
Link-local IPv6 Address . . . . . : fe80::3832:1993:c59e:89c%12
Default Gateway . . . . . . . . . : ::


don't know which one actually i am looking for.i have tried to get the location using "192.168.1.139" from this site:
http://www.hcidata.info/host2ip.cgi

but that also failed to connect. :(
#20
01/15/2013 (12:52 pm)

Ethernet adapter Local Area Connection:

Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : fe80::20ba:e54f:9052:2349%11
IPv4 Address. . . . . . . . . . . : 192.168.1.139
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.1.1


192.168.x.x - standard household LAN address setup for devices that support multiple internal connections (like a router or modem).

So yup - you're behind a firewall or NAT device - your modem is providing your computer an IP address and there's no way to tell what ports are forwarded unless you can get to the modem's configuration system. You should be able to find out how by referencing the modem's documentation.

Same thing goes for your friend - whoever hosts must have a clear line to their machine from the internet. The outside client should not have to worry - it's like requesting a web page, once you request a connection the router should deal with it correctly (but problems have been known to arise).
Page «Previous 1 2