Wall jumping

Discuss programming in the QuakeC language.
dayfive
Posts: 77
Joined: Fri Nov 10, 2006 9:48 pm

Wall jumping

Post by dayfive »

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??
Quake Matt
Posts: 129
Joined: Sun Jun 05, 2005 9:59 pm

Post by Quake Matt »

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.
dayfive
Posts: 77
Joined: Fri Nov 10, 2006 9:48 pm

Post by dayfive »

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.
Urre
Posts: 1109
Joined: Fri Nov 05, 2004 2:36 am
Location: Moon
Contact:

Post by Urre »

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
dayfive
Posts: 77
Joined: Fri Nov 10, 2006 9:48 pm

Post by dayfive »

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
Quake Matt
Posts: 129
Joined: Sun Jun 05, 2005 9:59 pm

Post by Quake Matt »

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.
Spike
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK
Contact:

Post by Spike »

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.
Quake Matt
Posts: 129
Joined: Sun Jun 05, 2005 9:59 pm

Post by Quake Matt »

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...
r00k
Posts: 1111
Joined: Sat Nov 13, 2004 10:39 pm

Re: Wall jumping

Post by r00k »

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!
dayfive
Posts: 77
Joined: Fri Nov 10, 2006 9:48 pm

Re: Wall jumping

Post by dayfive »

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!
dayfive
Posts: 77
Joined: Fri Nov 10, 2006 9:48 pm

Post by dayfive »

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.
r00k
Posts: 1111
Joined: Sat Nov 13, 2004 10:39 pm

Post by r00k »

.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... :)
dayfive
Posts: 77
Joined: Fri Nov 10, 2006 9:48 pm

Post by dayfive »

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!
dayfive
Posts: 77
Joined: Fri Nov 10, 2006 9:48 pm

Post by dayfive »

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
dayfive
Posts: 77
Joined: Fri Nov 10, 2006 9:48 pm

Post by dayfive »

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....
Post Reply