SetBlackout() - how to use?
by Yin Yi Jia · in Torque Game Engine · 12/16/2005 (10:15 am) · 6 replies
If I understand correctly the setBlackout() method is used to fade the screen (during gameplay, when playGui is active) to black over a specified period of time. Is this right?
If so how can one implement the code to do this, %client.setBlackout(1, timeMs) does not seem to do anything when I send in the client's game connection object.
If so how can one implement the code to do this, %client.setBlackout(1, timeMs) does not seem to do anything when I send in the client's game connection object.
About the author
#2
I know it can work, I've used it in a few projects. :)
12/31/2005 (3:05 pm)
Have you tried other arguments? :) You can experiment easily with ClientGroup.getObject(0).setBlackout(...);I know it can work, I've used it in a few projects. :)
#3
Hi. Sorry I didn't see this go by. This function is a little non-obvious. It is associated with the GameConnection object, so you would assume that the SERVER calls it on the CLIENT connections. This is not true.
The clients are the ones that call this function. They call it on their server connection like this:
Hope this helps.
Hall Of Worlds - For Gamers
EdM|EGTGE
01/30/2006 (4:39 pm)
Yin,Hi. Sorry I didn't see this go by. This function is a little non-obvious. It is associated with the GameConnection object, so you would assume that the SERVER calls it on the CLIENT connections. This is not true.
The clients are the ones that call this function. They call it on their server connection like this:
// Assuming the GameConnection was named "serverConnection" on the client, the client can blackout // its screen like this: serverConnection.setBlackout( 1 , 0 ); // Blackout immediately, no fade serverConnection.schedule( 1200, setBlackout , 0 , 1500 ); // and reverse blackout like this, start fading back in starting in 1.2 seconds, and take 1.5 to fade in.
Hope this helps.
Hall Of Worlds - For GamersEdM|EGTGE
#4
03/19/2006 (8:46 am)
Can I change the fade color using setBlackout?
#5
LocalClientConnection.setBlackout(1,0);
Or didn't i understood the whole thing?
03/26/2006 (2:17 pm)
Why this doesn't work?LocalClientConnection.setBlackout(1,0);
Or didn't i understood the whole thing?
#6
@Bauer Rene - That is close, but not quite right.
1. 'LocalClientConnection' is an instance of GameConnection. Good.
2. It is visible to both the client and server if you are running a singleplayer game. Good, but irrelavent in this case.
3. It represents the connection from the Server to the Client. Bad.
Why is this bad? Well, the blackout effect is a change in the visibility of the entire screen and is thus a function of the client and not the server. The client, not the server, is responsible for drawing to the screen, playing sounds, and stuff like that.
To correctly fade, you must use the 'ServerConnection' object. I know that it sounds weird at first, but it makes sense if you think of it like this:
'ServerConnection' is the connection from the Client to the Server. Thus it represents the client-side of the client-server equation. Thus any visual changes we make should go through it since the client side is responsible for visuals.
I hope this clears up the mystery.
Hall Of Worlds - For Gamers
EdM|GPGT
PS - Try the code from my prior post (above) and you'll see that this works as expected.
03/30/2006 (12:30 am)
@Outline - You'll have to edit the soruce code to do that. @Bauer Rene - That is close, but not quite right.
1. 'LocalClientConnection' is an instance of GameConnection. Good.
2. It is visible to both the client and server if you are running a singleplayer game. Good, but irrelavent in this case.
3. It represents the connection from the Server to the Client. Bad.
Why is this bad? Well, the blackout effect is a change in the visibility of the entire screen and is thus a function of the client and not the server. The client, not the server, is responsible for drawing to the screen, playing sounds, and stuff like that.
To correctly fade, you must use the 'ServerConnection' object. I know that it sounds weird at first, but it makes sense if you think of it like this:
'ServerConnection' is the connection from the Client to the Server. Thus it represents the client-side of the client-server equation. Thus any visual changes we make should go through it since the client side is responsible for visuals.
I hope this clears up the mystery.
Hall Of Worlds - For GamersEdM|GPGT
PS - Try the code from my prior post (above) and you'll see that this works as expected.
Torque Owner Yin Yi Jia
Please does anyone know what the setBlackout() function does, and how to use it?