Game Development Community

2 Questions: Fog and Loading Music on a Mission

by Jonathan Rose · in Torque Game Engine · 12/30/2004 (9:50 pm) · 14 replies

How do I change the color of the fog? I want it to be a tad more vivid than the dull grey it is right now.

Also, how do I load music upon starting a level in a way that it is specific to that level rather than just being general game music?

#1
12/30/2004 (10:24 pm)
You can change the fog in the Mission Editor. Load your level and hit F11. On the right hand side expand the "Mission Group" and then select "Sky". Below the tree view hit the "expand all" button then find the Fog section. Change Fog color to your liking and hit "Apply". You should see your changes immediately. Once your happy with it don't forget to save the mission file using "File->Save Mission".

I leave the music one for someone who knows that part of Torque.
#2
12/30/2004 (10:32 pm)
Check this for the musicpart
#3
12/30/2004 (10:45 pm)
I wonder TGE uses shadow volumes for shadowing and can i make shadows in the fog?

Thanks.
#4
12/30/2004 (11:42 pm)
TGE does not have shadow volumes built in, but there are resources avalible on this site which add support for them. I do not know of a shadow volume implementation that effects fog.
#5
12/31/2004 (1:45 am)
"Check this for the musicpart"

I knew about that one, but what I'm really looking for is how to make specific ogg files play for a specific mission. Is there anyway to make it load from within the mission file rather than missiondownload.cs?
#6
12/31/2004 (2:07 am)
If you read the hole thread , one of the examples is what you are looking for ,
playing music when you start a specific mission .
you set the musictrack in the missionfile and alxplays that specific mission music.
#7
12/31/2004 (2:11 am)
How exactly do I actually set the music track in the mission file?
#8
12/31/2004 (3:32 am)
1) download the vorbistools.
2) convert your game music into .ogg file with the encoder
3) name them track1.ogg, track2.ogg and so on, and copy them into data/sound.
4) edit client/scripts/audioProfiles.cs and add this code:
new AudioDescription(AudioMusic)
 {
   volume   = 1.0;
   isStreaming = true;
   isLooping= true;
   is3D     = false;
   type     = $SimAudioType;
};
5) for every music track add this, and count 'track1' up to 'track2' etc in both filename and profilename:
new AudioProfile(track1)
 {
   filename    = "~/data/sound/track1.ogg";
   description = "AudioMusic";
   preload = false;
 };
6) edit client/scripts/missionDownload.cs and insert into the function onMissionDownloadComplete()
alxPlay($musicTrack);
7) change the function call (change the '%musicTrack' to '$musicTrack')
function onMissionDownloadPhase1(%missionName, $musicTrack)
8) edit your mission file and insert the line with musictrack into the .mis file
new SimGroup(MissionGroup) {
      musicTrack = "track1";
   new ScriptObject(MissionInfo) {
...


Now you can change from track1 to trackN in the mission file.
[EDIT] some corrections.
#9
12/31/2004 (9:51 am)
Ah. That works. Many thanks.
#10
01/01/2005 (3:24 am)
Ah, I'm in need of some more help on the issue.

When I start my mission, the main menu music I added fails to cut off.

I can't quite seem to figure out how to stop the music... though I think it has something to do with the command alxstop... I'm just not sure on the propper syntax and what not. I'm sure someone knows how to fix this problem...
#11
01/01/2005 (6:28 am)
Change alxPlay($musictrack) to something like this
$inGameMusic = alxPlay($musicTrack);

When you need to stop the music use alxStop($inGameMusic);
#12
01/01/2005 (6:43 am)
Thanks. Got the last bit working.
#13
01/01/2005 (7:06 am)
@Jonathan
what do you mean fails cut off ?
#14
01/01/2005 (1:06 pm)
The music wouldn't stop.