[T3D error] Cannot go back in time. (Flux capacitor unavailable -- BJG) [fixed]
by JesseL · in Torque 3D Professional · 11/04/2009 (5:31 pm) · 5 replies
So, I was happily scripting my game in debug mode. And then I was owned by the Fatal - Sim::postEvent: Cannot go back in time. (flux capacitor unavailable -- BJG).
It means that there is some Sim Group object that called a schedule with a Negative number.
example %obj.schedule(-1, 0, 'doSomething', %value1);
Does this mean I have too many scripts trying to run at the same time? Did I cap the engine or what?
Let me give you the functions that I was running and explain it a little better. I'm creating a dungeon builder kind of game. I have been for a while now. It is suppose to be part of a larger game that I want to eventually make but I wanted to see if the concept would still be fun so, anyways.
Ok. This code takes some time to run about 107 seconds on a debug build after adding the frame allocation resource. So after all 540 ish static room objects get created they have to be ghosted out to the clients. Lets just say I'm pushing the engine because sometimes I get the rooms and sometimes I don't. Sometimes I have to kill myself and respawn to see anything. That doesn't bother me too much because it didn't error out.
So then after I let all that load. I want to change teams from lets say Red to Purple. So, then I run my Global function joinTeam(5);
It means that there is some Sim Group object that called a schedule with a Negative number.
example %obj.schedule(-1, 0, 'doSomething', %value1);
Does this mean I have too many scripts trying to run at the same time? Did I cap the engine or what?
Let me give you the functions that I was running and explain it a little better. I'm creating a dungeon builder kind of game. I have been for a while now. It is suppose to be part of a larger game that I want to eventually make but I wanted to see if the concept would still be fun so, anyways.
serverCmdFillInBlankRooms("red", 0);
serverCmdFillInBlankRooms("blue", 0);
serverCmdFillInBlankRooms("green", 0);
serverCmdFillInBlankRooms("orange", 0);
serverCmdFillInBlankRooms("purple", 0);
startPlayerSetup();Basically this is where I setup shop. I prepare whatever map gets loaded for the dungeon builders other options.function serverCmdFillInBlankRooms(%client, %rmz)
{
//what do I need to know about the person trying to use a dungeon gui?
if( %client $= "red" )
%team = 1;
else if(%client $= "blue" )
%team = 2;
else if(%client $= "green" )
%team = 3;
else if(%client $= "orange" )
%team = 4;
else if(%client $= "purple" )
%team = 5;
else
%team = %client.team.teamID; //team
%mapSize = Terrain.squareSize;
%nodesInLine = mFloor(%mapSize / $NodeDistanceApart) - 1;
for( %z = 0; %z < $NodeFloorLevels; %z++ )
{
for( %y = 0; %y < %nodesInLine; %y++ )
{
for( %x = 0; %x < %nodesInLine; %x++ )
{
%zL = %rmz + 1;
%zNL = %rmz + 2;
if( $DB::PRA[%x, %y, %rmz, %team] == 0 )
{
//The floor we are on
//commandToServer('NewRoom2D',%rmx, %rmy, %rmz, %p.objectName, %rotation);
$DB::PRA[%x, %y, %rmz, %team] = 1;
$DB::PRA[%x, %y, %rmz, %team, ROT] = 0;
$DB::PRA[%x, %y, %rmz, %team, ON] = "SolidRoom";
ServerCmdNewRoom2D(%client, %x, %y, %rmz, "SolidRoom", 0);
}
else if( $DB::PRA[%x, %y, %zL, %team] == 0 )
{
//lets check the next floor up
$DB::PRA[%x, %y, %zL, %team] = 1;
$DB::PRA[%x, %y, %zL, %team, ROT] = 0;
$DB::PRA[%x, %y, %zL, %team, ON] = "SolidRoom";
ServerCmdNewRoom2D(%client, %x, %y, %zL, "SolidRoom", 0);
}
else if( $DB::PRA[%x, %y, %zNL, %team] == 0 )
{
//lets check the next next floor up
$DB::PRA[%x, %y, %zNL, %team] = 1;
$DB::PRA[%x, %y, %zNL, %team, ROT] = 0;
$DB::PRA[%x, %y, %zNL, %team, ON] = "SolidRoom";
ServerCmdNewRoom2D(%client, %x, %y, %zNL, "SolidRoom", 0);
}
}
}
}
}This basically checks an MultiDimensional array for anything that could be in it already and doesn't place a room there. It does do the floor your on, the floor above you, and the floor above it.function ServerCmdNewRoom2D(%client, %x, %y, %z, %pic, %rotation)
{
//declare variables
%shapeFileLoc = "art/shapes/DDungeon/DR/" @ %pic @ ".cached.dts";
%floor = "art/shapes/DDungeon/DR/floor.cached.dts";
%floor2 = "art/shapes/DDungeon/DR/floor2.cached.dts";
if( %client $= "red" )
%t = 1;
else if(%client $= "blue" )
%t = 2;
else if(%client $= "green" )
%t = 3;
else if(%client $= "orange" )
%t = 4;
else if(%client $= "purple" )
%t = 5;
else
%t = %client.team.teamID; //team
//echo("The client id was: ", %client, " The x ", %x, " The y ", %y, " The z ", %z, " The Team ", %client.team.teamId);
%rMPosition = "RM" @ %x @ "_" @ %y @ "_" @ %z @ "_" @ %t;
if(!%rMPosition.isEnabled())
return;
%dOName = "DO" @ %x @ "_" @ %y @ "_" @ %z @ "_" @ %t;
if( %rMPosition.room !$= "")
{
Echo(" Marker Node", %rMposition," already in use by room ", %rMPosition.room);
return;
}
if( %rMPosition.solid !$= "")
{
%rMPosition.solid.delete();
if(%pic $= "3_T_1_F" || %pic $= "3_T_1")
{
//Do the tranisition room stuff
//clear its room the room above it and the room in the direction it is pointed.
//take current and ad 1 z to it. then add 1to the rotation thereof and make 2 more additions to the array.
%TRz = %z + 1;
//Delete extra room above
%TROneUp = "RM" @ %x @ "_" @ %y @ "_" @ %TRz @ "_" @ %t;
%TROneUp.solid.delete();
//Delete extra room to the side
switch(%rotation)
{
case 0:
%TRy = %y + 1;
%TROneUpOver = "RM" @ %x @ "_" @ %TRy @ "_" @ %TRz @ "_" @ %t;
case 90:
%TRx = %x + 1;
%TROneUpOver = "RM" @ %TRx @ "_" @ %y @ "_" @ %TRz @ "_" @ %t;
case 180:
%TRy = %y - 1;
%TROneUpOver = "RM" @ %x @ "_" @ %TRy @ "_" @ %TRz @ "_" @ %t;
case 270:
%TRx = %x - 1;
%TROneUpOver = "RM" @ %TRx @ "_" @ %y @ "_" @ %TRz @ "_" @ %t;
default:
echo("error will robinson a non possible rotation value was found");
}
//Delete extra room
%TROneUpOver.solid.delete();
//get the position of the marker for extra Trasitional room platform placement.
%transPos = %TROneUpOver.getTransform();
//figure out what room needs an extra floor and which one it should have
if( %TRx )
{
%transX = %TRx;
}
else
{
%transX = %x;
}
if( %TRy )
{
%transY = %TRy;
}
else
{
%transY = %y;
}
if(%transX % 2 == 0 && %transY % 2 == 0) // base this off of the x y positions
{
%tr = new TSStatic(){
canSaveDynamicFields = "1";
shapeName = %floor;
receiveSunLight = "1";
receiveLMLighting = "1";
usePolysoup = "1";
allowPlayerStep = "1";
};
}
else if( %transX % 2 != 0 && %transY % 2 != 0)
{
%tr = new TSStatic(){
canSaveDynamicFields = "1";
shapeName = %floor;
receiveSunLight = "1";
receiveLMLighting = "1";
usePolysoup = "1";
allowPlayerStep = "1";
};
}
else
{
%tr = new TSStatic(){
canSaveDynamicFields = "1";
shapeName = %floor2;
receiveSunLight = "1";
receiveLMLighting = "1";
usePolysoup = "1";
allowPlayerStep = "1";
};
}
}
}
// modify the marker transform by the rotation value
%objTrans = %rMPosition.getTransform();
// modify %dir to be a usable amount form the %rotation value
%dir = (%rotation/90) * -1;
%objXYZ = getWords(%objTrans, 0, 2);
%objAngle = getWord(%objTrans, 6);
%vectorDir = getWord(%objTrans, 5);
if(%vectorDir == -1)
%objAngle += $pi;
%objAngle /= $piOver2;
%objAngle = mFloor(%objAngle + 0.1);
%objAngle += %dir;
if (%objAngle > 4)
%objAngle -= 4;
if (%objAngle <= 0)
%objAngle += 4;
%rMPosition.setTransform(%objXYZ @ " 0 0 1 " @ %objAngle * $piOver2);
//Make the room transform equal to the transform of the marker.
%objPosTrans = %rMPosition.getTransform();
%p = new TSStatic("DO" @ $ObjC @ "_" @ %client.team.teamId) {
canSaveDynamicFields = "1";
shapeName = %shapeFileLoc;
receiveSunLight = "1";
receiveLMLighting = "1";
usePolysoup = "1";
allowPlayerStep = "1";
roomNode = %rMPosition;
};
//Before we place a floor lets check to see if they are static rooms because if they are then we don't need a platform yet.
if(%pic !$= "solidRoom" )
{
if(%x % 2 == 0 && %y % 2 == 0) // base this off of the x y positions
{
%f = new TSStatic(){
canSaveDynamicFields = "1";
shapeName = %floor;
receiveSunLight = "1";
receiveLMLighting = "1";
usePolysoup = "1";
allowPlayerStep = "1";
};
}
else if( %x % 2 != 0 && %y % 2 != 0)
{
%f = new TSStatic(){
canSaveDynamicFields = "1";
shapeName = %floor;
receiveSunLight = "1";
receiveLMLighting = "1";
usePolysoup = "1";
allowPlayerStep = "1";
};
}
else
{
%f = new TSStatic(){
canSaveDynamicFields = "1";
shapeName = %floor2;
receiveSunLight = "1";
receiveLMLighting = "1";
usePolysoup = "1";
allowPlayerStep = "1";
};
}
}
$COArray[%client.team.teamId]++;
$ObjC++;
if(%pic !$= "plateform" && %pic !$= "SolidRoom")
%rMPosition.room = %p;
if(%pic $= "SolidRoom")
%rMPosition.solid = %p;
if(%p)
{
%p.setTransform(%objPosTrans);
MissionCleanup.add(%p);
}
if(%f)
{
%f.setTransform(%objPosTrans);
MissionCleanup.add(%f);
}
if(%tr)
{
%tr.setTransform(%transPos);
MissionCleanup.add(%tr);
}
}This kind of places a room and then a platform under the room depending on which grid position it is at. This is so I can avoid the whole collada if the platforms are the same shape and you put them next to each other it causes you to fall through the other one if you walk across them.Ok. This code takes some time to run about 107 seconds on a debug build after adding the frame allocation resource. So after all 540 ish static room objects get created they have to be ghosted out to the clients. Lets just say I'm pushing the engine because sometimes I get the rooms and sometimes I don't. Sometimes I have to kill myself and respawn to see anything. That doesn't bother me too much because it didn't error out.
So then after I let all that load. I want to change teams from lets say Red to Purple. So, then I run my Global function joinTeam(5);
function jointeam(%teamid)
{
commandToServer('dungeonGuiRefresh', 1);
//set a team preference
$Pref::Player::Team = "Team" @%teamid;
commandtoserver('JoinTeam', %teamid);
Canvas.popDialog(SelectTeamDlg); //Hide the dialog once selection is made
Canvas.pushDialog(SelectClassDlg); //Push the next dialog for choosing a class
//Refresh your new teams gui and pictures
}When my Server function dungeonGuiRefresh runs thats when it gives the warning error.function serverCmdDungeonGuiRefresh(%client, %test)
{
//what do I need to know about the person trying to use a dungeon gui?
%team = %client.team.teamID; //team
%teamLevel = $game::TL[%team]; //teams current level
%mapSize = Terrain.squareSize;
%nodesInLine = mFloor(%mapSize / $NodeDistanceApart) - 1;
for(%t = 1; %t <= $teamAmount; %t++)
{
for( %z = 0; %z < $NodeFloorLevels; %z++ )
{
for( %y = 0; %y < %nodesInLine; %y++ )
{
for( %x = 0; %x < %nodesInLine; %x++ )
{
//clear the board for the refresh
if( $DB::PRA[%x, %y, %z, %t] != 0 )
{
if(%test == 1 && %t == %team)
commandToClient(%client,'deleteBitmapRoom', %x, %y, %z);
if(%test == 2 && %t == %team)
{
//devise a way to check if static and to check if it is a block room
%payloadON = $DB::PRA[%x, %y, %z, %team, ON];
%rotation = $DB::PRA[%x, %y, %z, %team, ROT];
if(%payloadON $= "solidRoom")
continue; //if its a solid room go to the next room
%payloadExtent = 50;
%bitmapPath = "art/gui/dungeonBuilder/" @ %payloadON @ ".png";
%roomName = %x SPC %y SPC %z;
%static = 1;
%color = "255 0 0 255";
//function clientCmdplaceBitmapRoom( %rmx, %rmy, %rmz, %payloadExtent, %bitmapPath, %payloadON, %roomName, %payloadRot )
commandToClient( %client, 'placeBitmapRoom', %x, %y, %z, %payloadExtent, %bitmapPath, %payloadON, %roomName, %rotation, %static, %color );
}
}
}
}
}
}
}So how do I fix this? Any Ideas. Sorry about the not so clean code. This is just prototyping still. Kind of like a pre-alpha.About the author
I just realized that if I wanted to create a cat that caught on fire and ran up a telephone pole and then burst into a blue waterfall. That wouldn't be to hard!
#2
the last one was sold to some strange scientist type guy, with a silver delorian, and there was something about a small furry canine? never the less, they stopped making them a while ago...
sorry, couldn't resist.
11/05/2009 (12:37 pm)
the flux capacitor has been unavailable since 1985,the last one was sold to some strange scientist type guy, with a silver delorian, and there was something about a small furry canine? never the less, they stopped making them a while ago...
sorry, couldn't resist.
#3
vimeo.com/7463261
Just remember when I switch teams is when I get the error message. It only happens on debug so I did this tutorial off of a release build.
11/06/2009 (8:31 am)
Well Deep, I did a little tutorial just for you. And I'm calling you the alpha tester. So here's a tutorial on how to play what I'm working on. vimeo.com/7463261
Just remember when I switch teams is when I get the error message. It only happens on debug so I did this tutorial off of a release build.
#4
That funny assertion message just means that a scheduled sim event somehow got posted to happen in the past and not the current or future time.
This "cute" message is not unhelpful to new users, so i changed it to:
Most likely you have a schedule() in script with a negative time or a Sim::postEvent() call in your C++ code that has a time that is less than the current time.
11/06/2009 (2:57 pm)
@JesseLThat funny assertion message just means that a scheduled sim event somehow got posted to happen in the past and not the current or future time.
This "cute" message is not unhelpful to new users, so i changed it to:
Quote:Sim::postEvent() - Event time must be greater than or equal to the current time!
Most likely you have a schedule() in script with a negative time or a Sim::postEvent() call in your C++ code that has a time that is less than the current time.
#5
11/06/2009 (4:17 pm)
Ohh I figured it out! Ya I changed the CorpseTimeout values and it became less then 0. Whew I was like Oh no what did I do now :/ FAIL
Torque Owner JesseL
Pyrotronics-Games
I did some more troubleshooting. It apears when I run my spawning code for a new player right after I call the dungeon Gui Refresh function is when it errors out. It's wierd because I can add tsStatic shapes without any error message. The moment I try to add a player or AIplayer it gives me this error message.