View previous topic :: View next topic |
Author |
Message |
OneManClan
Joined: 28 Feb 2009 Posts: 62
|
Posted: Thu Jul 29, 2010 3:31 pm Post subject: Help: Making only *one* player hear something. |
|
|
Hey people,
I'm trying to convert AGR CustomTF to use FTE as a server and am trying to replace the (non compatible) 'clientsound' function with a new version which uses .dimension_see and .dimension_seen
OBJECTIVE: To make it so that a gassed / hallucinating player hears music, but no-one else does.
The function is called like this:
Code: |
// te is the hallucinating player
clientsoundb(te,#CHAN_MISC,"ambience/acidtrip.wav",1.0,#ATTN_NORM); |
The new (FTE compatible) function is (credit Spike):
Code: |
void(entity e, float chan, string samp, float vol, float atten) clientsoundb =
{
e.dimension_see = 1024;
e.dimension_seen = 2048; /*make us the only receiver, no other player should have this bit set*/
sound(e, chan, samp, vol, atten);
e.dimension_see = e.dimension_seen = 255; /*back to default*/
}; |
The hallucinating player does hear the music. BUT for some reason however, NON-hallucinating players can *also* hear the music. Interestingly enough, the music they hears does not originate from the hallucinating player. It *seems* to come from a fixed position - the spot where the hallucinating player first hallucinated..
I previously tried:
e.dimension_see = e.dimension_seen = 1042;
but the effect was the same.
Anyway, I'm completely stuck, there's no documentation, and I'm too newb to understand FTEQW source code, or even guess as to how to make this work.
any response appreciated,
OneManClan
ps Reminder, I'm still a newb so please feel free to dumb down explanations as much as possible.
pps Is there any examples of the .dimension stuff someone has coded I can see? |
|
Back to top |
|
 |
frag.machine

Joined: 25 Nov 2006 Posts: 728
|
Posted: Thu Jul 29, 2010 4:55 pm Post subject: |
|
|
Unless otherwise stated by Spike regarding FTE, sounds in Quake aren't tied to entities but tied to original playback coordinates, so I'm afraid you won't be able to contour that easily. Maybe a non-attenuated loop music could be used to avoid it, but then you'll have another problem to resolve: how to stop it once the hallucination effect wear off. I don't know if either FTE or Darkplaces have some extension to deal better with this.
Another way to contour that would be to to send to the hallucinated client only a play cdtrack message (DP supports custom cdtracks in OGG or MP3 formats, dunno about FTE): you wouldn't need to worry about attenuation since it's a soundtrack, and you could easily stop the sound simply stopping the track. This has the additional bonus of not requiring any special extension from the server side (can be done in pure QuakeC). _________________ frag.machine - Q2K4 Project
http://fragmachine.quakedev.com/ |
|
Back to top |
|
 |
OneManClan
Joined: 28 Feb 2009 Posts: 62
|
Posted: Thu Jul 29, 2010 5:45 pm Post subject: |
|
|
Hey Frag.machine,
frag.machine wrote: | Unless otherwise stated by Spike regarding FTE, sounds in Quake aren't tied to entities but tied to original playback coordinates, so I'm afraid you won't be able to contour that easily. |
Not sure what you mean by 'original playback coordinates' or by 'contour'.
The effect was working perfectly using the 'clientsound' function (the old server provided) - ie the gassed player heard the music and noone else could. FTE came out years later, so I assume it can be done. Spike is confident that .dimension_ can do it, but there seems to be no documentation, and the only info on .dimension I've found is from Spike himself:
Quote: | self.dimension_see defines which 'dimensions' a player can see (including sounds). float dimension_send defines which dimensions the current effect is in. Its a bitfield (so you can have 23 dimensions) |
I'm assuming I've missed something, or my newbiness has left out some crucial bit of information.
frag.machine wrote: | Maybe a non-attenuated loop music could be used to avoid it, but then you'll have another problem to resolve: how to stop it once the hallucination effect wear off. |
Well the acidtrip.wav IS a loop, and it is/was stopped by playing a null wav on the same channel. I haven't got onto that part yet w this FTE version.
thanks for the response,
OneManClan
ps I've never used 'CDtracks' - does this mean the player has to actually have a cd in the 'cd drive', or can the server just send the client a mp3, and it gets stored on the HD along w the rest of the sounds? |
|
Back to top |
|
 |
frag.machine

Joined: 25 Nov 2006 Posts: 728
|
Posted: Thu Jul 29, 2010 6:35 pm Post subject: |
|
|
OneManClan wrote: |
frag.machine wrote: | Unless otherwise stated by Spike regarding FTE, sounds in Quake aren't tied to entities but tied to original playback coordinates, so I'm afraid you won't be able to contour that easily. |
Not sure what you mean by 'original playback coordinates' or by 'contour'. |
Well, the "contour" part is my bad use of english (sorry ), just ignore it. What I'm trying to say is: usually sounds are not tied to entities, they won't "move" along with the related entity.
OneManClan wrote: | The effect was working perfectly using the 'clientsound' function (the old server provided) - ie the gassed player heard the music and noone else could. FTE came out years later, so I assume it can be done. |
clientsound is not a standard builtin, and thus may or may not be supported in FTE (or may behave differently).
OneManClan wrote: | Spike is confident that .dimension_ can do it, but there seems to be no documentation, and the only info on .dimension I've found is from Spike himself:
Quote: | self.dimension_see defines which 'dimensions' a player can see (including sounds). float dimension_send defines which dimensions the current effect is in. Its a bitfield (so you can have 23 dimensions) |
I'm assuming I've missed something, or my newbiness has left out some crucial bit of information. |
Yup, you're assuming clientsound is part of "core" QuakeC. Isn't. You'll need to adapt your code to use FTE version.
OneManClan wrote: | frag.machine wrote: | Maybe a non-attenuated loop music could be used to avoid it, but then you'll have another problem to resolve: how to stop it once the hallucination effect wear off. |
Well the acidtrip.wav IS a loop, and it is/was stopped by playing a null wav on the same channel. I haven't got onto that part yet w this FTE version. |
This trick may not work in all engines; I used that in DP and FitzQuake with success, but I remember people relating problems with other engines. YMMV.
OneManClan wrote: | ps I've never used 'CDtracks' - does this mean the player has to actually have a cd in the 'cd drive', or can the server just send the client a mp3, and it gets stored on the HD along w the rest of the sounds? |
Not exactly. With DP, you can replace the phyisical CD disk with a "cdtracks" folder into your mod containing the fake tracks (in .ogg or .mp3 format IIRC), using the "track<0-9>" name notation. I believe FTE supports something similar, but Spike can help you better than me on that. _________________ frag.machine - Q2K4 Project
http://fragmachine.quakedev.com/ |
|
Back to top |
|
 |
mk

Joined: 04 Jul 2008 Posts: 94
|
Posted: Thu Jul 29, 2010 7:01 pm Post subject: |
|
|
You can send "play sound.wav" commands to single clients through stuffcmd, but it will always be attenuated. Sending the "cd loop #" command may work better. _________________ Makaqu engine blog / website.
Ph'nglui mglw'nafh Cthulhu R'lyeh wgah'nagl fhtagn. |
|
Back to top |
|
 |
leileilol

Joined: 15 Oct 2004 Posts: 1321
|
Posted: Thu Jul 29, 2010 7:11 pm Post subject: |
|
|
But who keeps an audio cd in their cd drive at all times these days!? _________________
 |
|
Back to top |
|
 |
Spike
Joined: 05 Nov 2004 Posts: 944 Location: UK
|
Posted: Fri Jul 30, 2010 2:06 am Post subject: |
|
|
Code: |
if (self.impulse == 241)
{
self.dimension_see = 1024;
self.dimension_seen = 2048;
sound(self, 3, "weapons/r_exp3.wav", 1, 0);
self.dimension_see = self.dimension_seen = 255;
bprint("self mismatched (silent)\n");
}
if (self.impulse == 242)
{
self.dimension_see = 1024;
self.dimension_seen = 1024;
sound(self, 3, "weapons/r_exp3.wav", 1, 0);
self.dimension_see = self.dimension_seen = 255;
bprint("self matched (sound)\n");
}
if (self.impulse == 243)
{
other = spawn();
other.dimension_see = 1024;
other.dimension_seen = 2048;
sound(other, 3, "weapons/r_exp3.wav", 1, 0);
other.dimension_see = other.dimension_seen = 255;
bprint("other mismatched (silent)\n");
}
if (self.impulse == 244)
{
other = spawn();
other.dimension_see = 1024;
other.dimension_seen = 1024;
sound(other, 3, "weapons/r_exp3.wav", 1, 0);
other.dimension_see = other.dimension_seen = 255;
bprint("other matched (silent)\n");
}
if (self.impulse == 245)
{
other = spawn();
sound(other, 3, "weapons/r_exp3.wav", 1, 0);
bprint("other normal (sound)\n");
}
|
works as bprinted and intended _________________ What's a signature? |
|
Back to top |
|
 |
OneManClan
Joined: 28 Feb 2009 Posts: 62
|
Posted: Fri Jul 30, 2010 5:46 am Post subject: |
|
|
UPDATE:
The effect is now working on my home comp!!! (WinXP), BUT it DOESNT work on the actual server (linux) tastyspleen.net:26666.
Why? Possibilities:
1. There's a difference in the two versions of FTEQW server
2. Something in my .cfg is messing something up
3. Unknown newbie element
Btw, I *did* check to make sure both servers are using the same .dat, and they are, so i don't know wtf is going on; still, it's great to see the effect working *somewhere*!
the quest continues..
thanks,
OneManClan
ps Intriguing how the music the non-gassed player hears is fixed in the position where the gassed player originally got gassed. I wonder what's going on.. |
|
Back to top |
|
 |
OneManClan
Joined: 28 Feb 2009 Posts: 62
|
Posted: Sat Jul 31, 2010 4:01 am Post subject: |
|
|
OneManClan wrote: |
Possibilities:
1. There's a difference in the two versions of FTEQW server
|
YES indeed, upgrading to the latest version of the FTE server SOLVED the issue and the effect works(!) ... perfectly !!
BIG THANKS to Spike for making it happen, and his patience w my newbiness.
This solves the question of how to make one player 'hear' something no-one else can hear. The next item on my dream-coding list is already looking much more challenging: To make one player NOT hear anything - Deafness, but I'll save that for another thread.
thanks for the feedback,
OneManClan |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2004 phpBB Group
|