TORQUE_APP_NAME must match to connect?
by Entr0py · in Torque 3D Professional · 11/27/2013 (6:43 am) · 11 replies
Could somebody explain to me why the TORQUE_APP_NAME is so important that client and server must have the same name in order to connect?
#2
11/27/2013 (6:46 am)
It seems to me that it is just confusing for devs rather than serving any meaningful purpose. It should be up to the developers to decide if they want other Torque apps to connect to their servers or not, rather than having to hunt down the reason why their servers and clients are not able to connect.
#3
11/27/2013 (6:52 am)
But each server is usually depending on how the client receives information from it and vice versa, TORQUE_APP_NAME is just a simple way of making sure that the right game is connecting to the right server and it then assumes the client is able to handle the information passed from it. You can remove this check i think in the engine source code.
#4
It's also a simple way to waste developers time trying to figure out why "Game Client" won't connect to "Game Server".
If a player is going to connect to the wrong server he probably shouldn't own a computer, or he should stop trying to hack. TGE is MIT open source, if you are going to rely on TORQUE_APP_NAME to secure your game from foreign clients then you are going to have big problems.
Sure this is good for direct connect connect games, but for dedicated servers it's completely meaningless. If you want to make sure the client is the same app as the server it should be done in script... not hard coded.
11/27/2013 (7:07 am)
"TORQUE_APP_NAME is just a simple way of making sure that the right game is connecting to the right server"It's also a simple way to waste developers time trying to figure out why "Game Client" won't connect to "Game Server".
If a player is going to connect to the wrong server he probably shouldn't own a computer, or he should stop trying to hack. TGE is MIT open source, if you are going to rely on TORQUE_APP_NAME to secure your game from foreign clients then you are going to have big problems.
Sure this is good for direct connect connect games, but for dedicated servers it's completely meaningless. If you want to make sure the client is the same app as the server it should be done in script... not hard coded.
#5
It just seems silly to me and a pointless waste of time, especially in modern games where direct connection matches aren't as popular as dedicated servers. It's not the 90s anymore.
11/27/2013 (7:13 am)
Furthermore, this is new. AFAIK pre-MIT versions of TGE did not require similar appnames. It just seems silly to me and a pointless waste of time, especially in modern games where direct connection matches aren't as popular as dedicated servers. It's not the 90s anymore.
#6
11/27/2013 (7:17 am)
well whenever i was working on the SourceSDK it also had a way similar to this for doing the same thing, stops people from buying one game and using it to connect to all source games online features due to the way clients download files from the servers yano for modding and such, if it was in script there would be nothing stopping someone from say buying half life 2, going into the file that has SOURCE_SDK_APP call in it and renameing it from HL2 to CSGO Counter Strike Global Offensive, then people wouldnt really need to buy CSGO in order to play it cos source does the same thing as torque and downloads the missing files to your pc for you
#7
Nothing is going to stop anybody from downloading the source code and changing it themselves.
11/27/2013 (7:25 am)
Well you do have a point... although the default TORQUE_APP_NAME is the same as the window title (by default for projects generated by project manager). I suppose you could use a secret code for it, assuming it is not exposed anywhere in script for the would-be hacker to find.Nothing is going to stop anybody from downloading the source code and changing it themselves.
#8
11/27/2013 (7:30 am)
I just changed TORQUE_APP_NAME in my source code and the window title stayed the same as before. "TORQUE_APP_NAME" should probably be renamed to something more appropriate to the purpose it serves.
#9
Then the title should show your TORQUE_APP_NAME
11/27/2013 (8:27 am)
Check in the engine source under windowManager/win32/win32WindowMgr.cpp in the createWindow function:// Create the window handle
w32w->mWindowHandle = CreateWindowEx(
dwExStyle,
Win32Window::getWindowClassName(), //class name
String( **CHANGE THIS TO TORQUE_APP_NAME** ).utf16(), //window title
dwStyle, //style - need clip siblings/children for opengl
0,
0,
0,
0,
mParentWindow, //parent window
NULL, //menu? No.
NULL, //the hInstance
NULL ); //no funky paramsThen the title should show your TORQUE_APP_NAME
#10
About changing the window title edit the file <YourProject>/game/main.cs in function createCanvas(%windowTitle) change the Canvas.setWindowTitle() call.
11/27/2013 (8:51 am)
Entr0py: Torque has always required game names to match in order to accept connection requests. Torque uses GameString to filter out unwanted third party games using the same engine and it is defined in engine/game/gameConnection.h for TGE and engine/source/T3D/gameBase/gameConnection.h for T3D. TGE GameString is set explicitly by the macro while in T3D GameString is set by TORQUE_APP_NAME macro instead.About changing the window title edit the file <YourProject>/game/main.cs in function createCanvas(%windowTitle) change the Canvas.setWindowTitle() call.
#11
...but this is my whole point.... 'TORQUE_APP_NAME' is deceptive because It has nothing to do with the name of your app.
@Nathan: Yes I just checked and it has been in since T3D Pro, but it's not in earlier versions.
Anyway here is where it happens:
It is referenced in platformFileIO.cpp as well, but appears deprecated.
So as you can see that is all it is ever used for. Rather than TORQUE_APP_NAME it should be called TORQUE_APP_CHECK or something along those lines to be more clear about what it is used for. It is basically a 'password' used to connect. So yes you could technically use some arbitrary code there to filter out connection attempts or even modify it a bit to have different types of connections.
My initial point still stands though, it's a pain in the ass if you want to have separate projects and you have no idea why their connections are being dropped (you get dropped with no reason given and no errors).
And again, this only happens when you use the Project Manager utility to generate projects. If you don't use it, the variable is the template name you used in torqueconfig.h.
11/27/2013 (9:34 am)
@Andrew - Actually that is getEngineProductString(), not TORQUE_APP_NAME, but you are right you can set it there if you want. You can also set it in script:// Set the name of our application $appName = "Your App Name";
...but this is my whole point.... 'TORQUE_APP_NAME' is deceptive because It has nothing to do with the name of your app.
@Nathan: Yes I just checked and it has been in since T3D Pro, but it's not in earlier versions.
Anyway here is where it happens:
#define GameString TORQUE_APP_NAME
void GameConnection::writeConnectRequest(BitStream *stream)
{
Parent::writeConnectRequest(stream);
stream->writeString(GameString); <---- HERE
stream->write(CurrentProtocolVersion);
stream->write(MinRequiredProtocolVersion);
stream->writeString(mJoinPassword);
stream->write(mConnectArgc);
for(U32 i = 0; i < mConnectArgc; i++)
stream->writeString(mConnectArgv[i]);
}
bool GameConnection::readConnectRequest(BitStream *stream, const char **errorString)
{
if(!Parent::readConnectRequest(stream, errorString))
return false;
U32 currentProtocol, minProtocol;
char gameString[256];
stream->readString(gameString);
if(dStrcmp(gameString, GameString)) <---- AND HERE
{
*errorString = "CHR_GAME";
return false;
}
....It is referenced in platformFileIO.cpp as well, but appears deprecated.
So as you can see that is all it is ever used for. Rather than TORQUE_APP_NAME it should be called TORQUE_APP_CHECK or something along those lines to be more clear about what it is used for. It is basically a 'password' used to connect. So yes you could technically use some arbitrary code there to filter out connection attempts or even modify it a bit to have different types of connections.
My initial point still stands though, it's a pain in the ass if you want to have separate projects and you have no idea why their connections are being dropped (you get dropped with no reason given and no errors).
And again, this only happens when you use the Project Manager utility to generate projects. If you don't use it, the variable is the template name you used in torqueconfig.h.
Thomas Fluff Harris
CTRL-INTELLIGENCE Ltd
U wouldnt want GameB connecting to GameA's servers, least not for any normal reasons that i can think of, is there a reason why you want the names to be different?