Game Development Community

Silly C2 and his crazy TSE problems.

by Chris Byars · in Torque Game Engine Advanced · 01/08/2007 (12:47 pm) · 8 replies

Got another weird one; just need some ideas about figuring out what would cause one of these crazy bugs.

I changed something in the engine apparently, or it could be just an MS3.5 to MS4 bug, because I don't remember when this started happening, because I haven't been doing multiplayer or suicide in-game lately.

I have a code snippet within game.cs's GameConnection::onDeath function that sends some client commands over to do a few things. Here's my onDeath function.

function GameConnection::onDeath(%this, %sourceObject, %sourceClient, %damageType, %damLoc)
{
 
   %this.schedule(4000, spawnPlayer);
   commandToClient(%this, 'RespawnCountdown');
   commandToClient(%this, 'TurnOffZoom');
   commandToClient(%this, 'TurnOffHUD');
   commandToClient(%this, 'HealthNotLow');

   // Clear out the name on the corpse
   %this.player.setShapeName("");

   //reset AmmoAmountHud
   %this.setAmmoAmountHud("0");

   //reset GrenadeAmountHud
   %this.setGrenadeAmountHud("0");

   %this.clearWeaponInformationHud();

   //reset HealthAmountHud
   %this.setHealthAmountHud("0");

   // Switch the client over to the death cam and unhook the player object.
   if (isObject(%this.camera) && isObject(%this.player)) {
      %this.camera.setMode("Corpse",%this.player);
      %this.setControlObject(%this.camera);
   }
   %this.player = 0;

   // Doll out points and display an appropriate message
   if (%damageType $= "Suicide" || %sourceClient == %this) {
      %this.incScore(-1);
      messageAll('MsgClientKilled','%1 committed suicide.',%this.name);
   }
   else {
      %sourceClient.incScore(1);
      messageAll('MsgClientKilled','%1 was killed by %2.',%this.name,%sourceClient.name);
      if (%sourceClient.score >= $Game::EndGameScore)
         cycleGame();
   }
}

If I swap in the old MS3.5 executable:
-Death message works
-Death animation works
-Turns off zoom when dead
-Respawn countdown works
-Respawn 4000 ms after death
-Death (orbit) camera is used if death occurs

If I use my current MS4 .exe:
-No death message
-Sticks to last animation before death
-Zoom remains on though dead
-No respawn countdown
-Crash within 5 seconds of death
-Respawn 4000 ms after death
-Death (orbit) camera STILL is used if death occurs

What I don't get is how the death cam works, and the respawn schedule works, though the other stuff doesn't. No script compile errors either. Or engine compile errors. (And no it's not script side, as far as I can tell, there's not any differences in any of the relevant files)

A big WTF from me. :)

#1
01/08/2007 (1:01 pm)
Are those messages getting across at all, anyway? I suppose you placed some echoes in there to see if they did? It's odd that your death message and the countdown timer isn't working, but considering that you seem to mix client and server code I'm not surprised.
#2
01/08/2007 (1:03 pm)
Don't worry, I understand client to server and vice versa command code now, and how the actions are executed. I just don't get what engine change would have caused such a thing, scripts are identical.
#3
01/08/2007 (1:06 pm)
That has nothing to do with my questions. My point was that you need to isolate the issue somewhere, and I'll bet my right foot that it's not the source. If there is an echo on the client, then you can rule out networking. Then proceed with the next area, etc.

There has been almost no changes to the networking since MS3. And the few changes that exist are mostly cleanup and tag changes.
#4
01/08/2007 (1:11 pm)
Okay, so why would changing the .exe back to the 3.5 version, same scripts, solve the problem?

I get an invalid packet sometimes when it crashes as well.
Final moments of the console.log:
keyboard0 input device acquired.
keyboard0 input device unacquired.
Mapping string: Suicide to index: 4
[b]GameConnection::onDeath has been called
The command to send the suicide message has been called.[/b]

fps/server/scripts/player.cs (1032): Unable to find object: '' attempting to call function 'getName'
[b]Connection error: Invalid packet GameBase::unpackUpdate().[/b]
fps/client/VMPlayer.cs (1570): Unable to find function alxIsPaused
fps/client/VMPlayer.cs (1570): Unable to find function alxIsPaused
fps/client/VMPlayer.cs (1570): Unable to find function alxIsPaused
fps/client/VMPlayer.cs (1610): Unable to find function alxUnpause
fps/client/scripts/serverConnection.cs (169): Unable to find function clearTextureHolds
CDROP: 1927 local
keyboard0 input device acquired.
keyboard0 input device unacquired.
mouse0 input device unacquired.
DirectInput deactivated.
Exporting client prefs
Exporting client config
Exporting server prefs
Exporting client prefs
Exporting server prefs
fps/client/VMPlayer.cs (1570): Unable to find function alxIsPaused
fps/client/VMPlayer.cs (2442): Unable to find function alxIsPaused
Cur. D3DDevice ref count=1

The echo placed in the respawn countdown function (client side) that was supposed to be called did not get echo'd, so it would seem that the client functions are not being called, for whatever reason. They used to be.
#5
01/08/2007 (1:15 pm)
There is an error in the orbit camera if I recall - ran into it, and posted something not long ago.

Lemme see if I can find it

-----

Edit:

Bottom of this thread:

http://www.garagegames.com/mg/forums/result.thread.php?qt=50875

Buggers introduced in MS4
#6
01/08/2007 (1:20 pm)
You never mentioned that you got a Invalid Packet before.

Ah doh, the famous orbit camera "fix". They tried to fix the jittering in MS3 (TGE 1.3 too) and had a packet mismatch in there.
#7
01/08/2007 (1:39 pm)
After making the code change as outlined in that thread, as soon as death occurs, the crash happens instantaneously (Encountered a problem and needs to close).

However, the echoes are all called now, and I can see in the console that all the clientCommands in the GameConnection::onDeath function above are being called now. (It seems as if Thomas, your problems were exactly what I am experiencing now)

Final moments of the game, all below are death related messages that weren't working before:
GameConnection::onDeath has been called
The command to send the suicide message has been called.
Mapping string: StopEnergyLowSound to index: 0
Mapping string: RespawnCountdown to index: 2
The respawn countdown has been called.
Mapping string: TurnOffHUD to index: 3
Mapping string: HealthNotLow to index: 4
Mapping string: MsgClientScoreChanged to index: 5
#8
01/08/2007 (2:53 pm)
www.ion-productions.com/victory.jpg
After removing some old screwed up code in the source which seemed to conflict with Thomas's fixes, EVERYTHING WORKS AMAZINGLY. Including no more jitter or flickering on death in the orbit cam, and all of the clientCommands work flawlessly.

My gratitude to all of your help is huge. :) Thanks.