Forum

Wall jumping

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

Wall jumping

Postby dayfive » Sun Apr 22, 2007 3:44 am

Hi guys,

What is a good way to do a wall jump? I put some example code in the pastebin

http://inside3d.com/pastebin.php?action=show&id=146
http://inside3d.com/pastebin.php?action=show&id=145

id 145 is the original Quake jumping implementation.

What I'm trying to figure out is how can you simulate something where you can kind of kick off the wall.. so you'd jump and touch the wall brush and be able to jump back

id 146 is kind of close but it more or less sticks you to the wall.. what's a good way to jump off it and be able to scale a flat surface by jumping back and forth towards the wall??
User avatar
dayfive
 
Posts: 77
Joined: Fri Nov 10, 2006 9:48 pm

Postby Quake Matt » Sun Apr 22, 2007 12:14 pm

I did this once by sending out tracelines a short distance to the left and right. If either of them hit a solid surface while the player was in the air, he was launched upwards and sideways with an accompanying jump sound. It worked pretty well, I found, and can be adapted to jump in any direction.

Looking at the code, you'd pretty much want to switch around the FL_ONGROUND and FL_JUMPRELEASED tests and put your wall-checking code between the two.
User avatar
Quake Matt
 
Posts: 129
Joined: Sun Jun 05, 2005 9:59 pm

Postby dayfive » Mon Apr 23, 2007 3:06 pm

thanks for the tip! I'm experimenting with traceline (); and findradius ();


Quake Matt wrote:I did this once by sending out tracelines a short distance to the left and right. If either of them hit a solid surface while the player was in the air, he was launched upwards and sideways with an accompanying jump sound. It worked pretty well, I found, and can be adapted to jump in any direction.

Looking at the code, you'd pretty much want to switch around the FL_ONGROUND and FL_JUMPRELEASED tests and put your wall-checking code between the two.
User avatar
dayfive
 
Posts: 77
Joined: Fri Nov 10, 2006 9:48 pm

Postby Urre » Tue Apr 24, 2007 7:15 am

findradius will not find walls of any kind, not even brush entities afaik (someone correct me if I'm wrong), so I don't see the use of that in your case.
I was once a Quake modder
User avatar
Urre
 
Posts: 1109
Joined: Fri Nov 05, 2004 2:36 am
Location: Moon

Postby dayfive » Tue Apr 24, 2007 8:33 am

Urre wrote:findradius will not find walls of any kind, not even brush entities afaik (someone correct me if I'm wrong), so I don't see the use of that in your case.


for jumping off of entities, the thinking is that if a character has the strength to jump off a wall, they should be also able to vault off of a monster too
User avatar
dayfive
 
Posts: 77
Joined: Fri Nov 10, 2006 9:48 pm

Postby Quake Matt » Tue Apr 24, 2007 10:41 am

for jumping off of entities, the thinking is that if a character has the strength to jump off a wall, they should be also able to vault off of a monster too


You should be able to use traceline for that too, since it can detect the hitboxes. One of the arguments it takes is findmonsters - you've just got to make sure it's set to true and you should be away.
User avatar
Quake Matt
 
Posts: 129
Joined: Sun Jun 05, 2005 9:59 pm

Postby Spike » Tue Apr 24, 2007 2:33 pm

Yeah, just do a few different tracelines in a circle around the player. Set nomonsters to false and the trace will hit monsters/players too.

Any that have trace_fraction set to 1 didn't hit anything.
This will give you a value in trace_plane_normal.
Use trace_plane_normal to set the velocity of the player to travel away from the wall. If you're brave, you can try combining the normals from the different traces so jumping in a corner of a cube will bounce you into the center of the room.

findradius is impractical to use for finding moving platforms, and too clumsy to use to find the bounding boxes of monsters. Just use traceline and it'll tell you what it hit, the angle of what it hit, and where it hit.
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Postby Quake Matt » Tue Apr 24, 2007 8:58 pm

Set nomonsters to false and the trace will hit monsters/players too.


Ah, that sounds about right. Long time since I've looked at a traceline...
User avatar
Quake Matt
 
Posts: 129
Joined: Sun Jun 05, 2005 9:59 pm

Re: Wall jumping

Postby r00k » Wed Apr 25, 2007 5:41 am

dayfive wrote:Hi guys,

What is a good way to do a wall ...


Here's my code i used in the past...

clientq.c add above putclientinserver()

Code: Select all
void() player_touch =
{
   if ((other.solid == SOLID_BSP) && (self.button2))
   {
      if ((time > self.timetojump)&& (time > self.timetojump2))
      {
         if ((!self.flags & FL_ONGROUND)) self.flags = self.flags + FL_ONGROUND;
         self.velocity = v_up + (self.velocity * 2);
         self.velocity = v_forward + (self.velocity * 1.05);//small push when jumping
         self.velocity = v_right   + (self.velocity * 1.05);//small push when jumping

         self.timetojump2 = time + 0.5;
         return;
      }
   }
}


in void() PutClientInServer = add somewhere in the middle..
Code: Select all
self.touch           = player_touch;


then add to the last of ' void() PlayerJump '
Code: Select all
      self.timetojump = time + (0.2); //double jump


this will allow 1 boost jump off a wall :) have fun!
r00k
 
Posts: 1110
Joined: Sat Nov 13, 2004 10:39 pm

Re: Wall jumping

Postby dayfive » Wed Apr 25, 2007 7:32 pm

how do you define timetojump and/or timetojump2 in this example ?

is it declared as a .float or a .vector somewhere ?


r00k wrote:
dayfive wrote:Hi guys,

What is a good way to do a wall ...


Here's my code i used in the past...

clientq.c add above putclientinserver()

Code: Select all
void() player_touch =
{
   if ((other.solid == SOLID_BSP) && (self.button2))
   {
      if ((time > self.timetojump)&& (time > self.timetojump2))
      {
         if ((!self.flags & FL_ONGROUND)) self.flags = self.flags + FL_ONGROUND;
         self.velocity = v_up + (self.velocity * 2);
         self.velocity = v_forward + (self.velocity * 1.05);//small push when jumping
         self.velocity = v_right   + (self.velocity * 1.05);//small push when jumping

         self.timetojump2 = time + 0.5;
         return;
      }
   }
}


in void() PutClientInServer = add somewhere in the middle..
Code: Select all
self.touch           = player_touch;


then add to the last of ' void() PlayerJump '
Code: Select all
      self.timetojump = time + (0.2); //double jump


this will allow 1 boost jump off a wall :) have fun!
User avatar
dayfive
 
Posts: 77
Joined: Fri Nov 10, 2006 9:48 pm

Postby dayfive » Wed Apr 25, 2007 8:57 pm

so i tried the example code and i was getting more like a pogo stick type effect.

i just was experimenting with it and i came up with this which is kind of close but is lacking in a few key ways

Code: Select all
     if ( !(self.flags & FL_ONGROUND) && (self.button2))
      {
      if ( (self.flags & FL_JUMPRELEASED) )
        self.velocity_z = self.velocity_z - 12.5;

                self.velocity_z = self.velocity_z + 25;
           self.flags = self.flags + FL_ONGROUND;
      self.button2 = 0;
        
      }


it needs to somehow stop when the jump button is held, at present it just keeps propelling upward. if you press jump and release and press again you can kind of stairwalk which is sort of what i'm going for, but against a brush.
User avatar
dayfive
 
Posts: 77
Joined: Fri Nov 10, 2006 9:48 pm

Postby r00k » Fri Apr 27, 2007 6:38 am

.float timetojump;
.float timetojump2;

If i just hold +jump it doesnt keep jumping....

the time delay on the second limits the space between initial jump off ground to contact with wall.. gavity wins ultimately, unless u tweak the velocity....

test it out at quake.intertex.net i have a mod running that has wall jumps... :)
r00k
 
Posts: 1110
Joined: Sat Nov 13, 2004 10:39 pm

Postby dayfive » Sat Apr 28, 2007 4:50 pm

r00k wrote:the time delay on the second limits the space between initial jump off ground to contact with wall.. gavity wins ultimately, unless u tweak the velocity....

test it out at quake.intertex.net i have a mod running that has wall jumps... :)



ahhhhhhh ok.... your description, example code and my connecting to your server at quake.internex.net have helped me understand this concept in great detail.

For this you have my humble thanks!
User avatar
dayfive
 
Posts: 77
Joined: Fri Nov 10, 2006 9:48 pm

Postby dayfive » Mon Apr 30, 2007 5:31 am

So I thought I had it figured out, but it seems like people are having trouble....

I've tested this in darkplaces-glx, tyr-glquake, and tyr-quake and it seems to work fine:

Can anyone try this and verify whether or not the wall jumping works?

http://harbl.iiichan.net/MMX.zip

I noticed that when running forward like the normal quake guy and trying to catch the wall jump from the side while moving forward doesn't work - as intended. You kind of have to be constantly pressing into the wall.

It works from a standing start or a moving start if once you hit the wall you move into the wall while jumping repeatedly. This is of course still a work in progress
User avatar
dayfive
 
Posts: 77
Joined: Fri Nov 10, 2006 9:48 pm

Postby dayfive » Mon Apr 30, 2007 5:46 am

Here's an animated gif of me doing it

Image

I just based it off of r00k's wall jumping code so i have no idea why people are having trouble....
User avatar
dayfive
 
Posts: 77
Joined: Fri Nov 10, 2006 9:48 pm

Next

Return to QuakeC Programming

Who is online

Users browsing this forum: Bing [Bot] and 1 guest