Starter.racing doesn't work in multiplayer
by Andrea Bigiarini · in Torque Game Engine · 07/02/2004 (11:54 am) · 5 replies
Sorry to bother you all again with noobs anwers but everybody in his life is a noob on something...
If you try to play "starter.racing" on lan (and maybe via web) the client coonnected car is placed under the terrain (think is a 0,0,0 position for Torque) and querying the lan the game hosted return, in the server list, as "FPS Starter Kit".
I saw in the mission editor and I've found 6 spawn spheres with ID from 1359 up.
Think that these markers are for the additional net players.
Where I peek to correct this respawnig problems?
THX
Andrea
If you try to play "starter.racing" on lan (and maybe via web) the client coonnected car is placed under the terrain (think is a 0,0,0 position for Torque) and querying the lan the game hosted return, in the server list, as "FPS Starter Kit".
I saw in the mission editor and I've found 6 spawn spheres with ID from 1359 up.
Think that these markers are for the additional net players.
Where I peek to correct this respawnig problems?
THX
Andrea
#2
But you can't move. I'm guessing there's some initialization in the server that needs to be done. Like, don't start game until X clients have connected or something. I'm going to play with it more and see what I can find out! (My first little game with Torque will be a racing game, so this is a good exercise!).
-skinny
07/03/2004 (10:17 am)
You need to go further up the call stack to figure out why the spawn points are not working. If you look at GameConnection::onClientEnterGame in server/scripts/game.cs, you'll see that the pickSpawnCode is only called when $Game::Running is false. If you take out that check, you'll spawn on the track somewhere. But you can't move. I'm guessing there's some initialization in the server that needs to be done. Like, don't start game until X clients have connected or something. I'm going to play with it more and see what I can find out! (My first little game with Torque will be a racing game, so this is a good exercise!).
-skinny
#3
1. Variables:
Add these two lines after $Game::Laps = 2;
// Holds the handle to the timer that will start the game.
$Game::startSchedule = 0;
// how long to wait to start game after last client connected.
$Game::startGamePause = 10000;
2. Remove "startGame" from the onMissionLoaded event.
3. In onClientEnter, add this lines after: this.camera.setOrbitMode
scheduleGameStart();
4. Finally, add this function to the end of the file:
function scheduleGameStart()
{
if ($Game::startSchedule != 0)
cancel($Game::startSchedule);
$Game::startSchedule = schedule($Game::startGamePause, 0, "startGame");
}
What this does is schedule the game to be started 10 seconds after a client joins. So if two clients join, it'll cancel the first timer and reschedule it to start 10 seconds after the second client joins.
To make this nice, you'd have to have a UI letting people know how long it'll take for the next race to start. But this should be a good base to start with.
Oh yeah, I've only tested this with one client and a dedicated server. So there may be a bug with multi-clients. ;)
-skinny
07/03/2004 (10:42 am)
Ok, I've figured out a quick hack to make stuff playable. In server/scripts/game.cs:1. Variables:
Add these two lines after $Game::Laps = 2;
// Holds the handle to the timer that will start the game.
$Game::startSchedule = 0;
// how long to wait to start game after last client connected.
$Game::startGamePause = 10000;
2. Remove "startGame" from the onMissionLoaded event.
3. In onClientEnter, add this lines after: this.camera.setOrbitMode
scheduleGameStart();
4. Finally, add this function to the end of the file:
function scheduleGameStart()
{
if ($Game::startSchedule != 0)
cancel($Game::startSchedule);
$Game::startSchedule = schedule($Game::startGamePause, 0, "startGame");
}
What this does is schedule the game to be started 10 seconds after a client joins. So if two clients join, it'll cancel the first timer and reschedule it to start 10 seconds after the second client joins.
To make this nice, you'd have to have a UI letting people know how long it'll take for the next race to start. But this should be a good base to start with.
Oh yeah, I've only tested this with one client and a dedicated server. So there may be a bug with multi-clients. ;)
-skinny
#4
I'm testing the TGE with the possibility to make a race game but I've found another big problem.
And this I think is a real pain in the A$$ ...
With WheeledVehicle you can't apply a Physical Zone :((
My idea was to alter some parts of the track with crazy gravitational effects.
I asked this in the forum without reply only one "wrench boy" say to take a look in the wheeledvehicle.cc and search why .....
Oki doki buddy, put my big hands on your code and see what's happen!
Greets from Roma.
Andrea
07/04/2004 (5:25 am)
Thx Brian check out the code now.I'm testing the TGE with the possibility to make a race game but I've found another big problem.
And this I think is a real pain in the A$$ ...
With WheeledVehicle you can't apply a Physical Zone :((
My idea was to alter some parts of the track with crazy gravitational effects.
I asked this in the forum without reply only one "wrench boy" say to take a look in the wheeledvehicle.cc and search why .....
Oki doki buddy, put my big hands on your code and see what's happen!
Greets from Roma.
Andrea
#5
But the respawn is made in the same SpawnSphere==sandwich respawn one on the other.
Tell me if you need something for you (graphics, interfaces, 3D) so I can exchange the favor.
I'm mostly a designer
Cheers
Andrea
07/04/2004 (5:44 am)
IT WORKS!But the respawn is made in the same SpawnSphere==sandwich respawn one on the other.
Tell me if you need something for you (graphics, interfaces, 3D) so I can exchange the favor.
I'm mostly a designer
Cheers
Andrea
Torque Owner Andrea Bigiarini
I think this is the main handler for respawn.
*******************************************************
function pickSpawnPoint()
{
%groupName = "MissionGroup/PlayerDropPoints";
%group = nameToID(%groupName);
if (%group != -1) {
%count = %group.getCount();
if (%count != 0) {
%index = getRandom(%count-1);
%spawn = %group.getObject(%index);
return %spawn.getTransform();
}
else
error("No spawn points found in " @ %groupName);
}
else
error("Missing spawn points group " @ %groupName);
// Could be no spawn points, in which case we'll stick the
// player at the center of the world.
return "0 0 300 1 0 0 0";
}
Why the client connected always respawn at "0 0 300 1" even there is 5 free spawn spheres free?
What I miss??
Grazie a tutti (Thanks all)
Andrea