Game Development Community

Screen darkens when running t2d.exe

by Johan Stenqvist (neochrome) · in Torque Game Builder · 05/13/2005 (4:25 am) · 12 replies

Hi,

Don't know if this is a bug, but lately the whole screen darkens (as if the gamma is turned down a bit) when I run t2d.exe - and stays this way after I shut down t2d.
Other Direct3D / OpenGL applications don't do this so I guess it lieas with t2d in some way.
The most probably cause is myself fiddling around but I can't recall any scripts I've changed that should affect this...
Since this affect the whole screen, including the desktop etc, it's kinda annoying. If I enter my graphics card's property pages and klick on the tab for color management the effect will go away (I don't need to change anything, just klick on the tab).

Please let me know if there's anything I can do avoid this.

Best regards,
Johan

#1
05/13/2005 (5:45 am)
I had this happen after I deleted the prefs.cs file so my game could generate a new clean one, although I find everything returns to normal once I exit T2D.

Try replacing your prefs.cs with one from the example directory to see if it helps.
#2
05/13/2005 (3:50 pm)
I believe this is a problem of the screen's gamma being adjusted. If you abort the game by terminating the execution, the gamma change will stick and stack.

I'm sure it has something to do with the gamma adjustment settings (or lack thereof) in pref.cs or defaults.cs.
#3
05/15/2005 (11:59 pm)
I've had time to play some more with t2d and I've managed to get the screen both darker and brighter by adding $pref::OpenGL::gammaCorrection = to defaults.cs and prefs.cs.

As Bryan says the gamma settings stick and stack - I don't know if this has something to do with me exiting the program with Alt+F4 (on windows)? The strange thing is that it works sometimes and sometimes don't.

Is it possible this has something to do with how I start my game? I've created a copy of the T2D folder in the example folder and renamed it to "chaos" (the name of the game). In here I've deleted all scripts and images from the example I'm not using/referecing. I start by running a .bat file with "t2d.exe -game chaos" to load only my game/mod. Is this correct?

Also I've noticed that you have two defaults.cs - one in your game's folder and one in the client subfolder - which one should be used?

Thanks for any light you can shed upon this!

/Johan
#4
05/16/2005 (4:31 am)
I haven't had this happen to me with T2D yet, but it was a very common problem with Tribes2.. seems to be a character flaw with Torque :)
#5
11/01/2005 (9:30 am)
I found myself getting this problem a lot ... every time I ran T2D, when it exited it would reduce my gamma. The only way to get it back was to reboot then run a copy of TGE1.4 which reset it. So, I "merged" T2D with TGE 1.4 (and kept all the 3D stuff) and the problem went away...

... til today when I decided to cut the unneeded 3D stuff out of my build. At which point, the bug came back. Crap! I thought. Then, Aha! I thought.

The fix is really quite simple. In cutting down TGE for T2D, game.cc got removed, along with the call to GameInit() in main.cc. The problem here is, that's where the OpenGL prefs variables are setup, so $Pref::OpenGL::gammaCorrection doesnt work correctly.

To fix, simply open up main.cc, find the initGame() function, and stuff the following in just after the other Con::addVariable() calls. That would be around line 242 in 1.4 RC2's main.cc

Con::addVariable("$pref::OpenGL::disableEXTPalettedTexture",     TypeBool, &gOpenGLDisablePT);
   Con::addVariable("$pref::OpenGL::disableEXTCompiledVertexArray", TypeBool, &gOpenGLDisableCVA);
   Con::addVariable("$pref::OpenGL::disableARBMultitexture",        TypeBool, &gOpenGLDisableARBMT);
   Con::addVariable("$pref::OpenGL::disableEXTFogCoord",            TypeBool, &gOpenGLDisableFC);
   Con::addVariable("$pref::OpenGL::disableEXTTexEnvCombine",       TypeBool, &gOpenGLDisableTEC);
   Con::addVariable("$pref::OpenGL::disableARBTextureCompression",  TypeBool, &gOpenGLDisableTCompress);
   Con::addVariable("$pref::OpenGL::noEnvColor",		              TypeBool, &gOpenGLNoEnvColor);
   Con::addVariable("$pref::OpenGL::gammaCorrection",               TypeF32,  &gOpenGLGammaCorrection);	
	Con::addVariable("$pref::OpenGL::noDrawArraysAlpha",				  TypeBool, &gOpenGLNoDrawArraysAlpha);
#if defined(TORQUE_OS_MAC)
   gOpenGLDisableFC = true;
#else
   Con::addVariable("$pref::OpenGL::disableEXTFogCoord", TypeBool, &gOpenGLDisableFC);
#endif

T.
#6
11/01/2005 (9:33 am)
@Tom: Thanx for the tip!

@Melv or someone at GG: Any chance this will be rectified in the next release of T2D??

Cheers,
Johan
#7
11/01/2005 (11:10 am)
I've stripped out the non-applicable stuff from the "prefs.cs" file a while ago so yes!

I also removed the multiple "prefs.cs" files that were being generated and causing all sorts of problems. Things like the editors use their own preference files but only export their specific namespace stuff e.g. $tileEditor:: and $particleEditor::.

There's also a bunch of new global system variables added that are specific to T2D as well for controlling imageMap, serialisation, collision, scene options etc.

- Melv.
#8
11/01/2005 (11:13 am)
Here's the file in-case you're interested...

$pref::Audio::channelVolume1 = 0.8;
$pref::Audio::channelVolume2 = 0.8;
$pref::Audio::channelVolume3 = 0.8;
$pref::Audio::channelVolume4 = 0.8;
$pref::Audio::channelVolume5 = 0.8;
$pref::Audio::channelVolume6 = 0.8;
$pref::Audio::channelVolume7 = 0.8;
$pref::Audio::channelVolume8 = 0.8;
$pref::Audio::driver = "OpenAL";
$pref::Audio::drivers = "";
$pref::Audio::environmentEnabled = 0;
$pref::Audio::forceMaxDistanceUpdate = 0;
$pref::Audio::masterVolume = 0.8;

$pref::Console::extent = "970 783";
$pref::Console::position = "4 0";

$Pref::GuiEditor::PreviewResolution = "1024 768";

$pref::Input::JoystickEnabled = "0";
$pref::Input::KeyboardEnabled = "1";
$pref::Input::KeyboardTurnSpeed = 0.1;
$pref::Input::LinkMouseSensitivity = 1;
$pref::Input::MouseEnabled = "0";

$pref::Master0 = "2:master.garagegames.com:28002";

$Pref::Net::LagThreshold = "400";
$pref::Net::PacketRateToClient = "10";
$pref::Net::PacketRateToServer = "32";
$pref::Net::PacketSize = "200";
$pref::Net::Port = 28000;

$pref::OpenGL::allowCompression = "0";
$pref::OpenGL::allowTexGen = "1";
$pref::OpenGL::disableARBMultitexture = "0";
$pref::OpenGL::disableARBTextureCompression = "0";
$pref::OpenGL::disableEXTCompiledVertexArray = "0";
$pref::OpenGL::disableEXTFogCoord = "0";
$pref::OpenGL::disableEXTPalettedTexture = "0";
$pref::OpenGL::disableEXTTexEnvCombine = "0";
$pref::OpenGL::disableSubImage = "0";
$pref::OpenGL::force16BitTexture = "0";
$pref::OpenGL::forcePalettedTexture = "0";
$pref::OpenGL::gammaCorrection = "0.5";

$Pref::Server::AdminPassword = "";
$Pref::Server::BanTime = 1800;
$Pref::Server::ConnectionError = "You do not have the correct version of the T2D Network or the related art needed to play on this server, please contact the server operator for more information.";
$Pref::Server::FloodProtectionEnabled = 1;
$Pref::Server::Info = "This is a T2D Network Server.";
$Pref::Server::KickBanTime = 300;
$Pref::Server::MaxChatLen = 120;
$pref::Server::MaxPlayers = 64;
$Pref::Server::Name = "T2D Network Kit";
$Pref::Server::Password = "";
$Pref::Server::Port = 28000;
$Pref::Server::RegionMask = 2;
$Pref::Server::TimeLimit = 20;

$pref::T2D::dualCollisionCallbacks = 1;
$pref::T2D::imageMapDumpTextures = 0;
$pref::T2D::imageMapEchoErrors = 1;
$pref::T2D::imageMapFixedMaxTextureError = 1;
$pref::T2D::imageMapFixedMaxTextureSize = 0;
$pref::T2D::imageMapShowPacking = 0;
$pref::T2D::warnFileDeprecated = 1;
$pref::T2D::warnSceneOccupancy = 1;

$pref::Video::allowD3D = 1;
$pref::Video::allowOpenGL = 1;
$pref::Video::appliedPref = "1";
$pref::Video::clipHigh = "0";
$pref::Video::defaultsRenderer = "GeForce Go 6800 Ultra/PCI/SSE2";
$pref::Video::defaultsVendor = "NVIDIA Corporation";
$pref::Video::deleteContext = "1";
$pref::Video::disableVerticalSync = 1;
$pref::Video::displayDevice = "OpenGL";
$pref::Video::fullScreen = "0";
$pref::Video::monitorNum = 0;
$pref::Video::only16 = "0";
$pref::Video::preferOpenGL = 1;
$pref::Video::profiledRenderer = "GeForce Go 6800 Ultra/PCI/SSE2";
$pref::Video::profiledVendor = "NVIDIA Corporation";
$pref::Video::resolution = "1024 768 32";
$pref::Video::safeModeOn = "1";
$pref::Video::screenShotFormat = "PNG";
$pref::Video::screenShotSession = 1;
$pref::Video::windowedRes = "800 600";
$pref::VisibleDistanceMod = 1;

- Melv.
#9
01/11/2006 (11:41 am)
This still seems to be happening in alpha 2 (that is, when regenerating the prefs.cs, the gamma correction var is missing, resulting in darkened screen.) Can anyone else confirm?
#10
01/12/2006 (9:59 am)
Michael, could you verify that the entry is missing in your T2D/client/defaults.cs file? This is the file that is used to regenerate your prefs when they are missing.

In our SVN the entry is there just as Melv has posted above.

-Justin
#11
01/12/2006 (10:13 am)
This is the contents of the file, freshly unzipped from the archive, time stamp 21/12/2005 13:52

ALPHA2_T2D-SDK_1-1\example\T2D\client\defaults.cs

//-----------------------------------------------------------------------------
// Torque 2D Engine
// Copyright (C) GarageGames.com, Inc.
//-----------------------------------------------------------------------------

// The master server is declared with the server defaults, which is
// loaded on both clients & dedicated servers.  If the server mod
// is not loaded on a client, then the master must be defined. 
// $pref::Master[0] = "2:master.garagegames.com:28002";

$pref::Player::Name = "Fresh Meat";
$pref::Player::defaultFov = 90;
$pref::Player::zoomSpeed = 0;

$pref::Net::LagThreshold = 400;
$pref::Net::Port = 28000;

$pref::shadows = "2";
$pref::HudMessageLogSize = 40;
$pref::ChatHudLength = 1;


$pref::Input::LinkMouseSensitivity = 1;
$pref::Input::MouseEnabled = 0;
$pref::Input::JoystickEnabled = 0;
$pref::Input::KeyboardTurnSpeed = 0.1;

$pref::sceneLighting::cacheSize = 20000;
$pref::sceneLighting::purgeMethod = "lastCreated";
$pref::sceneLighting::cacheLighting = 1;
$pref::sceneLighting::terrainGenerateLevel = 1;

$pref::ts::detailAdjust = 0.45;

$pref::Terrain::DynamicLights = 1;
$pref::Interior::TexturedFog = 0;

$pref::Video::displayDevice = "OpenGL";
$pref::Video::allowOpenGL = 1;
$pref::Video::allowD3D = 1;
$pref::Video::preferOpenGL = 1;
$pref::Video::appliedPref = 0;
$pref::Video::disableVerticalSync = 1;
$pref::Video::monitorNum = 0;
$pref::Video::windowedRes = "800 600";
$pref::Video::screenShotFormat = "PNG";

$pref::OpenGL::force16BitTexture = "0";
$pref::OpenGL::forcePalettedTexture = "0";
$pref::OpenGL::maxHardwareLights = 3;
$pref::VisibleDistanceMod = 1.0;

$pref::Audio::driver = "OpenAL";
$pref::Audio::forceMaxDistanceUpdate = 0;
$pref::Audio::environmentEnabled = 0;
$pref::Audio::masterVolume   = 0.8;
$pref::Audio::channelVolume1 = 0.8;
$pref::Audio::channelVolume2 = 0.8;
$pref::Audio::channelVolume3 = 0.8;
$pref::Audio::channelVolume4 = 0.8;
$pref::Audio::channelVolume5 = 0.8;
$pref::Audio::channelVolume6 = 0.8;
$pref::Audio::channelVolume7 = 0.8;
$pref::Audio::channelVolume8 = 0.8;
#12
01/12/2006 (10:31 am)
Michael,

This has been addressed in the new Alpha that is coming soon. For now, simply add the line

$pref::OpenGL::gammaCorrection = "0.5";

to your defaults.cs and this should resolve your problem. If not, try adding all the OpenGL lines from Melv's post above.

Regards,

-Justin