Game Development Community

RTSunit animations and sounds ?

by Jeff Yaskus · in RTS Starter Kit · 01/29/2010 (6:17 pm) · 1 replies

Currently having (2) issues with RTS Kit --

(a) setActiveThread seems to have no effect for RTS Units --
%id.setActiveThread("root");
%id = {units id #}

recieving no errors about files not found or such -- but nothing happens with the units.

I can do it on the RTS Buildings and they switch from "Create", "idle","destroy" animations just fine.

(b) can't seem to get background sound working .... using examples from 3DGPAiO book -- (which is likely out-dated)
I've manually called the script in the console (not sure which .cs file to put it in for background)

==>exec("jeffs.RTS/client/scripts/AudioProfiles.cs");
Loading compiled script jeffs.RTS/client/scripts/AudioProfiles.cs.

==>ServerPlay3D(BackgroundMusic,"0 0 246 1 0 0 0");

but no sound --

if I call this through the console it doesnt work either. (no errors)
ServerPlay3D(CrossbowExplosionSound,"0 0 246 1 0 0 0");

yet - I see it getting called elsewhere and it works during the attack animation.

The file exists under jeffs.RTS/data/sound/testing.ogg ... so what am I doing wrong?

new AudioProfile(BackgroundMusic)
{
   filename = "~/data/sound/war.ogg"; 
   description = "AudioDefaultLooping3d"; // monophonic sound that repeats
};

#1
02/01/2010 (1:25 am)
I think it was the client/server difference or perhaps the order in which stuff is loaded ... still not sure which.

new AudioProfile seems to indicate a local (client side) instance while datablock AudioProfile is server side ?!

But I noticed it an error that "AudioStartup" profile was not found while loading ... did a search and found it being called in StartupGui.gui.

So I create a client/scripts/music.cs file with only the following ... it sets up a new channel just for the music (4), defines the music class and defines AudioStartup profile -- which points to my epic background music.

$MusicAudioType = 4; // channel 4 if it works

new AudioDescription(AudioMusic)
{
   volume = 1.0;
   isLooping = true;
   is3D = false;
   type = $MusicAudioType;
};

new AudioProfile(AudioStartup)
{
   filename = "~/data/sound/war.ogg";
   description = "AudioMusic";
   preload=true;
};


Now, it just starts playing right after the GUI loads ... this is a good example of the type of challenges I've had with this engine so far. It either works or doesn't and if it doesn't ... can be anything for an extra space or ";" ... or who knows what.