Inside3D!
     

Wall jumping
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming
View previous topic :: View next topic  
Author Message
dayfive



Joined: 10 Nov 2006
Posts: 77

PostPosted: Sun Apr 22, 2007 3:44 am    Post subject: Wall jumping Reply with quote

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??
Back to top
View user's profile Send private message
Quake Matt



Joined: 05 Jun 2005
Posts: 129

PostPosted: Sun Apr 22, 2007 12:14 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
dayfive



Joined: 10 Nov 2006
Posts: 77

PostPosted: Mon Apr 23, 2007 3:06 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Urre



Joined: 05 Nov 2004
Posts: 1073
Location: Sweden

PostPosted: Tue Apr 24, 2007 7:15 am    Post subject: Reply with quote

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.
_________________
Look out for Twigboy
Back to top
View user's profile Send private message Visit poster's website
dayfive



Joined: 10 Nov 2006
Posts: 77

PostPosted: Tue Apr 24, 2007 8:33 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
Quake Matt



Joined: 05 Jun 2005
Posts: 129

PostPosted: Tue Apr 24, 2007 10:41 am    Post subject: Reply with quote

Quote:
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.
Back to top
View user's profile Send private message
Spike



Joined: 05 Nov 2004
Posts: 944
Location: UK

PostPosted: Tue Apr 24, 2007 2:33 pm    Post subject: Reply with quote

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.
_________________
What's a signature?
Back to top
View user's profile Send private message Visit poster's website
Quake Matt



Joined: 05 Jun 2005
Posts: 129

PostPosted: Tue Apr 24, 2007 8:58 pm    Post subject: Reply with quote

Quote:
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...
Back to top
View user's profile Send private message
r00k



Joined: 13 Nov 2004
Posts: 483

PostPosted: Wed Apr 25, 2007 5:41 am    Post subject: Re: Wall jumping Reply with quote

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:

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:

self.touch           = player_touch;


then add to the last of ' void() PlayerJump '
Code:

      self.timetojump = time + (0.2); //double jump


this will allow 1 boost jump off a wall Smile have fun!
Back to top
View user's profile Send private message
dayfive



Joined: 10 Nov 2006
Posts: 77

PostPosted: Wed Apr 25, 2007 7:32 pm    Post subject: Re: Wall jumping Reply with quote

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:

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:

self.touch           = player_touch;


then add to the last of ' void() PlayerJump '
Code:

      self.timetojump = time + (0.2); //double jump


this will allow 1 boost jump off a wall Smile have fun!
Back to top
View user's profile Send private message
dayfive



Joined: 10 Nov 2006
Posts: 77

PostPosted: Wed Apr 25, 2007 8:57 pm    Post subject: Reply with quote

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:

     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.
Back to top
View user's profile Send private message
r00k



Joined: 13 Nov 2004
Posts: 483

PostPosted: Fri Apr 27, 2007 6:38 am    Post subject: Reply with quote

.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... Smile
Back to top
View user's profile Send private message
dayfive



Joined: 10 Nov 2006
Posts: 77

PostPosted: Sat Apr 28, 2007 4:50 pm    Post subject: Reply with quote

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... Smile



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!
Back to top
View user's profile Send private message
dayfive



Joined: 10 Nov 2006
Posts: 77

PostPosted: Mon Apr 30, 2007 5:31 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
dayfive



Joined: 10 Nov 2006
Posts: 77

PostPosted: Mon Apr 30, 2007 5:46 am    Post subject: Reply with quote

Here's an animated gif of me doing it



I just based it off of r00k's wall jumping code so i have no idea why people are having trouble....
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Inside3d Forums Forum Index -> QuakeC Programming All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2004 phpBB Group