[WIP] Realistic Gearshift

Discussion in 'Other' started by Seven Smiles, Dec 11, 2017.

  1. Seven Smiles

    Seven Smiles Registered

    Joined:
    Oct 5, 2010
    Messages:
    1,099
    Likes Received:
    1,152
    Please go to the new thread
    ____________________________________________________________

    Inspired by the "Grinding Tranny Mod" this is an AutoHotkey script that monitors a shifter and clutch and if a gear change is not done properly it repeatedly sends a "Neutral" key press to prevent the gear being selected and sounds a graunching noise. Designed and tested with rFactor 2 but should work with any game.

    ________________________________________________________________________
    WARNING: Needs updating to latest pyinstaller to overcome its vulnerability GHSA-7fcj-pq9j-wh2r (if you want details: https://pyinstaller.readthedocs.io/en/v3.6/CHANGES.html) but at the moment there are errors in the build process so I haven't been able to make a new exe file. I don't think this is a particularly serious vulnerability in this case but it's up to you.
    ________________________________________________________________________________

    [UPDATE]: I translated it into Python, made it into gearshift.exe and added Configurer.exe to simplify setting it up (though you can edit gearshift.ini if you want/need). https://github.com/TonyWhitley/gearshift/releases The source is there too for anyone nervous of downloading unknown exe files (you'll need Python 3 and PyGame). See the readme https://github.com/TonyWhitley/gearshift

    There are no new features (yet), the .exes just make it easier to use. There is no need for AutoHotkey (or Python) the two programs should just run.

    [UPDATE ends]

    This was written as a "Proof of Concept" to test whether the gear shift in rF2 could be controlled, it is still in beta and is likely to stay that way (the AHK language is hard work) - it works on my PC with my G25 but there may be issues when used in different environments (wheels, keyboard layouts, who knows?). There is very limited reconfiguration provided, you can change shifter device number by editing the line
    JoystickNumber = 1
    and a couple of other tweaks but, for example, other shifters may require editing the script (it's not that complicated).

    Note: it's just a script, you have to install AutoHotkey to run it (see the README)

    https://github.com/TonyWhitley/Gearshift.ahk
     
    Last edited: Jan 17, 2020
    MaD_King, billyblaze, Alex72 and 9 others like this.
  2. Pauli Partanen

    Pauli Partanen Registered

    Joined:
    May 15, 2012
    Messages:
    1,091
    Likes Received:
    1,748
    Thanks! Will test tonight
     
  3. Filip

    Filip Registered

    Joined:
    Feb 9, 2017
    Messages:
    1,208
    Likes Received:
    937
    What exactly does it mean "gear change is not done properly"?
    I have had misshifts only with Ferrary 312 mod and Mak Corp Group C mod. In all other cars I've tried shifting is always successful.
    Will this have an effect on other cars too?

    P.S.
    I have autoclutch an peddal shifters. Will it work for me?
     
  4. davehenrie

    davehenrie Registered

    Joined:
    Jul 6, 2016
    Messages:
    7,454
    Likes Received:
    4,369
    I think this is targeted at users with both a shifter and the manual clutch enabled.
     
    Louis likes this.
  5. Seven Smiles

    Seven Smiles Registered

    Joined:
    Oct 5, 2010
    Messages:
    1,099
    Likes Received:
    1,152
    For now "gear change is not done properly" just means that the clutch wasn't pressed before changing gear with a shifter. Yes, it works on rF2 itself so all cars will be affected - exit AHK and clutchless changes are OK. It's written to work on an H shifter, I could add the paddle shift buttons.
     
    Mauro likes this.
  6. Pauli Partanen

    Pauli Partanen Registered

    Joined:
    May 15, 2012
    Messages:
    1,091
    Likes Received:
    1,748
    To make this work like it should on Ferrari 312/67 select the "H-shifter" option and not the realistic/hardcore from tuning menu.
     
  7. Filip

    Filip Registered

    Joined:
    Feb 9, 2017
    Messages:
    1,208
    Likes Received:
    937
    I will try that.
    Unfortunately no clutch pedal here on my wheel so I have autoclutch.
    It would be nice to have noise when improperly shifting a gear.
     
  8. ctbr

    ctbr Registered

    Joined:
    Jan 11, 2012
    Messages:
    34
    Likes Received:
    5
    Doesn't work for me,but I have separate pedals and shifter. I guess that the script requires that the clutch and shifter are the same Joystick.

    Would it be possible to modify the script so that you could put in Joysticknumber for both shifter and clutch?
     
    Last edited: Dec 12, 2017
  9. Seven Smiles

    Seven Smiles Registered

    Joined:
    Oct 5, 2010
    Messages:
    1,099
    Likes Received:
    1,152
    No problem, new version uploaded with

    Code:
    ShifterNumber  =    1       ; Shifter port
    ClutchNumber   =    1       ; Clutch port
    
    Edit to suit.
     
    Mauro likes this.
  10. ctbr

    ctbr Registered

    Joined:
    Jan 11, 2012
    Messages:
    34
    Likes Received:
    5
    Great I will test tonight and let you know the result
     
  11. ctbr

    ctbr Registered

    Joined:
    Jan 11, 2012
    Messages:
    34
    Likes Received:
    5
    I can't get it to work.
    The Clutch is JOY 1RZ- and the gears are JOY4 B1 to B8
    Neutral is mapped to KP 0 and works if pressed on keyboard
     
  12. elbo

    elbo Registered

    Joined:
    Feb 19, 2012
    Messages:
    625
    Likes Received:
    182
    if it makes the noise but does not work then simply run the script as admin, I had to do that to get it to work.
     
  13. ctbr

    ctbr Registered

    Joined:
    Jan 11, 2012
    Messages:
    34
    Likes Received:
    5
    no noice :-(
     
  14. Seven Smiles

    Seven Smiles Registered

    Joined:
    Oct 5, 2010
    Messages:
    1,099
    Likes Received:
    1,152
    New version 1.3 uploaded with extra configuration and a Test Mode that displays the results of that configuration. In your case you probably need EDIT: this is for the original AutoHotKey version of the program.
    Code:
    ForwardGears = 7            ; Plus reverse
    Shifter1 = Joy1
    Shifter2 = Joy2
    Shifter3 = Joy3
    Shifter4 = Joy4
    Shifter5 = Joy5
    Shifter6 = Joy6
    Shifter7 = Joy7
    ShifterR = Joy8
    ClutchAxis = JoyZ           ; R U V or Z
    

    The script handles different numbers of forward gears in Test Mode but needs more work to change the grinding code to work with other than 6 gears.
     
    Last edited: Oct 14, 2018
    bravotangosix, lbird and Mauro like this.
  15. doddynco

    doddynco Registered

    Joined:
    Dec 13, 2017
    Messages:
    574
    Likes Received:
    1,217
    I've managed to get the shifter to work in test mode but cannot figure out which clutch port/axis setting is needed. My in-game clutch axis reads 'JOY3 RZ-' and is not on the same usb port as my wheel or shifter. Any ideas?
    Cheers,
     
  16. ctbr

    ctbr Registered

    Joined:
    Jan 11, 2012
    Messages:
    34
    Likes Received:
    5
    Step by step you getting this to work for me.
    With 1.3 I have the grindin noice all the time and can't get into gear.
    The debug windows shows that the gears are working fine but the clutch shows 100 engaged all the time.
    I tested with changing ClutchAxis to JoyZ- but it's shows disengaged
    Do I need to change anything in player.json?
     
  17. ctbr

    ctbr Registered

    Joined:
    Jan 11, 2012
    Messages:
    34
    Likes Received:
    5
    Hi,
    I stared to test this again with my new setup.
    I have the following settings:
    ForwardGears = 7 ; Plus reverse
    Shifter1 = Joy1
    Shifter2 = Joy2
    Shifter3 = Joy3
    Shifter4 = Joy4
    Shifter5 = Joy5
    Shifter6 = Joy6
    Shifter7 = Joy7
    ShifterR = Joy8
    ClutchAxis = JoyY ; R U V or Z

    ShifterNumber = 4 ; Shifter port
    ClutchNumber = 5 ; Clutch port

    TestMode = true ; If true then show shifter and clutch operation

    ClutchEngaged = 10 ; (0 - 100) the point in the travel where the clutch engages
    doubleDeclutch = false ; Not yet implemented
    reshift = true ; If true then neutral has to be selected before
    ; retrying failed change. If false then just have
    ; to de-clutch

    The test window shows that the gears works as they should but the clutch show "100 Engaged" without pressing it.
    * How do I invert the clutch axis? I have tried with JoyY-, Joy-Y etc.

    I game I can't hear any noise

    I would be happy if you could look at this, I have tried but I donät understand the code :)
     
  18. Seven Smiles

    Seven Smiles Registered

    Joined:
    Oct 5, 2010
    Messages:
    1,099
    Likes Received:
    1,152
    Sorry, I missed your post on the 13th. I'll have a look at the clutch problem now.
     
  19. Seven Smiles

    Seven Smiles Registered

    Joined:
    Oct 5, 2010
    Messages:
    1,099
    Likes Received:
    1,152
    New version with an extra config parameter
    Code:
    ReverseClutchAxis = false   ; If true then the clutch input goes from 100 (down) to 0 (up)
    
    If you change that then ClutchEngaged needs editing too
    Code:
    ClutchEngaged  =    90      ; (0 - 100) the point in the travel where the clutch engages
                                ; if ReverseClutchAxis then ClutchEngaged = 10
    
     
  20. Seven Smiles

    Seven Smiles Registered

    Joined:
    Oct 5, 2010
    Messages:
    1,099
    Likes Received:
    1,152
    So does mine, so your clutch seems to be the same "polarity" and so it should be working. What does it show when you press it? Mine shows "0 disengaged"
     

Share This Page