Raised This Month: $51 Target: $400
 12% 

G-strafe/Double-duck in CS:GO


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Beaverboys
Member
Join Date: Aug 2012
Old 06-17-2015 , 04:31   G-strafe/Double-duck in CS:GO
Reply With Quote #1

For those unfamiliar, there existed a type of movement in CS 1.6 and probably other games know as "ground strafing" or "g-strafe." It was essentially a physics exploit where a player would bind their scroll wheel as their duck key, and use this to create very quick little ducks that would teleport the player a short distance (I believe 18 units) off the ground. Pressing ctrl to crouch while in the air after a scroll wheel duck was known as "double-duck." These techniques, often combined with bhopping, were used for many things, such as reducing speed loss after landing, performing "count-jumps", and juking other players.

Here is an example - https://www.youtube.com/watch?v=h6LiKTFyiec

I found out about three cvars (sv_timebetweenducks, sv_repeatedduckslowdown, and sv_timeconsideredfastduck) that may have something to do with the way CS:GO prevents this, but I'm not even sure if they have anything to do with it and they are "locked" cvars, and I don't really understand what that means.

I know that it is possible to replicate g-strafing in CS:GO, as it is shown here - https://www.youtube.com/watch?v=Get4GR6KrqQ I'm not sure if this server did it using sourcemod or cvar changes, but it does not even force players to bind a special command to their scroll wheel, all that is necessary is "bind mwheelup +duck" or "bind mwheeldown +duck".

My question is, can I enable this feature with cvar changes, or do I have to write some code to replicate it? If I do have to write some code for this, what would be the best method?
Beaverboys is offline
Mehis
Senior Member
Join Date: Mar 2013
Location: basement
Old 06-17-2015 , 08:07   Re: G-strafe/Double-duck in CS:GO
Reply With Quote #2

GoldSrc and Source crouching is a lot different. You never leave ground when unducking in Source. Nothing allows this by default in my experience. Also, those three cvars don't exist in CS:GO.

Best way to replicate this is to check whether the player is transitioning into a crouch-position and also unducking, and then push the player up about 16 units.

But there is no reason to do this since all of it is done server-side and nobody wants laggy movement. It will only look like teleporting up and down to anybody with more than 50 ping.
Mehis is offline
Beaverboys
Member
Join Date: Aug 2012
Old 06-17-2015 , 08:27   Re: G-strafe/Double-duck in CS:GO
Reply With Quote #3

Quote:
Originally Posted by Mehis View Post
GoldSrc and Source crouching is a lot different. You never leave ground when unducking in Source. Nothing allows this by default in my experience. Also, those three cvars don't exist in CS:GO.

Best way to replicate this is to check whether the player is transitioning into a crouch-position and also unducking, and then push the player up about 16 units.

But there is no reason to do this since all of it is done server-side and nobody wants laggy movement. It will only look like teleporting up and down to anybody with more than 50 ping.
I just tested the three cvars with sm_cvar and they all seemed to work just fine, but they're probably irrelevant anyway. My first thought was that the movement would be laggy, but I went to the server in the second video and it seemed to work adequately. Besides, this feature is essential for the mod that I'm creating. How exactly would I check if they are transitioning into crouch/unducking?
Beaverboys is offline
Mehis
Senior Member
Join Date: Mar 2013
Location: basement
Old 06-17-2015 , 09:30   Re: G-strafe/Double-duck in CS:GO
Reply With Quote #4

Sorry, I was probably using sm_rcon instead of sm_cvar ;)

Here's what I did:

PHP Code:
#include <sourcemod>
#include <sdktools>

#define DOUBLEDUCK_HEIGHT 32.0 // Has to be more or equal to 20 units.

public Action OnPlayerRunCmdint clientint &buttons )
{
    if ( !
IsPlayerAliveclient ) ) return Plugin_Continue;
    
    static 
int fFlags;
    
fFlags GetEntityFlagsclient );
    
    if ( 
fFlags FL_ONGROUND )
    {
        static 
bool bAllowDoubleDuck[MAXPLAYERS];
        
        if ( 
fFlags FL_DUCKING )
        {
            
// We're fully crouched, no doubleducking.
            
bAllowDoubleDuck[client] = false;
            return 
Plugin_Continue;
        }
        
        if ( 
buttons IN_DUCK )
        {
            
// Next time when we're not holding duck we can do a doubleduck.
            
bAllowDoubleDuck[client] = true;
            return 
Plugin_Continue;
        }
        
        
        
// Is transitioning?
        // m_bDucking doesn't actually tell us whether we're uncrouching or crouching. That is why we're using bAllowDoubleDuck.
        
if ( GetEntPropclientProp_Data"m_bDucking" ) && bAllowDoubleDuck[client] )
        {
            
float vecPos[3];
            
GetClientAbsOriginclientvecPos );
            
vecPos[2] += DOUBLEDUCK_HEIGHT
            
            if ( 
IsValidPlayerPosclientvecPos ) )
            {
                
TeleportEntityclientvecPosNULL_VECTORNULL_VECTOR );
            }
        }

    }
    
    return 
Plugin_Continue;
}

public 
bool IsValidPlayerPosint clientfloat vecPos[3] )
{
    static const 
float vecMins[] = { -16.0, -16.00.0 };
    static const 
float vecMaxs[] = { 16.016.072.0 };
    
    
TR_TraceHullFiltervecPosvecPosvecMinsvecMaxsMASK_SOLIDTraceFilter_IgnorePlayerclient );
    
    return ( !
TR_DidHitnull ) );
}

public 
bool TraceFilter_IgnorePlayerint entint maskany ignore_me )
{
    return ( 
ent != ignore_me );


Last edited by Mehis; 06-17-2015 at 09:37.
Mehis is offline
Beaverboys
Member
Join Date: Aug 2012
Old 06-17-2015 , 09:42   Re: G-strafe/Double-duck in CS:GO
Reply With Quote #5

Quote:
Originally Posted by Mehis View Post
Sorry, I was probably using sm_rcon instead of sm_cvar ;)

Here's what I did:

PHP Code:
#include <sourcemod>
#include <sdktools>

#define DOUBLEDUCK_HEIGHT 32.0 // Has to be more or equal to 20 units.

public Action OnPlayerRunCmdint clientint &buttons )
{
    if ( !
IsPlayerAliveclient ) ) return Plugin_Continue;
    
    static 
int fFlags;
    
fFlags GetEntityFlagsclient );
    
    if ( 
fFlags FL_ONGROUND )
    {
        static 
bool bAllowDoubleDuck[MAXPLAYERS];
        
        if ( 
fFlags FL_DUCKING )
        {
            
// We're fully crouched, no doubleducking.
            
bAllowDoubleDuck[client] = false;
            return 
Plugin_Continue;
        }
        
        if ( 
buttons IN_DUCK )
        {
            
// Next time when we're not holding duck we can do a doubleduck.
            
bAllowDoubleDuck[client] = true;
            return 
Plugin_Continue;
        }
        
        
        
// Is transitioning?
        // m_bDucking doesn't actually tell us whether we're uncrouching or crouching. That is why we're using bAllowDoubleDuck.
        
if ( GetEntPropclientProp_Data"m_bDucking" ) && bAllowDoubleDuck[client] )
        {
            
float vecPos[3];
            
GetClientAbsOriginclientvecPos );
            
vecPos[2] += DOUBLEDUCK_HEIGHT
            
            if ( 
IsValidPlayerPosclientvecPos ) )
            {
                
TeleportEntityclientvecPosNULL_VECTORNULL_VECTOR );
            }
        }

    }
    
    return 
Plugin_Continue;
}

public 
bool IsValidPlayerPosint clientfloat vecPos[3] )
{
    static const 
float vecMins[] = { -16.0, -16.00.0 };
    static const 
float vecMaxs[] = { 16.016.072.0 };
    
    
TR_TraceHullFiltervecPosvecPosvecMinsvecMaxsMASK_SOLIDTraceFilter_IgnorePlayerclient );
    
    return ( !
TR_DidHitnull ) );
}

public 
bool TraceFilter_IgnorePlayerint entint maskany ignore_me )
{
    return ( 
ent != ignore_me );

Thanks, this is extremely helpful, however I don't really understand the purpose of the two bool functions at the end. Also, why does the doubleduck height have to be >= 20? Why can't it be 18 to match CS 1.6?
Beaverboys is offline
Mehis
Senior Member
Join Date: Mar 2013
Location: basement
Old 06-17-2015 , 10:00   Re: G-strafe/Double-duck in CS:GO
Reply With Quote #6

m_bDucking >> is transitioning to standing/crouching
bAllowDoubleDuck >> So we don't doubleduck when transitioning to standing position.

In GoldSrc, when you're in the air your character "pops" higher when crouching. You'll have to have the value over 32 units because you won't be able to go over 32 unit blocks like you can in GoldSrc.

20 is the minimum value to be considered "off the ground". Otherwise you won't actually move off the ground.

Last edited by Mehis; 06-17-2015 at 10:02.
Mehis is offline
Beaverboys
Member
Join Date: Aug 2012
Old 06-17-2015 , 23:34   Re: G-strafe/Double-duck in CS:GO
Reply With Quote #7

This is a great start but it's not really giving me the speed that I need from it. For example, I tried using noclip to gain a bunch of speed, then letting myself fall to the ground and scrolling my mousewheel upon hitting the ground. In CS 1.6, this would help maintain my speed and I'd be able to g-strafe around very quickly for as long as I scrolled my mouse wheel, but with this set-up, I lose basically all my speed upon hitting the ground. Another example is using strafe mod, in CS 1.6 I could hold my strafe modifier key and move around in a circle with my mouse while scrolling my mouse wheel, and gstrafe in a circle very quickly, this still works somewhat but it's not quite as effective.

What exactly is the reason for this slow-down and how could I get rid of it? This is interesting to me because I was also wondering if there's any way I could reduce the huge slow-down that usually occurs when trying to bhop while holding ctrl, and I think a solution to this problem could possibly relate to that as well.

Last edited by Beaverboys; 06-17-2015 at 23:42.
Beaverboys is offline
Beaverboys
Member
Join Date: Aug 2012
Old 07-01-2015 , 05:16   Re: G-strafe/Double-duck in CS:GO
Reply With Quote #8

Bump. Any thoughts?
Beaverboys is offline
headline
SourceMod Moderator
Join Date: Mar 2015
Old 07-01-2015 , 20:56   Re: G-strafe/Double-duck in CS:GO
Reply With Quote #9

Quote:
Originally Posted by Beaverboys View Post
Bump. Any thoughts?
Bumping a thread is a violation to Allied Modder's forum rules

https://forums.alliedmods.net/misc.php?do=showrules
headline is offline
cam0
Senior Member
Join Date: Feb 2015
Old 07-02-2015 , 01:15   Re: G-strafe/Double-duck in CS:GO
Reply With Quote #10

Quote:
Originally Posted by Beaverboys View Post
This is a great start but it's not really giving me the speed that I need from it. For example, I tried using noclip to gain a bunch of speed, then letting myself fall to the ground and scrolling my mousewheel upon hitting the ground. In CS 1.6, this would help maintain my speed and I'd be able to g-strafe around very quickly for as long as I scrolled my mouse wheel, but with this set-up, I lose basically all my speed upon hitting the ground. Another example is using strafe mod, in CS 1.6 I could hold my strafe modifier key and move around in a circle with my mouse while scrolling my mouse wheel, and gstrafe in a circle very quickly, this still works somewhat but it's not quite as effective.

What exactly is the reason for this slow-down and how could I get rid of it? This is interesting to me because I was also wondering if there's any way I could reduce the huge slow-down that usually occurs when trying to bhop while holding ctrl, and I think a solution to this problem could possibly relate to that as well.
Try also installing CS:GO movement unlocker along with this.

I think the server in the video might also be using
Code:
sv_accelerate 5
sv_friction 4
cam0 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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