UT style dodging

Developer discussion of experimental fixes, changes, and improvements.

Moderators: Nexuiz Moderators, Moderators

UT style dodging

Postby lda17h » 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;
   }

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

Postby divVerent » 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.
divVerent
Site admin and keyboard killer
 
Posts: 3809
Joined: Thu Mar 02, 2006 4:46 pm
Location: BRLOGENSHFEGLE

Postby Lee_Stricklin » 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
Lee_Stricklin
Alien trapper
 
Posts: 404
Joined: Sat Jun 21, 2008 8:42 pm
Location: Midwest

Postby lda17h » 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..
lda17h
Alien
 
Posts: 221
Joined: Tue Jun 16, 2009 1:04 pm
Location: Germany

Postby Mizu Kitsune » 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

Postby k0jak » 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

Postby lda17h » 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 ;)
lda17h
Alien
 
Posts: 221
Joined: Tue Jun 16, 2009 1:04 pm
Location: Germany

Postby FraNcoTirAdoR » 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 ;)
FraNcoTirAdoR
Alien trapper
 
Posts: 288
Joined: Tue Mar 04, 2008 10:25 am
Location: near the nex

Postby lda17h » 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?
lda17h
Alien
 
Posts: 221
Joined: Tue Jun 16, 2009 1:04 pm
Location: Germany

Postby alphagod » 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

Next

Return to Nexuiz - Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron