Announcement

Collapse
No announcement yet.

Joystick Handling Code

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Joystick Handling Code

    Hi,

    I'm looking at tweaking the joystick handling code and was wondering where in the DP source that was done. Specifically where the cvars for the joystick are set and how the input from the joystick is read, processed and then sent to the server.

    Regards,

    SR

  • #2
    vid_shared.c line 1406 +/- a few lines.

    But if you can't do even do a text search, you are in for rude awakenings upon rude awakenings --- I'm just saying.
    Quakeone.com - Being exactly one-half good and one-half evil has advantages. When a portal opens to the antimatter universe, my opposite is just me with a goatee.

    So while you guys all have to fight your anti-matter counterparts, me and my evil twin will be drinking a beer laughing at you guys ...

    Comment


    • #3
      lol
      http://www.nextgenquake.com

      Comment


      • #4
        textcrawler
        the invasion has begun! hide your children, grab the guns, and pack sandwiches.

        syluxman2803

        Comment


        • #5
          Ha, it works. Thanks everybody.
          Last edited by Syber Raith; 02-11-2017, 02:54 PM.

          Comment


          • #6
            Originally posted by Syber Raith View Post
            Well, it works. Thanks everybody.
            Congrats
            Quakeone.com - Being exactly one-half good and one-half evil has advantages. When a portal opens to the antimatter universe, my opposite is just me with a goatee.

            So while you guys all have to fight your anti-matter counterparts, me and my evil twin will be drinking a beer laughing at you guys ...

            Comment


            • #7
              I'm playing with scaling the joystick input in various ways. I've got it significantly better. Plus I'm building skill at using a joystick. I've only uses a mouse and keyboard since I first started playing the game.

              I have a basic change that smooths out the deadzone transition. I'd like to push that to the git repository. Do I need to sign up anywhere to do that?

              ***

              Another thing I noticed is that when I I just input max yaw, the rotation in the game varies a bit as 360 degree are passed though, it kind of slows down at one point and then speeds up again. The yaw speed varies in the game a little bit without any change on the user input.
              Last edited by Syber Raith; 02-11-2017, 02:14 PM.

              Comment


              • #8
                Just to make sure I comprehend what I am doing here. Is this correct?

                Say if cl_speedforward were set to 100,

                And joy_sensitivityfoward was set to 1,

                Then at max foward joystick input the forward speed of the player in the game would be 100.

                And if the joy_sensitivityfoward was set to 2, then at max forward joystick input the player speed in the game would 200, give there was free area ahead.

                Comment


                • #9
                  that sounds wrong. That implies that you could hack the game by simply changing your joystick properties.

                  I bet it's more like

                  joystick pushed >= 1/sensitivity = fwd speed
                  Last edited by MadGypsy; 02-12-2017, 08:57 PM.
                  http://www.nextgenquake.com

                  Comment


                  • #10
                    The joystick puts out a value from -1 to 1 on each axis.

                    It is easy enough to see in the game that for any particular cl_forrwardspeed setting that a higher sensitivity results in faster motion or greater response to a particular joystick input. If the sensitivity was used as a divisor then a higher sensitivity setting would result in less forward speed or response to a given joystick input.

                    In the code the joystick input is multiplied by the sensitivity setting. This means that the the sensitivity is a linear as opposed to a non-linear acceleration curve. I am in the process of trying to create a non-linear sensitivity response.

                    It would be helpful if the game had a current forward speed display like the fps one. Hmm...

                    Maybe, I could hack the FPS display to reflect current forward speed. That would be interesting.

                    Comment


                    • #11
                      @ If the sensitivity was used as a divisor then a higher sensitivity setting would result in less forward speed or response to a given joystick input.

                      Not in the way I put it. The way I illustrated the divisor it would result in you getting to full speed at the divided amount of push on the joystick.

                      ex

                      sensitivity = 3;

                      1/sensitivity = amount of push to achieve full speed

                      so you would only have to move the joystick 33% to achieve full speed. Hence the term sensitivity. In this case it would be 300% more sensitive. This would also result in 66% of the outer circle being useless because 0 to 33% covers the full range of speed.

                      If your game is actually allowing you to change speed based on joystick sensitivity (ie multiplying) that is not a very good game. Imagine playing against someone that had their sensitivity at 5. How fun would that be? Joysticks are meant for navigation not configging the speed of your player regardless of the actual config or game code.
                      Last edited by MadGypsy; 02-14-2017, 04:42 AM.
                      http://www.nextgenquake.com

                      Comment


                      • #12
                        The max speed is capped by a the cl_movement_maxspeed and sv_maxspeed CVARs. At the moment I have them set to the standard 320.

                        I've been hacking the joystick code, so I know that the value of joy_sensitivity[forward, side, yaw] CVARs is multiplied with the joystick axis output. So in effect it works something like you said. If the sensitivity is set high enough, then the max speed will be reached before the joystic reaches full travel.

                        I have the sensitivity current set around 1.5, and now in the game the max speed is achieved at very close to full travel of the joystick. Maximum output from the joystick is -1 and 1. So the engine apparently multiplies the final value, the joystick output times the sensitivity setting, by about 200 to yield the game speed. I have yet to look into that code though.
                        Last edited by Syber Raith; 02-17-2017, 08:05 AM.

                        Comment


                        • #13
                          My progress so far:

                          Graph 1 shows the original darkplaces and presumably original Quake joystick response with the deadzone set to about 0.1, which is necessary with my thrift-store joystick.

                          As you can see there is a nasty jump at the deadzone transition. So the first thing I did was to smooth that out as shown in graph 2. Just this makes the joystick response feel noticeably better, although for me there is still too much response for fine control in the lower range of the joystick travel.

                          So to get better control in the lower end of the joystick range, so I added in a non-linear transformation to the joysitck output as shown in graph 3.

                          The response is much better now as I put the final adjustments on the parameters of the non-linear transformation.
                          Attached Files
                          Last edited by Syber Raith; 02-17-2017, 08:10 AM.

                          Comment


                          • #14
                            That's neat stuff, bro. Keep up the good work.
                            http://www.nextgenquake.com

                            Comment

                            Working...
                            X