Dedicated not working anymore
by David Wilson · in Torque Game Engine · 04/18/2004 (8:35 am) · 17 replies
Since I've broken away from the FPS, and started using Racing as the basis for my game, I can no longer get the "-dedicated" cl option to work.
It seems to get ignored and run right past although I haven't changed any scripting regarding that command. As a matter of fact, no cl options work anymore. I don't get it.
Can someone point me in the right direction here?
Thanks
David
It seems to get ignored and run right past although I haven't changed any scripting regarding that command. As a matter of fact, no cl options work anymore. I don't get it.
Can someone point me in the right direction here?
Thanks
David
About the author
#2
04/18/2004 (2:09 pm)
I have a main.cs in the main "example" folder where the executable is as well as the game folder itself. The one in the game folder handles the "-dedicated" option.
#3
Let me see if I can dig up the changes.
04/18/2004 (2:31 pm)
There's a bug in the code for the racing game. I posted it on the forums, but I don't have the URL. I should probably post the bug to the bug manager. Also, the dedicated server doesn't seem to give control to the player. You have to change the script to do this.Let me see if I can dig up the changes.
#4
04/18/2004 (2:32 pm)
Here's the code I have; compare it to the original and make the changes or just copy this into starter.racing/server/scripts/game.cs:function GameConnection::onClientEnterGame(%this)
{
commandToClient(%this, 'SyncClock', $Sim::Time - $Game::StartTime);
commandToClient(%this, 'SetMaxLaps', $Game::Laps);
// Create a new camera object.
%this.camera = new Camera() {
dataBlock = Observer;
};
MissionCleanup.add( %this.camera );
%this.camera.scopeToClient(%this);
// Client controls the camera by default.
%this.setControlObject(%this.camera);
if($Game::Running)
{
// Create a car object.
%this.spawnCar();
// Orbit the camera around the car
//%this.camera.setOrbitMode(%this.car, %this.car.getTransform(), 0.5, 4.5, 4.5);
//%this.camera.setOrbitMode(%this.car, %this.car.getTransform(), 0.5, 4.5, 4.5);
%this.setControlObject(%this.car);
}
}
#5
04/18/2004 (2:52 pm)
That's great, thanks Mike! I'll search around the forums some more for your post so I can see what became of it.
#6
Or are you saying there's an actual bug in the engine code keeping me from parsing any command line arguments at all if I use racing? I just compared scripts between "fps.starter" and my game folder "vcm", I don't see any reason why cl arguments should stop being parsed, I'm lost.
04/18/2004 (3:08 pm)
Mike, are you talking about this post: www.garagegames.com/mg/forums/result.thread.php?qt=17591?Or are you saying there's an actual bug in the engine code keeping me from parsing any command line arguments at all if I use racing? I just compared scripts between "fps.starter" and my game folder "vcm", I don't see any reason why cl arguments should stop being parsed, I'm lost.
#7
04/18/2004 (3:12 pm)
I strongly disbelieve that it's an actual engine code matter. It's rather a script question, and that's probably what Mike meant too :)
#8
c:\torque\main.cs
c:\torque\starter.racing\main.cs
c:\torque\mygame\starter.racing\init.cs
Replace the directories with your own of course. I took a quick glance and I didint' see anythign obviously wrong with the dedicated cl option under the stock starter.racing, but I didin't test it.
04/18/2004 (3:26 pm)
David can you post, or supply a link, to the following scripts (assuming your torque executabe is in c:\torque and the starter.racing game)c:\torque\main.cs
c:\torque\starter.racing\main.cs
c:\torque\mygame\starter.racing\init.cs
Replace the directories with your own of course. I took a quick glance and I didint' see anythign obviously wrong with the dedicated cl option under the stock starter.racing, but I didin't test it.
#10
04/18/2004 (3:43 pm)
Main.cs from c:\torque\example (part 1)//-----------------------------------------------------------------------------
// Torque Game Engine
// Copyright (C) GarageGames.com, Inc.
//-----------------------------------------------------------------------------
$defaultGame = "vcm";
$displayHelp = false;
//-----------------------------------------------------------------------------
// Support functions used to manage the mod string
function pushFront(%list, %token, %delim)
{
if (%list !$= "")
return %token @ %delim @ %list;
return %token;
}
function pushBack(%list, %token, %delim)
{
if (%list !$= "")
return %list @ %delim @ %token;
return %token;
}
function popFront(%list, %delim)
{
return nextToken(%list, unused, %delim);
}
#11
In bold.
04/18/2004 (3:44 pm)
I think you are missing out a part in that file.In bold.
function parseArgs()
{
Parent::parseArgs();
// Arguments, which override everything else.
for (%i = 1; %i < $Game::argc ; %i++)
{
[b]%arg = $Game::argv[%i];[/b]
%nextArg = $Game::argv[%i+1];
%hasNextArg = $Game::argc - %i > 1;
switch$ (%arg)
{
#13
04/18/2004 (3:46 pm)
I have no clue what file that is, you didn't supply a file name :/
#14
04/18/2004 (3:49 pm)
Grrrrr I can't post properly either. I'm not this messy in real life I SWEAR!
#15
*yet another edit how sad*
I just checked the main.cs in starter racing and the line you pointed out to me was there as well, I must have deleted it somehow.
Thank you!!
04/18/2004 (3:50 pm)
Stefan, That was part two of the same file but I stopped spamming the forums with my script because you found the problem ;)*yet another edit how sad*
I just checked the main.cs in starter racing and the line you pointed out to me was there as well, I must have deleted it somehow.
Thank you!!
#16
Does it work?
Does it still not work?
04/18/2004 (5:29 pm)
Now I'm a bit confused.. Did it already exist but you deleted it in the POST? You almost gave me the impression that now it works.. :)Does it work?
Does it still not work?
#17
Thanks again!
04/18/2004 (5:41 pm)
It works now, the part you posted in bold was missing in my file. I don't know how but I must have deleted it somehow.Thanks again!
Torque Owner John Vanderbeck
VanderGames