Results 1 to 3 of 3

Thread: Soundproof wall

  1. #1
    Private Lonsofore's Avatar
    Join Date
    Oct 2016
    Posts
    86
    Thanks
    82
    Thanked 38 Times in 25 Posts

    Soundproof wall

    Hey Killtube. I don't want to hear steps and shots from the next room on my map.
    Maybe anyone know, how to do something like soundproof wall? Or any way, how to avoid steps and shots sounds? (any!)
    Thank you in advance.

  2. #2
    Assadministrator kung foo man's Avatar
    Join Date
    Jun 2012
    Location
    trailerpark
    Posts
    2,010
    Thanks
    2,102
    Thanked 1,084 Times in 753 Posts
    Yo lonso, to get a little overview:

    G_AddEvent: https://github.com/id-Software/Quake...g_utils.c#L574
    And PM_AddEvent: https://github.com/id-Software/Quake...bg_pmove.c#L58

    Interesting flags:

    PHP Code:

    // TTimo
    // https://zerowing.idsoftware.com/bugzilla/show_bug.cgi?id=551
    #define SVF_CLIENTMASK 0x00000002

    #define SVF_BOT                    0x00000008    // set if the entity is a bot
    #define    SVF_BROADCAST            0x00000020    // send to all connected clients
    #define    SVF_PORTAL                0x00000040    // merge a second pvs at origin2 into snapshots
    #define    SVF_USE_CURRENT_ORIGIN    0x00000080    // entity->r.currentOrigin instead of entity->s.origin
                                                // for link position (missiles and movers)
    #define SVF_SINGLECLIENT        0x00000100    // only send to a single client (entityShared_t->singleClient)
    #define SVF_NOSERVERINFO        0x00000200    // don't send CS_SERVERINFO updates to this client
                                                // so that it can be updated for ping tools without
                                                // lagging clients
    #define SVF_CAPSULE                0x00000400    // use capsule for collision detection instead of bbox
    #define SVF_NOTSINGLECLIENT        0x00000800    // send entity to everyone but one client
                                                // (entityShared_t->singleClient) 
    Settable for:

    PHP Code:
    void PM_AddEventint newEvent ) {
        
    BG_AddPredictableEventToPlayerstatenewEvent0pm->ps );
    }

    void SendPendingPredictableEventsplayerState_t *ps ) {
        
    gentity_t *t;
        
    int eventseq;
        
    int extEventnumber;

        
    // if there are still events pending
        
    if ( ps->entityEventSequence ps->eventSequence ) {
            
    // create a temporary entity for this event which is sent to everyone
            // except the client who generated the event
            
    seq ps->entityEventSequence & (MAX_PS_EVENTS-1);
            
    event ps->eventsseq ] | ( ( ps->entityEventSequence ) << );
            
    // set external event to zero before calling BG_PlayerStateToEntityState
            
    extEvent ps->externalEvent;
            
    ps->externalEvent 0;
            
    // create temporary entity for event
            
    G_TempEntityps->originevent );
            
    number t->s.number;
            
    BG_PlayerStateToEntityStateps, &t->sqtrue );
            
    t->s.number number;
            
    t->s.eType ET_EVENTS event;
            
    t->s.eFlags |= EF_PLAYER_EVENT;
            
    t->s.otherEntityNum ps->clientNum;
            
    // send to everyone except the client who generated the event
            
    t->r.svFlags |= SVF_NOTSINGLECLIENT// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
            
    t->r.singleClient ps->clientNum;
            
    // set back external event
            
    ps->externalEvent extEvent;
        }

    Those are kind the origins of the events, but that doesn't help much, since these functions are basically just "declaring" those events, so the engine makes them real later on by networking them to the clients.

    The event funcs are called for all kinds of stuff, little overview from Quake 3... you can get the same for CoD2 with IDA, just right-click and "search xrefs" or something:

    Click image for larger version. 

Name:	g_addevent.png 
Views:	34 
Size:	83.5 KB 
ID:	1377

    Click image for larger version. 

Name:	pm_addevent.png 
Views:	31 
Size:	42.3 KB 
ID:	1378

    All the CoD2 events: https://github.com/voron00/libcod/bl...tions.hpp#L275

    The actual networking of those tempentities e.g. is done in the netcode, e.g. stuff like:

    https://github.com/id-Software/Quake...napshot.c#L283

    Lots of aids code to reverse engineer, but the code is speaking about zones etc... I would try to mess around with portals inside the map first, before hacking into the code. But I never used map portals so far, but it seems quite legit that the engine culls away the events which are in different "zones" (like... over 4 steps away). Never messed with that so far.

    CodRadiant BSP Portal tutorial: https://www.youtube.com/watch?v=E_yE56jP2tY
    timescale 0.01

  3. The Following 3 Users Say Thank You to kung foo man For This Useful Post:

    kubislav23 (12th November 2017),Lonsofore (12th November 2017),serthy (12th November 2017)

  4. #3
    Private Lonsofore's Avatar
    Join Date
    Oct 2016
    Posts
    86
    Thanks
    82
    Thanked 38 Times in 25 Posts
    We-ell, thank you a lot, kung, for a such detailed answer. As you said, I'll try portals first and write here about it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •