UT style dodging

Developer discussion of experimental fixes, changes, and improvements.

Moderators: Nexuiz Moderators, Moderators

Sun Sep 13, 2009 9:56 pm

  • Hi,

    i wonder whether anybody besides me really digged the UT99 dodging movement style. Well i looked into the quakeC source with some help from the #nexuiz channel (Thanks Spaceman and Samual)..

    Anyway, here's a rudimentary diff to add something in the direction of dodging...

    Note you need to set the cvars

    dodge
    dodge_up
    dodge_double_time
    dodge_reload_time

    to sensible values.. I used these:

    set dodge 500
    set dodge_up 200
    set dodge_double_time 0.25
    set dodge_reload_time 0.5

    EDIT: Notes:

    - This is totally a hack
    - Acceleration is far too high. There should be a "ramp" (albeit a very short one in the order of i'd say 50ms or so)
    - Since i have no idea how the code of the client is really layed out there are probably one million better places to add something like this..

    EDIT2: Notes:

    - To those who don't know what this is about: Besides normal jumping you get another kind of jump when your feet touch the floor (i.e. walking or standing - during bunnyhopping this is impossible to do for practical purposes). Double tap a walking key (FORWARD, BACKWARD, RIGHT, LEFT) and you make a quick jump. Thus the name "dodging". It's good to dodge e.g a rocket.. It's also a great way to start bunnyhopping :)

    Code: Select all
    Index: data/qcsrc/server/cl_client.qc
    ===================================================================
    --- data/qcsrc/server/cl_client.qc   (revision 7768)
    +++ data/qcsrc/server/cl_client.qc   (working copy)
    @@ -1951,14 +1951,43 @@
       zoomstate_set = 1;
    }

    +
    +.float time_last_dodge;
    +.float time_FORWARD_key;
    +.float time_BACKWARD_key;
    +.float time_RIGHT_key;
    +.float time_LEFT_key;
    +
    void GetPressedKeys(void) {
       if (self.movement_x > 0) // get if movement keys are pressed
       {   // forward key pressed
    +      if (!(self.pressedkeys & KEY_FORWARD)) {   // is this a state change?
    +         if (
    +            (time - self.time_FORWARD_key < cvar("dodge_double_time")) &&
    +            (self.lastflags & FL_ONGROUND) &&
    +            ((time - self.time_last_dodge) > cvar("dodge_reload_time"))
    +         ) { // are we allowed to dodge?
    +            self.velocity = self.velocity + (cvar("dodge") * v_forward) + (cvar("dodge_up") * v_up);//'100 0 50';
    +            self.time_last_dodge = time;
    +         }
    +         self.time_FORWARD_key = time;
    +      }
          self.pressedkeys |= KEY_FORWARD;
          self.pressedkeys &~= KEY_BACKWARD;
       }
       else if (self.movement_x < 0)
       {   // backward key pressed
    +      if (!(self.pressedkeys & KEY_BACKWARD)) {   // is this a state change?
    +         if (
    +            (time - self.time_BACKWARD_key < cvar("dodge_double_time")) &&
    +            (self.lastflags & FL_ONGROUND) &&
    +            ((time - self.time_last_dodge) > cvar("dodge_reload_time"))
    +         ) { // are we allowed to dodge?
    +            self.velocity = self.velocity + (cvar("dodge") * v_forward * -1.0) + (cvar("dodge_up") * v_up);//'100 0 50';
    +            self.time_last_dodge = time;
    +         }
    +         self.time_BACKWARD_key = time;
    +      }
          self.pressedkeys |= KEY_BACKWARD;
          self.pressedkeys &~= KEY_FORWARD;
       }
    @@ -1970,11 +1999,33 @@

       if (self.movement_y > 0)
       {   // right key pressed
    +      if (!(self.pressedkeys & KEY_RIGHT)) {   // is this a state change?
    +         if (
    +            (time - self.time_RIGHT_key < cvar("dodge_double_time")) &&
    +            (self.lastflags & FL_ONGROUND) &&
    +            ((time - self.time_last_dodge) > cvar("dodge_reload_time"))
    +         ) { // are we allowed to dodge?
    +            self.velocity = self.velocity + (cvar("dodge") * v_right) + (cvar("dodge_up") * v_up);//'100 0 50';
    +            self.time_last_dodge = time;
    +         }
    +         self.time_RIGHT_key = time;
    +      }
          self.pressedkeys |= KEY_RIGHT;
          self.pressedkeys &~= KEY_LEFT;
       }
       else if (self.movement_y < 0)
       {   // left key pressed
    +      if (!(self.pressedkeys & KEY_LEFT)) {   // is this a state change?
    +         if (
    +            (time - self.time_LEFT_key < cvar("dodge_double_time")) &&
    +            (self.lastflags & FL_ONGROUND) &&
    +            ((time - self.time_last_dodge) > cvar("dodge_reload_time"))
    +         ) { // are we allowed to dodge?
    +            self.velocity = self.velocity + (cvar("dodge") * v_right * -1.0) + (cvar("dodge_up") * v_up);//'100 0 50';
    +            self.time_last_dodge = time;
    +         }
    +         self.time_LEFT_key = time;
    +      }
          self.pressedkeys |= KEY_LEFT;
          self.pressedkeys &~= KEY_RIGHT;
       }

    User avatar
    lda17h
    Alien
     
    Posts: 221
    Joined: Tue Jun 16, 2009 1:04 pm
    Location: Germany

Mon Sep 14, 2009 6:49 am

  • This always made me fall off AS-HiSpeed.
    1. Open Notepad
    2. Paste: ÿþMSMSMS
    3. Save
    4. Open the file in Notepad again

    You can vary the number of "MS", so you can clearly see it's MS which is causing it.
    User avatar
    divVerent
    Site admin and keyboard killer
     
    Posts: 3809
    Joined: Thu Mar 02, 2006 4:46 pm
    Location: BRLOGENSHFEGLE

Mon Sep 14, 2009 8:20 am

  • divVerent wrote:This always made me fall off AS-HiSpeed.

    lol I always disabled it. In UT3 (which was garbage btw) I used an ini tweak to get rid of it.
    I have left this website with the rest of the GPL Nexuiz community. You can find us at Xonotic.org
    User avatar
    Lee_Stricklin
    Alien trapper
     
    Posts: 404
    Joined: Sat Jun 21, 2008 8:42 pm
    Location: Midwest

Mon Sep 14, 2009 10:05 am

  • Lee_Stricklin wrote:
    divVerent wrote:This always made me fall off AS-HiSpeed.

    lol I always disabled it. In UT3 (which was garbage btw) I used an ini tweak to get rid of it.


    Hehe :) Yeah i fell of some edges sometimes, too, due to unintentionally double tapping a direction. But IMHO the added complexity in infights is sooooo worth it..
    User avatar
    lda17h
    Alien
     
    Posts: 221
    Joined: Tue Jun 16, 2009 1:04 pm
    Location: Germany

Wed Sep 16, 2009 3:58 am

  • i think it would be a good idea to implement but leave it as being a clientside setting or a mutator, it would bring in more of a crowd as an opensource shooter with modern features.
    +The Dude+
    [-Project 2501-]
    Mizu Kitsune
    Alien trapper
     
    Posts: 362
    Joined: Sat Apr 11, 2009 7:51 pm
    Location: Maridia

Wed Sep 16, 2009 6:51 pm

  • Really good work lda17h, would like to see this implemented too.

    There is a UT Bible online that tells you what the dodge speed is, or maximum distance able to get :)
    :]

    Image

    kojn translates into horse.

    Signature Pic based on UT-Clan Mates describing trying to spam me and getting confused which routes I take :D
    k0jak
    Forum addon
     
    Posts: 1103
    Joined: Tue Feb 28, 2006 11:36 pm

Wed Sep 16, 2009 7:00 pm

  • k0jak wrote:Really good work lda17h, would like to see this implemented too.

    There is a UT Bible online that tells you what the dodge speed is, or maximum distance able to get :)


    Heh, good that you like it k0jak. This might just be the way to get into your field of view without getting nexxed immediately ;)
    User avatar
    lda17h
    Alien
     
    Posts: 221
    Joined: Tue Jun 16, 2009 1:04 pm
    Location: Germany

Thu Sep 17, 2009 12:22 pm

  • Its a great idea to add this feature as a client side option, people could choose wether they want to use it or not by simply toggling a button in the menu or putting a tick into a box ;)
    User avatar
    FraNcoTirAdoR
    Alien trapper
     
    Posts: 288
    Joined: Tue Mar 04, 2008 10:25 am
    Location: near the nex

Thu Sep 17, 2009 12:35 pm

  • FraNcoTirAdoR wrote:Its a great idea to add this feature as a client side option, people could choose wether they want to use it or not by simply toggling a button in the menu or putting a tick into a box ;)


    Hmm, as my knowledge of the Nexuiz engine and QuakeC in general is quite limited: What would be involved in doing this?
    User avatar
    lda17h
    Alien
     
    Posts: 221
    Joined: Tue Jun 16, 2009 1:04 pm
    Location: Germany

Thu Sep 17, 2009 1:58 pm

  • Nice! I really like this gj lda17h, I think it will add a lot of depth and even help with things on the new weapon balance coming up, you should be able to customize the double key press time as well, aka if you want to dodge if you press the same key one after the other in one second. If you can get this done just set the cvar to 0 and you can disable dodging clientside.
    alphagod
    Member
     
    Posts: 36
    Joined: Sun Jul 06, 2008 3:17 pm

Thu Sep 17, 2009 3:37 pm

  • alphagod wrote:Nice! I really like this gj lda17h, I think it will add a lot of depth and even help with things on the new weapon balance coming up, you should be able to customize the double key press time as well, aka if you want to dodge if you press the same key one after the other in one second. If you can get this done just set the cvar to 0 and you can disable dodging clientside.


    Well, there's the cvar

    dodge_double_time

    which controls exactly that in above diff...
    User avatar
    lda17h
    Alien
     
    Posts: 221
    Joined: Tue Jun 16, 2009 1:04 pm
    Location: Germany

Thu Sep 17, 2009 4:01 pm

  • lda17h wrote:
    FraNcoTirAdoR wrote:Its a great idea to add this feature as a client side option, people could choose whether they want to use it or not by simply toggling a button in the menu or putting a tick into a box ;)


    Hmm, as my knowledge of the Nexuiz engine and QuakeC in general is quite limited: What would be involved in doing this?

    dpextentions.qc could be used in the same way that it was (way back in dpmod) to allow ducking, basically you would make it vector/impulse push the player to the side instead of ducking. but can also be used to dash forward and backwards as well, something that would be a great implementation and can be used by moders to make a 3rd person arena style game or like some of the half-life mods that use such implementation like the new naruto mod for hl or like igii gunz when the player has the melee weapon. +1 for implementation.
    +The Dude+
    [-Project 2501-]
    Mizu Kitsune
    Alien trapper
     
    Posts: 362
    Joined: Sat Apr 11, 2009 7:51 pm
    Location: Maridia

Thu Nov 26, 2009 12:41 pm

  • I created a small movie to show off the dodging code :)

    http://www.youtube.com/watch?v=CVDFQIQQE8Q

    It's not the clearest but i wanted to show it in a match..
    He can talk the talk, but can he caulk the caulk?
    User avatar
    lda17h
    Alien
     
    Posts: 221
    Joined: Tue Jun 16, 2009 1:04 pm
    Location: Germany

Fri Nov 27, 2009 11:36 am

  • There are still some things missing:
    Not falling off edges when holding the walking key.
    Walljumps
    Rolling (like in Jedi Knight) (dodge forward + rolling afterwards would be useful to quickly move through a dangerous area)
    And climbing :P

    Then it would be perfect hehe :P
    User avatar
    Blµb
    Alien trapper
     
    Posts: 277
    Joined: Thu Mar 29, 2007 1:49 pm

Fri Nov 27, 2009 3:49 pm

  • Blµb wrote:There are still some things missing:
    Not falling off edges when holding the walking key.
    Walljumps
    Rolling (like in Jedi Knight) (dodge forward + rolling afterwards would be useful to quickly move through a dangerous area)
    And climbing :P

    Then it would be perfect hehe :P


    Actually i'm with you.. Combined with bunny hopping that would be the most awesome movement in a FPS ever :)
    He can talk the talk, but can he caulk the caulk?
    User avatar
    lda17h
    Alien
     
    Posts: 221
    Joined: Tue Jun 16, 2009 1:04 pm
    Location: Germany

Fri Nov 27, 2009 4:40 pm

  • lda17h wrote:
    Blµb wrote:There are still some things missing:
    Not falling off edges when holding the walking key.
    Walljumps
    Rolling (like in Jedi Knight) (dodge forward + rolling afterwards would be useful to quickly move through a dangerous area)
    And climbing :P

    Then it would be perfect hehe :P


    Actually i'm with you.. Combined with bunny hopping that would be the most awesome movement in a FPS ever :)


    After a bit of thought: We have the laser for walljumps. That's the better solution imho.. I liked how in UT your character did a roll in the air when dodging sometimes. Don't remember whether that changed the hitbox, too..

    It would be cool if you had a lot of speed and landed while crouched, then you'd start rolling until you uncrouch..
    Of course the view has to tumble around you, so your fighting skills are impeded during this sort of action :)
    He can talk the talk, but can he caulk the caulk?
    User avatar
    lda17h
    Alien
     
    Posts: 221
    Joined: Tue Jun 16, 2009 1:04 pm
    Location: Germany

Wed Dec 02, 2009 12:56 am

  • Well don't over-complicate it imo.

    Don't do the effect's fighting if you roll etc, not sure about ground roll's but I know what you mean about the roll's in air.

    As far as I know in UT / UT2004 it doesn't effect the hitbox, but not certain :)

    Nice video also, more video when you've got the basics more tweaked?
    :]

    Image

    kojn translates into horse.

    Signature Pic based on UT-Clan Mates describing trying to spam me and getting confused which routes I take :D
    k0jak
    Forum addon
     
    Posts: 1103
    Joined: Tue Feb 28, 2006 11:36 pm

Wed Dec 02, 2009 2:27 am

  • k0jak wrote:Well don't over-complicate it imo.

    Don't do the effect's fighting if you roll etc, not sure about ground roll's but I know what you mean about the roll's in air.

    As far as I know in UT / UT2004 it doesn't effect the hitbox, but not certain :)

    Nice video also, more video when you've got the basics more tweaked?


    Unreal and Unreal Tournament use a cylinder I believe.
    I have left this website with the rest of the GPL Nexuiz community. You can find us at Xonotic.org
    User avatar
    Lee_Stricklin
    Alien trapper
     
    Posts: 404
    Joined: Sat Jun 21, 2008 8:42 pm
    Location: Midwest

Thu Jan 07, 2010 8:24 pm

  • quick question: how do I implement this? (what do I do with the code)
    Why has a developer ever needed any reason other than "it looks bloody awesome?"

    -Archon
    User avatar
    Yoda almighty
    Alien
     
    Posts: 151
    Joined: Thu Aug 20, 2009 2:19 am
    Location: somewhere in the void

Thu Jan 07, 2010 11:49 pm

  • Yoda almighty wrote:quick question: how do I implement this? (what do I do with the code)


    Well, i based this on an SVN version of nexuiz, but i guess you might try the following, assuming you use linux:

    * Copy and paste the above diff into a text file, call it e.g. dodging.diff
    * Then unzip the nexuiz source archive which is shipped with the 2.5.2 release.. It's called something like Nexuiz/sources/gamesource20091012.zip
    * You need to have an installation of fteqcc. Finding the right version is a bit of a challenge. Don;t know whether you can just try to compile the one shipped, too
    * change into the qcsrc directory which should have been exrtacted from the gamesource zip
    * Then do
    Code: Select all
    patch --dry-run -p1 < /path/to/dodging.diff


    If that applies cleanly and you get no rejects, do

    Code: Select all
    patch -p1 < /path/to/dodging.diff


    * Then run make and this process should create a file called csprogs.dat or something.. This needs to be copied into the (i think) data/ dir
    He can talk the talk, but can he caulk the caulk?
    User avatar
    lda17h
    Alien
     
    Posts: 221
    Joined: Tue Jun 16, 2009 1:04 pm
    Location: Germany

Fri Jan 08, 2010 11:29 pm

  • I am on mac, would this process still work as you describe?
    Why has a developer ever needed any reason other than "it looks bloody awesome?"

    -Archon
    User avatar
    Yoda almighty
    Alien
     
    Posts: 151
    Joined: Thu Aug 20, 2009 2:19 am
    Location: somewhere in the void



Return to Nexuiz - Development




Information
  • Who is online
  • Users browsing this forum: No registered users and 1 guest