Game Development Community

Screen goes pink

by John Rockefeller · in Torque Game Engine Advanced · 10/01/2005 (6:35 pm) · 19 replies

Hi there

I've ported over start.racing to TSE and have been successful except for one point: As I drive down a road in my game the screen goes completely pink, as though it were the pink used in PNG or GIF transparencies. You know, that ungodfully brutal shade of magenta. Anyway.. I have to reload the level and begin driving back from where I started. If I hit F11 and drop camera at player then I can move around in fly mode perfectly but the car has disappeared.

Any idea why this suddenly stopped working? It seemed to be fine before. I think the only thing I changed was adding in the vehicle downforce. :/

#1
10/01/2005 (6:39 pm)
You got the starter.racing working?

Cool... I had a quick go at it but when ever I tried to drive, the game would just crash. (did you get the problem?)


Not sure what would cause the pink sorry.
#2
10/01/2005 (6:47 pm)
Yeah it works fine. I think they fixed the racing problem in milestone 2. It's really frustrating since I can't test the later areas of my map. It seems to go pink when I'm turning a tight corner. If I just drive straight it's fine. Then again sometimes it seems like it's on a timer. I don't know.. It's entirely frustrating.

EDIT: I should note that I get this error when running in DEBUG mode:
Fatal: (h:\source\streets of san haven\09-17-2005\engine\sim\sceneobject.cpp @ 262) Error, bad range! in getBinRange
#3
10/01/2005 (7:05 pm)
Hmm I was using the latest version when I did it (counter went down and it crashed when you pressed one of the movement keys)
#4
10/02/2005 (12:01 pm)
Its likely if youre getting a getBinRange error that youve got something going "off to neptune". Try writing out the position of the racing car every frame and see if it goes to some strange values like NAN's.

Essentially, the physics can go unstable over time and build up to the point where it becomes unstable.

Try upping the integration rate on the vehicle and see if that helps it stay alive longer..

In the vehicle datablock, simply add:

integration = 10;

and see if that helps.
#5
10/03/2005 (1:56 am)
Hi Phil

Sorry, 'integration = 10' doesn't help the issue. It still pinks out all the time. I haven't tried writing out the position of the car yet but I will soon.

How do I get the car physics to not go unstable over time? Obviously I would need the game to run as long as the user wants..

Thanks
#6
10/03/2005 (6:30 pm)
Are you borking the control object somehow?
#7
10/03/2005 (7:28 pm)
Is that even legal?

LoL

Seriously, which control object are we speaking about? And yes, I've probably messed something up.
#8
10/03/2005 (7:44 pm)
That pink is what you get when there is nothing for TSE to render (it is the clear color). The most common cause I have seen for it showing up is if you have an invalid control object (like deleting the car you are controlling or if the car gets destroyed).
#9
10/03/2005 (7:52 pm)
See, I thought the same thing and so I went looking for anything that would maybe reduce the health of the car or would cause it to be destroyed but I couldn't find anything. I thought maybe because the car would flip or scrape against a wall and be damaged and then the game would go pink. :/ Hmm..


Update: It's got to be the physics.. It only goes pink when I turn in a 360. I've tried going straight and turning slowly and it lasts almost all the way through the track. Hrm.....
#10
10/03/2005 (9:24 pm)
Actually, the problem is a bit of code in the speedometer HUD. Look at my post in the TSE Bugs forums for a fix on it.

Edit: Here http://www.garagegames.com/mg/forums/result.thread.php?qt=34142
#11
10/03/2005 (10:28 pm)
Thanks, but my pink screen problem happens when I've got no speedometer in the GUI.
#12
10/04/2005 (9:26 am)
Okay here's a stupid question. How do I write out the car's position every frame? God I'm such a newb.
#13
10/04/2005 (9:33 am)
Send the return you get from object.getPosition(); to a variable and show the variable in a GUI?

Edit: getPosition should be getTransform.
#14
10/04/2005 (10:44 am)
Okay, I've got it, but where I have it in script it only does this once. I put it in function startRace() in game.cs. Obviously this function only fires once. Which function is fired every frame and which script file is that in so that I get a continually updated value?

Secondly, is there any script command that will output this value to a text file? I would like to view the log after.

Thanks, everyone, for all your help with this. The torque community rocks!
#15
10/04/2005 (12:32 pm)
You could always put in a Con::warnf( "Position = %f,%f,%f", carPos ); somewhere in the car's processTick(). That will output to console.log for your later review.
#16
10/04/2005 (1:17 pm)
Where is the car's processTick()? is that in the source or in scripting?
#17
10/07/2005 (11:01 pm)
It'd be in the source, in wheeledVehicle.cpp, though the processTick in vehicle.cpp would also work.

if you dont want to do that, you can use something like:

function echoPosition(%obj)
{
    echo(%obj.getPosition());

    schedule(500,%obj,"echoPosition",%obj);
}

That's off the top of my head, not 100% sure it will compile (it should!). I used to do things like this when I modded T2 all the time.
#18
10/08/2005 (8:37 am)
So that function is recursive? It'll keep calling itself every 500ms because of schedule()?

If not, that function will only fire once, right? Which functions in script fire every frame so that I can get a constant update on the car's position?
#19
10/08/2005 (11:14 am)
Yeah its sort of a controlled recursion. You can adjust the MS timing to make it faster or slower, or add a conditional value to stop it using some global variable. With the "%obj" as the value in the second field, it will stop running the loop if %obj gets deleted.


Actually, reading back, Stefan's idea is really good. Instead of "echo(..." use "$carPos = %obj.getPosition" and then add a GuiTextCtrl that has $carPos as it's "variable" field on your HUD. You could also lower the 500 ms to something like 50 or so to get smoother updating.


There's really no script functions that "fire every frame" unless you add one in the source code.