AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Module Coding (https://forums.alliedmods.net/forumdisplay.php?f=9)
-   -   Module: Orpheu (v2.6.3) (https://forums.alliedmods.net/showthread.php?t=116393)

ot_207 07-11-2010 05:46

Re: Module: Orpheu2.3a
 
Quote:

Originally Posted by Arkshine (Post 1234882)
I have noticed too, but I was not sure because the content send a SVC_SPAWNSTATICSOUND message. I thought it was for others things.

I have tried testing all the message modes SVC_SOUND SVC_SOUNDFADE SVC_STOPSOUND and it seems from what I have read from the code these messages can not be sent through message_begin functions, but can be sent through MSG_WRITEBYTE(&datagram, SVC_SOUND), this means that they are differently transmitted, does SPAWNSTATICSOUND respond good? Has anyone tested it? From what I have studied it is almost impossible to send a sound only to a client.

Edit: And about SV_MultiCast it seems that it is the function that selects which player gets the sound message, unfortunately it does not have structs that Orpheu does support.

Am I right? Or am I following a stupid path?

joropito 07-11-2010 08:47

Re: Module: Orpheu2.3a
 
OT, are you starting the message with SVC_TEMPENTITY type, then send SVC_SPAWNSTATICSOUND as the first byte?

ot_207 07-11-2010 08:57

Re: Module: Orpheu2.3a
 
Quote:

Originally Posted by joropito (Post 1235338)
OT, are you starting the message with SVC_TEMPENTITY type, then send SVC_SPAWNSTATICSOUND as the first byte?

Nope, I am using something like this:
PHP Code:

message_begin(MSG_ONESVC_SPAWNSTATICSOUND_id)
// ETC
message_end() 

Does it work with tempentity?

Arkshine 07-11-2010 09:30

Re: Module: Orpheu2.3a
 
What I don't understand is, in the decompiled code, the sound is not passed into the message.

ot_207 07-11-2010 10:01

Re: Module: Orpheu2.3a
 
Quote:

Originally Posted by Arkshine (Post 1235365)
What I don't understand is, in the decompiled code, the sound is not passed into the message.

It is passed its precache number, it is used for smaller bandwidth usage.

Arkshine 07-11-2010 10:15

Re: Module: Orpheu2.3a
 
Yes, you're right, the index is passed. ^^

ot_207 07-11-2010 10:43

Re: Module: Orpheu2.3a
 
Quote:

Originally Posted by Arkshine (Post 1235405)
Yes, you're right, the index is passed. ^^

Unfortunately the info we just found gets us nowhere. I have tested all the possible and impossible methods to send a sound to client and what I have found:
CS does not accept SVC_SOUND SVC_SOUNDFADE SVC_STOPSOUND SVC_SPAWNSTATICSOUND if they are sent through message_begin(), when I run one of these 4 it disconnects and gives the error.
However if I type in console the command cl_messages
I get something like this:
Quote:

-------- Message Load ---------
1:svc_nop: 688 msgs:0.67K
5:svc_setview: 8 msgs:0.02K
6:svc_sound: 234 msgs:2.78K
7:svc_time: 44467 msgs:217.12K
8:svc_print: 5 msgs:0.18K
9:svc_stufftext: 16 msgs:0.44K
10:svc_setangle: 11 msgs:0.08K
11:svc_serverinfo: 2 msgs:0.49K
12:svc_lightstyle: 128 msgs:1.02K
13:svc_updateuserinfo: 101 msgs:17.12K
14:svc_deltadescription: 14 msgs:11.77K
15:svc_clientdata: 44467 msgs:527.07K
17:svc_pings: 1983 msgs:50.26K
21:svc_event_reliable: 8 msgs:0.02K
22:svc_spawnbaseline: 2 msgs:4.47K
23:svc_temp_entity: 2290 msgs:146.69K
25:svc_signonnum: 2 msgs:0.00K
29:svc_spawnstaticsound: 6384 msgs:93.52K
32:svc_cdtrack: 2 msgs:0.01K
35:svc_weaponanim: 9 msgs:0.03K
37:svc_roomtype: 2 msgs:0.01K
39:svc_newusermsg: 164 msgs:3.04K
40:svc_packetentities: 5 msgs:0.39K
41:svc_deltapacketentities: 44460 msgs:2602.64K
42:svc_choke: 79 msgs:0.08K
43:svc_resourcelist: 2 msgs:39.83K
44:svc_newmovevars: 5 msgs:0.50K
45:svc_resourcerequest: 2 msgs:0.02K
46:svc_customization: 2 msgs:0.08K
52:svc_voiceinit: 2 msgs:0.03K
54:svc_sendextrainfo: 2 msgs:0.01K
User messages: 2666:19K
That means that there is another way that these sounds are transmited and we do not have access to it. swds.dll is the way to make this work, and I think that SV_Multicast is the function responsible for selecting the clients who receive the messages.

Edit: Also about the cvars that are changed we also have this messages in console:
Quote:

25296 0027 svc_clientdata
25296 0055 svc_deltapacketentities
25296 0198 svc_sound
25296 0211 svc_sound
25296 0224 svc_sound
25296 0237 svc_sound

25296 0250 svc_temp_entity
25296 0263 svc_sound
25296 0275 svc_temp_entity
25302 0008 AmmoPickup
25302 0011 AmmoPickup
25302 0014 AmmoPickup
25302 0017 AmmoPickup
25302 0020 Health
25302 0022 Damage
25302 0035 Damage
25302 0048 svc_customization
25302 0088 svc_updateuserinfo
25302 0261 svc_time
25302 0266 svc_choke
25302 0267 svc_clientdata
25302 0312svc_deltapacketentities
25302 0445 svc_sound
25302 0457 svc_sound

25302 0470 svc_temp_entity
25302 0542 svc_sound
25302 0554 svc_sound

25311 0008 TeamInfo
25311 0016 SelAmmo
25311 0021 GameTitle
25311 0023 svc_sendcvarvalue
It means that we have another way that these are transmited...

Edit2: Also SVC_DELTAPACKETENTITIES is sent through a different channel.

Edit3:
I have got some code from quake engine so you can see some info regarding sound transmition.

PHP Code:

/*
=================
SV_Multicast

Sends the contents of sv.multicast to a subset of the clients,
then clears sv.multicast.

MULTICAST_ALL    same as broadcast
MULTICAST_PVS    send to clients potentially visible from org
MULTICAST_PHS    send to clients potentially hearable from org
=================
*/
void SV_Multicast (vec3_t originint to)
{
    
client_t    *client;
    
byte        *mask;
    
mleaf_t        *leaf;
    
int            leafnum;
    
int            j;
    
qboolean    reliable;

    
leaf Mod_PointInLeaf (originsv.worldmodel);
    if (!
leaf)
        
leafnum 0;
    else
        
leafnum leaf sv.worldmodel->leafs;

    
reliable qfalse;

    switch (
to)
    {
    case 
MULTICAST_ALL_R:
        
reliable qtrue;    // intentional fallthrough
    
case MULTICAST_ALL:
        
mask sv.pvs;        // leaf 0 is everything;
        
break;

    case 
MULTICAST_PHS_R:
        
reliable qtrue;    // intentional fallthrough
    
case MULTICAST_PHS:
        
mask sv.phs leafnum 4*((sv.worldmodel->numleafs+31)>>5);
        break;

    case 
MULTICAST_PVS_R:
        
reliable qtrue;    // intentional fallthrough
    
case MULTICAST_PVS:
        
mask sv.pvs leafnum 4*((sv.worldmodel->numleafs+31)>>5);
        break;

    default:
        
mask NULL;
        
SV_Error ("SV_Multicast: bad to:%i"to);
    }

    
// send the data to all relevent clients
    
for (0client svs.clientsMAX_CLIENTSj++, client++)
    {
        if (
client->state != cs_spawned)
            continue;

        if (
to == MULTICAST_PHS_R || to == MULTICAST_PHS) {
            
vec3_t delta;
            
VectorSubtract(originclient->edict->v.origindelta);
            if (
Length(delta) <= 1024)
                goto 
inrange;
        }

        
leaf Mod_PointInLeaf (client->edict->v.originsv.worldmodel);
        if (
leaf)
        {
            
// -1 is because pvs rows are 1 based, not 0 based like leafs
            
leafnum leaf sv.worldmodel->leafs 1;
            if ( !(
mask[leafnum>>3] & (1<<(leafnum&7)) ) )
            {
//                Con_Printf ("supressed multicast\n");
                
continue;
            }
        }

inrange:
        if (
reliable) {
            
ClientReliableCheckBlock(clientsv.multicast.cursize);
            
ClientReliableWrite_SZ(clientsv.multicast.datasv.multicast.cursize);
        } else
            
SZ_Write (&client->datagramsv.multicast.datasv.multicast.cursize);
    }

    
SZ_Clear (&sv.multicast);
}


/*  
==================
SV_StartSound

Each entity can have eight independant sound sources, like voice,
weapon, feet, etc.

Channel 0 is an auto-allocate channel, the others override anything
allready running on that entity/channel pair.

An attenuation of 0 will play full volume everywhere in the level.
Larger attenuations will drop off.  (max 4 attenuation)

==================
*/  
void SV_StartSound (edict_t *entityint channelchar *sampleint volume,
    
float attenuation)
{       
    
int         sound_num;
    
int            field_mask;
    
int            i;
    
int            ent;
    
vec3_t        origin;
    
qboolean    use_phs;
    
qboolean    reliable qfalse;

    if (
volume || volume 255)
        
SV_Error ("SV_StartSound: volume = %i"volume);

    if (
attenuation || attenuation 4)
        
SV_Error ("SV_StartSound: attenuation = %f"attenuation);

    if (
channel || channel 15)
        
SV_Error ("SV_StartSound: channel = %i"channel);

// find precache number for sound
    
for (sound_num=sound_num<MAX_SOUNDS
        
&& sv.sound_precache[sound_num] ; sound_num++)
        if (!
strcmp(samplesv.sound_precache[sound_num]))
            break;
    
    if ( 
sound_num == MAX_SOUNDS || !sv.sound_precache[sound_num] )
    {
        
Con_Printf ("SV_StartSound: %s not precacheed\n"sample);
        return;
    }
    
    
ent NUM_FOR_EDICT(entity);

    if ((
channel 8) || !sv_phs.value)    // no PHS flag
    
{
        if (
channel 8)
            
reliable qtrue// sounds that break the phs are reliable
        
use_phs qfalse;
        
channel &= 7;
    }
    else
        
use_phs qtrue;

//    if (channel == CHAN_BODY || channel == CHAN_VOICE)
//        reliable = qtrue;

    
channel = (ent<<3) | channel;

    
field_mask 0;
    if (
volume != DEFAULT_SOUND_PACKET_VOLUME)
        
channel |= SND_VOLUME;
    if (
attenuation != DEFAULT_SOUND_PACKET_ATTENUATION)
        
channel |= SND_ATTENUATION;

    
// use the entity origin unless it is a bmodel
    
if (entity->v.solid == SOLID_BSP)
    {
        for (
i=i<i++)
            
origin[i] = entity->v.origin[i]+0.5*(entity->v.mins[i]+entity->v.maxs[i]);
    }
    else
    {
        
VectorCopy (entity->v.originorigin);
    }

    
MSG_WriteByte (&sv.multicastsvc_sound);
    
MSG_WriteShort (&sv.multicastchannel);
    if (
channel SND_VOLUME)
        
MSG_WriteByte (&sv.multicastvolume);
    if (
channel SND_ATTENUATION)
        
MSG_WriteByte (&sv.multicastattenuation*64);
    
MSG_WriteByte (&sv.multicastsound_num);
    for (
i=i<i++)
        
MSG_WriteCoord (&sv.multicastorigin[i]);

    if (
use_phs)
        
SV_Multicast (originreliable MULTICAST_PHS_R MULTICAST_PHS);
    else
        
SV_Multicast (originreliable MULTICAST_ALL_R MULTICAST_ALL);



joropito 07-11-2010 20:46

Re: Module: Orpheu2.3a
 
Maybe this can help

http://forums.alliedmods.net/showpos...14&postcount=5

padilha007 07-12-2010 03:37

Re: Module: Orpheu2.3a
 
with orpheus is possible remove voice icon above the head?

Arkshine 07-12-2010 04:39

Re: Module: Orpheu2.3a
 
It's handled client-side, I doubt you can.


All times are GMT -4. The time now is 09:37.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.