Racing Wheel Scripts

GPC2 script programming for Titan Two. Code examples, questions, requests.

Racing Wheel Scripts

Postby Hyphen- » Tue Jun 01, 2021 11:55 pm

Question: Can a script be used to influence the movements of the R2 and L2 triggers on a scale.

Gran Tourism Sport a good racing car game :a1chill_angry1: and simulator is almost being given away so I got it and I the G29 Logitech Wheel. I hooked up the G29 wheel to a PS4 through the T2. That story is below but

After seeing that GTuner was translating the brake and accelerator to R2 and L2 I knew there is a script for that. Just like recoil control if the game measures trigger pull on a scale then one should be able to use a similar script to influence that number before it reaches the game. I simplify a little but that is what i am here to ask.

Brake control on expensive good quality entry level wheels Logitech G29 which are as much as some higher end controllers is like the holy grail of problems you could solve to make yourself famous. And when I said L2 and R2 it was like oh my gosh this is potentially possible. Everyone or more than part time users want any wheel to have that.

Question 2: Are the parts for this idea already written for any other gamepacks that would do this... Thanks I love my T2 this only will make it greater.

Question 3:
As hard as many are working and many projects that may already be going on... is this something that could be done and if not to difficult to do is anyone up to the helping this happen?

If there is a reason this cannot be done that would be interesting to hear. yes I love my T2 it is very desirable to have it be a part in balancing equipment for this game.
____________________________________________________________________________________
This is my story and comments from working on getting the G29 to work on PS4 through the T2...

Like is noted for the G29... Changing the setting to ps3 made everything work fine on G29 and it recognizes the pedals now okay. I am using the Gtuner and T2 the pedals work and all on the ps4 doing this. The wheel was a little touchy and could disconnect itself though putting T2 into looking for a device mode.

I could in game just turn the switch from ps3 to ps4 and back again and after re calibrating it worked fine again. Be careful with your fingers reach for the switch from the back it will engage sometimes the calibration for ps4 and then again when to goes to ps3 sometimes. The disconnecting happened more than once it was not doing that when directly connected to the ps4 so I may put it direct to test it that way to see what differences I am getting trying to use the T2 in between devices.

Steering wheel movements do not show up in Gtuner like stick movements do and gas and brake are mapped to r2 and l2 for the console it looks like. The ps4 functions work really well on the wheel and no problems there with T2. I turned on the script for dead zones while playing through T2 but I don't know if it is doing anything yet being brand new to the game, I'm learning manual shifting, and using the wheel, and brake/Gas pedals all at the same time so nuances like dead zones will be hard to detect till skill level goes up.. then on the list.

If there was a way to put recoil control on the L2 trigger you should be able to influence the brake pressure need to go to 100% and you should be able to decrease braking levels from 1 to 100 or make it a hair trigger so if you set it at 60% it would always be 60% at any push or even in between that. I am assuming this is probable I may add this to desired new script thread. (adapted)
User avatar
Hyphen-
Sergeant Major
Sergeant Major
 
Posts: 76
Joined: Sat Dec 01, 2018 6:30 am

Re: Racing Wheel Scripts

Postby Hyphen- » Wed Jun 02, 2021 1:43 am

Did some more reading and even though the G29 does authenticate on its own because we have to use ps3 (as pc) setting on the wheel it no longer provides authentication for the ps4 and the disconnects could be because of that. So I will have to use my ps4 controller on B and the wheel on A. which is a fix for that... for the current only way of using the T2 with G29 on Ps4 test it later.
User avatar
Hyphen-
Sergeant Major
Sergeant Major
 
Posts: 76
Joined: Sat Dec 01, 2018 6:30 am

Re: Racing Wheel Scripts

Postby Hyphen- » Wed Jun 02, 2021 5:26 pm

update on authentication causing disconnects: I have the Bluetooth module for the T2 and if you have a controller paired to T2 if you just hit the ps4 button it connects the ps4 controller and you can set it in a charger and leave it alone to stop the 10 minute authentication disconnects with the G29 plugged into A.

By the way the Bluetooth module for the T2 is like gold it has worked really well IMO

Racing Game was a new experience and I could not resist trying to drive all these nice cars at over 150+ miles an hour. Austin Martin, Porsche, a Bugatti? .... in real life I have a V-Rod muscle motorcycle the engine was a collaboration with Porsche and an American bike maker it is dyna-tuned and goes really fast so I would not play a game if it did not give an authentic experience capturing that anyways... It is a nice game.

Since the T2 works well now it would be nice if there was something that could give you adjustments to the braking on the G29. I am going to put a homemade extender inside the spring on the mechanical brake (there is a YouTube for that ) as a mechanical work around to shorten brake press which has worked to fix getting the brake a little more just right.

But T2 has the interface to help with that ... if anyone can help or at least comment it keeps the t2 relevant...
User avatar
Hyphen-
Sergeant Major
Sergeant Major
 
Posts: 76
Joined: Sat Dec 01, 2018 6:30 am

Re: Racing Wheel Scripts

Postby Scachi » Wed Jun 02, 2021 10:15 pm

Something like that ?
Code: Select all
 
#define BRAKE BUTTON_8
 
#define brakeMin 60.0 // minimum value to output
#define brakeMax 80.0 // maximum value to output
#define sensitivity 2.0 // scale input to shorten required press
 
// min 60.0 and max 80.0 will rescale output from range 0..100 to the range 60..80
// min 60.0 and max 60.0 will always output 60.0 when you pull the brake trigger
// sens 2.0 will result in full output at half press of brake
 
fix32 breakIn, breakOut;
 
main {
    breakIn=get_actual(BRAKE);
    if (breakIn) {
        breakOut = (  ( (brakeMin - brakeMax) * (100.0 - breakIn * sensitivity) )  / (100.0 - 0.0)  ) + brakeMax;
        set_val(BRAKE, clamp(breakOut, brakeMin, brakeMax));
    }
}
 
User avatar
Scachi
Brigadier General
Brigadier General
 
Posts: 3044
Joined: Wed May 11, 2016 6:25 am
Location: Germany

Re: Racing Wheel Scripts

Postby Hyphen- » Thu Jun 03, 2021 2:50 am

I am speechless... fortunately I am only typing. So awesome for you to do that... very elegant thanks definitely booting up the game as i type... let's try it be fun.. be safe!
User avatar
Hyphen-
Sergeant Major
Sergeant Major
 
Posts: 76
Joined: Sat Dec 01, 2018 6:30 am

Re: Racing Wheel Scripts

Postby Hyphen- » Thu Jun 03, 2021 5:29 am

Works absolutely perfect... I added the obvious and adapted it for GAS and this works so well too. Changing the acceleration sensitivity added the ability to smooth out the gears and it is so sensitive this is pretty fantastic... it works well. :smile0517:


Code: Select all
#pragma METAINFO("Gran Turismo Sports", 1, 4, "GAS and Brakes by Scachi")
#define BRAKE BUTTON_8
 
#define brakeMin 60.0 // minimum value to output
#define brakeMax 80.0 // maximum value to output
#define sensitivity 2.0 // scale input to shorten required press
 
// min 60.0 and max 80.0 will rescale output from range 0..100 to the range 60..80
// min 60.0 and max 60.0 will always output 60.0 when you pull the brake trigger
// sens 2.0 will result in full output at half press of brake
 
fix32 breakIn, breakOut;
 
main {
    breakIn=get_actual(BRAKE);
    if (breakIn) {
        breakOut = (  ( (brakeMin - brakeMax) * (100.0 - breakIn * sensitivity) )  / (100.0 - 0.0)  ) + brakeMax;
        set_val(BRAKE, clamp(breakOut, brakeMin, brakeMax));
    }
}
 
#define GAS BUTTON_5
 
#define gasMin x.0 // minimum value to output
#define gasMax 100.0 // maximum value to output
#define sensitivity 2.0 // scale input to shorten required press
 
// min x.0 and max 100.0 will rescale output from range 0..100 to the range x..100
// min x.0 and max x.0 will always output x.0 when you pull the Gas trigger
// sens 2.0 will result in full output at half press of Gas
 
fix32 gasIn, gasOut;
 
main {
    gasIn=get_actual(GAS);
    if (gasIn) {
        gasOut = (  ( (gasMin - gasMax) * (100.0 - gasIn * sensitivity) )  / (100.0 - 0.0)  ) + gasMax;
        set_val(GAS, clamp(gasOut, gasMin, gasMax));
        }
    }
User avatar
Hyphen-
Sergeant Major
Sergeant Major
 
Posts: 76
Joined: Sat Dec 01, 2018 6:30 am

Re: Racing Wheel Scripts

Postby Scachi » Thu Jun 03, 2021 8:54 am

less code (uploaded to the Online Resource too):
Code: Select all
#pragma METAINFO("Gran Turismo Sports - Gas and Brake mod", 1, 5, "Scachi")
 
/* example:
    brakeMin 60.0 and brakeMax 80.0 will rescale input from range 0..100 to the range 60..80
    brakeMin 60.0 and brakeMax 60.0 will always output 60.0 when you pull the brake trigger
    brakeScale 2.0 will result in full output at half press of brake
*/

 
#define BRAKE BUTTON_8
#define brakeMin 60.0   // minimum value to output
#define brakeMax 100.0  // maximum value to output
#define brakeScale 2.0  // scale input to shorten required press
 
#define GAS BUTTON_5
#define gasMin 0.0      // minimum value to output
#define gasMax 100.0    // maximum value to output
#define gasScale 2.0    // scale input to shorten required press
 
main {
    // brake : btn,deadzone,  inMin,inMax,  outMin,outMax,  scale
    fRescale(BRAKE,0.0, 0.0,100.0,  brakeMin,brakeMax,  brakeScale);
 
    // gas : btn,deadzone,  inMin,inMax,  outMin,outMax,  scale
    fRescale(GAS,0.0, 0.0,100.0,  gasMin,gasMax,  gasScale);
 
}
 
void fRescale(uint8 io, fix32 dz, fix32 inMin, fix32 inMax, fix32 outMin, fix32 outMax, fix32 scale) {
    /*^* information , unfold to read
    // io: gpc input designator
    // dz: deadzone , input value above dz is required for any output to appear
    // inMin: minimum input value your input device is able to create
    // inMax: maximum input value your input device is able to send
    // outMin: minimum output value you want to get
    // outMax: maximum output value you want to get
    // scale: change the sensitivity
    */

    fix32 in, out;
 
    in=get_actual(io);
    if (abs(in) > dz) {
        out = (  ( (outMin - outMax) * (inMax - in * scale) )  / (inMax - inMin)  ) + outMax;
        set_val(io, clamp(out, outMin, outMax));
    }
}
 
User avatar
Scachi
Brigadier General
Brigadier General
 
Posts: 3044
Joined: Wed May 11, 2016 6:25 am
Location: Germany

Re: Racing Wheel Scripts

Postby Hyphen- » Thu Jun 03, 2021 10:49 pm

Yes I was backward engineering that one... very clean I will be having some fun with that... all good fun. :joia: imagine a steering wheel between those thumbs...
User avatar
Hyphen-
Sergeant Major
Sergeant Major
 
Posts: 76
Joined: Sat Dec 01, 2018 6:30 am

Re: Racing Wheel Scripts

Postby teddy18 » Tue Apr 05, 2022 10:54 pm

How i can fix If my wheal dont get 100

Probleme my wheal get 100 Prozent only If i turn wheal left right Turn dont get 100
User avatar
teddy18
Lieutenant
Lieutenant
 
Posts: 346
Joined: Sun Jul 19, 2015 4:18 pm


Return to GPC2 Script Programming

Who is online

Users browsing this forum: AZOV_ops and 126 guests