Last active
November 9, 2022 20:54
-
-
Save GeekyDeaks/d2a5e680931b24213b584bf8aae29343 to your computer and use it in GitHub Desktop.
AMS2 FFB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
########################################################### | |
########################################################### | |
# NAME: basic | |
# | |
# this file gives you raw & unaltered force as integrated by physics engine | |
# acting on steering rack of the vehicle physical model | |
# Summing these two valuee effectievly gives you rackforce. | |
# | |
########################################################### | |
###arm_force -- equivialent of "max force at steering rack" in ams1 | |
###lockstop, overall strangth, stiffness, damping | |
(custom_lock_stop 1.0) | |
#sum fl_steering & fr_steering matrix values here | |
#(arm_force ( + FL_tierod FR_tierod)) | |
#above left and right rack are axial forces in tierods. To project them to rack, multiply by respective left right below "rack proj" | |
#FL_rack_proj | |
#FR_rack_proj | |
#arm force is that same thing, already done in game. If left / right need manipulation, exposed them "un projected" here. | |
#(rack_force ( + ( * FL_tierod FL_rack_proj ) ( * FR_tierod FR_rack_proj))) | |
# rack_force = FL_rack_left * FL_rack_proj + FR_rack_righ * FR_rack_proj | |
########################################################### | |
# | |
# | |
#Some constants | |
# | |
##general multipliers (from ams1) | |
(max_overall_force 11500.0) | |
(recip_force ( / 1.0 max_overall_force)) | |
(mass_damper ( * M_smooth_samples 3.0)) | |
(arm_force_smooth ( spring arm_force 200000 0.2 mass_damper)) | |
(arm_force (if M_smooth_samples arm_force_smooth arm_force)) | |
#mfasr scaler | |
(rack_scaled ( * arm_force ( / max_overall_force M_max_force_at_rack))) | |
(rack_scaled ( * rack_scaled recip_force)) | |
(rack rack_scaled) | |
########################################################### | |
##################################################### | |
##################################################### | |
#PARKING LOT FORCE :) | |
(parkingForce (* parkingForceMult rack)) | |
(parkingForce (* parkingForce (crossover et 0.0 5.0))) | |
(parkingForce (* parkingForce (- 1.0 (crossover vel_mag 0.0 7.0)))) | |
(rack (* rack (crossover vel_mag 0.0 5.0))) | |
(rack (+ rack parkingForce)) | |
(output rack) | |
# Scaler as informational only, doesnt affect output - | |
(scale_window_init 10.0) | |
(scale_window_nominal 2.0) | |
(scale_soft_clear_t 10.0) | |
(scale_min 0.2) | |
(scale_max 2.0) | |
(scale_blend_t 2.0) | |
(signal_scale output | |
1.0 1.0 1.0 1.0 1.0 | |
0.0 | |
0.0 0.0) | |
###################################################### | |
###################################################### | |
##(LOW FORCE BOOST) | |
################ | |
(output ( lfb output 0.15)) | |
###################################################### | |
###################################################### | |
#################################################### | |
#################################################### | |
(doom_check output) | |
#allow 30% headroom | |
(headroom ( - 0.7 gain)) | |
(clipTo ( + 1.3 headroom)) | |
(clipTo ( if headroom 1.3 clipTo)) | |
(output (hard_clip output clipTo)) | |
(output (* output gain)) | |
#third info container used for output (before lockstops, after clipping and gain) | |
(info3 (smooth output 0.7)) | |
#lock stops. not advised to edit stiffness or espcially damping | |
##decrease lockstop stiffness when standstill | |
(park_lockStop ( + 0.5 ( * 0.5 (crossover vel_mag 0.0 3.0)))) | |
(stiffness 3.0) | |
(damping 5.0) | |
#adjust stifness based on overall ffb gain from game. | |
(gain_scale ( - 1.3 gain)) | |
#adjust stiffness and damping separate, based on vehicle steer ratio (1:10 taken as "nominal" ratio, downscale below, above leave intact) | |
(ratio_scale ( / steer_ratio 10.0)) | |
(ratio_scale ( min ratio_scale 1.0)) | |
(stiffness ( * stiffness 0.5 ratio_scale)) | |
(damping ( * damping ratio_scale)) | |
(custom_lock_stop ( * park_lockStop custom_lock_stop gain_scale)) | |
(stops (bumpstop output 0.1 stiffness 0.14 damping)) | |
(output (+ output (* stops custom_lock_stop ))) | |
(histogram output) | |
#third info container used for output (before lockstops) | |
(info3 (smooth output 0.7)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Original file by Niklas Silen - Optimized by Rantam for Thrustmaster T300 - Last update March 6th 2018 | |
# INSTRUCTIONS (how to use the custom FFB system) | |
################################################# | |
# Copy ffb_custom_settings.txt to My Documents\Project CARS 2 directory, replacing the existing file, then select CUSTOM FFB flavour from within the game | |
# | |
#General form of code | |
#(A B ....) | |
#If A is known function name, then that function is done, with B ... as the arguments. If an argument is itself in (), then that is resolved first. | |
#If A is not a function name, it is taken as a variable name, and is assigned B, and ... is ignored. | |
#So | |
#(output (relative output 1.0 0.5 2.0)) | |
#becomes in effect something like in C ish form: | |
#output = relative(output, 1.0, 0.5, 2.0); | |
# | |
# List of commands: | |
################### | |
#Variables ... | |
#Output ... | |
#* output -- the FFB applied to the wheel | |
##### | |
#Time ... | |
#* dt -- timestep | |
#* et -- elapsed time | |
######### | |
#Steering ... | |
#* steering_vel | |
#* steering_pos | |
################ | |
#Player Controls ... | |
#* volume | |
#* tone | |
#* fx | |
######### | |
#Steering ... | |
#* steering_approx | |
#* steering_angle_FL | |
#* steering_angle_FR | |
#Useful for centering spring type effects. | |
############ | |
#Rack Forces ... | |
#(FL, FR, RL, RR) | |
#* FL_Fx | |
#* FL_Fy | |
#* FL_Fz | |
#* FL_Mx | |
#* FL_My | |
#* FL_Mz | |
#These forces are the components of forces at the tires as felt through the rack. Simply add them all together to get the full rack force. | |
#Note that Mx and My are near zero, and do not contribute much at all, so adding Fx, Fy, Fz, and Mz is adequate. | |
##################### | |
#Full Forces at Tires ... | |
#(FL, FR, RL, RR) | |
#* FL_lat | |
#* FL_long | |
#* FL_load | |
#Unlike the above these are the raw full forces at the tires, not mechanically filtering through steering geometry and linkages. | |
###### | |
#(FL, FR) | |
#FL_patch_fx | |
#FL_patch_fy | |
#FL_patch_fz | |
#FL_patch_mz | |
#These are direct forces from the contact patch of the tyre | |
###### | |
#Grips ... | |
#(FL, FR) | |
#* FL_def | |
#* FL_adh | |
#* FL_tack | |
#* FL_stab | |
#* FL_visc | |
#* FL_tear | |
#The ratios of full grip (forces) due to each grip type in the model. They will all sum to 1.0 at any given timestep. | |
####### | |
#Rubber ... | |
#(FL, FR) | |
#* FL_slide -- 0 to 1 for how much the contact patch is in slide | |
#* FL_stretch | |
######## | |
#Relates to Functions ... | |
#Linkage ... | |
#* arm_angle -- Linkage uses this value as the spindle arm angle | |
###### | |
#Split ... | |
#* split_lo -- split's output: low component | |
#* split_md -- split's output: medium component | |
#* split_hi -- split's output: high component | |
####### | |
#Smooth ... | |
#* smooth_lo -- smoothed signal (same as return value) | |
#* smooth_hi -- the remainder (input - smoothed) | |
######### | |
#Histogram ... | |
#* hist_L -- histogram's L value; F1 widget uses this | |
#* hist_ML -- histogram's ML value; F1 widget uses this | |
#* hist_M -- histogram's M value; F1 widget uses this | |
#* hist_MH -- histogram's MH value; F1 widget uses this | |
#* hist_H -- histogram's H value; F1 widget uses this | |
#* hist_clip -- histogram's clip value; F1 widget uses this | |
########### | |
#SignalScale ... | |
#* scale_window_init -- first time time window before adjusting | |
#* scale_window_nominal -- subsequent windows | |
#* scale_soft_clear_t -- reference time for fading out learning info | |
#* scale_blend_t -- reference time for blending in new scale | |
#* scale_min -- minimum scale | |
#* scale_max -- maximum scale | |
################## | |
#Function Reference ... | |
# | |
#Absolute Value ... | |
#(abs <input>) | |
# | |
#Add ... | |
#(+ <input> ...) | |
#Add all of the inputs. | |
# | |
#AntiDrag #As far as I know this parameter only needs to be used with some Fanatec wheels | |
#(anti_drag <input> <Cd> <Cf> <refvel>) | |
#* Cd -- anti drag coeefficent, function of wheel position velocity | |
#* Cf -- anti drag friction, constant resistence, tapered to zero via: | |
#* refvel -- wheel velocity below which to taper to zero. | |
# | |
#Drag ... | |
#(drag <input> <Cd> <Cq>) | |
#* Cd -- drag coeefficent, function of wheel position velocity | |
#* Cq -- drag coeefficent, function of wheel position velocity squared | |
# | |
#Blend ... | |
#(blend <bias> <input for one> <input for zero>) | |
# | |
#Center ... | |
#(ctr <input>) | |
#Convert input assumed to be between from 0.0 to 1.0, to -1.0 to 1.0. | |
# | |
#Divide ... | |
#(/ <first input> <input> ...) | |
#Divide inputs from first input. | |
# | |
#Down ... | |
#(dn <input>) | |
#Convert input such that: | |
#* 0 - 0.5 : 0.0 | |
#* 0.5 - 1.0 : 0.0 - 1.0 | |
# | |
#Hard Clipper ... | |
#(hard_clip <input> <cap>) | |
# | |
#Histogram ... | |
#(histogram <input>) | |
# | |
#If ... | |
#(if <cond> <true> <false>) | |
# | |
#Linkage ... | |
#(linkage <mode> <angle>) | |
# | |
#Maximum ... | |
#(max <args ...>) | |
# | |
#Minimum ... | |
#(min <args ...>) | |
# | |
#Multiply ... | |
#(* <args ...>) | |
# | |
#Power ... | |
#(power <input> <power>) | |
# | |
#RelativeGain ... | |
#(relative <gain> <bleed> <clamp>) | |
# example: (output (relative output 1.12 0.45 1.0)) # Relative Output as PCars 1: Gain, Bleed and Clamp values are set here | |
# | |
#Safety ... | |
#(safety <input> <limit>) | |
# | |
#Scoop ... | |
#(scoop <input> <knee> <reduction>) | |
# | |
#SignalScale ... | |
#(signal_scale <input> | |
#<L weight> <ML weight> <M weight> <MH weight> <H weight> | |
#<clipping weight> | |
#<equalize blend> <boost blend>) | |
# | |
#Smooth ... | |
#(smooth <input> <ref time>) | |
# | |
#Soft Clipper ... | |
#(soft_clip <half in> <unity>) | |
# | |
#Split ... | |
#(split <lo scale> <md scale> <hi scale> <lo/md ref time> <md/hi ref time>) | |
# | |
#Spring ... | |
#(spring <force> <stiffness> <damping>) | |
# | |
#Subtract ... | |
#(- <first input> <input> ... ) | |
#Subtract inputs from first input. | |
# | |
#Tighten Center ... | |
#(tighten <input> <range> <falloff>) | |
# example: (output (tighten output 0.08 0.030)) # Deadzone Removal as PCars 1: Deadzone and falloff values are set here | |
#Up ... | |
#(up <input>) | |
#Convert input such that: | |
#* 0 - 0.5 : 1.0 - 0.0 | |
#* 0.5 - 1.0 : 0.0 | |
# | |
# Lock Stops ----------------------------------------- | |
# (stops (bumpstop output 0.1 1.0 0.1 0.0)) # Bumpstops parameters: stiffness buffer, stifness, drag threshold and drag. Thresholds are how far back from bumpstops you start blending in some stiffness and drag....basically you cannot be as stiff as a real stop, because it'll get violent...because unlike a real lock stop, there is latency. | |
# (output (+ output (* stops device_lock_stop))) | |
# | |
###################################################### | |
# END OF INSTRUCTIONS | |
###################################################### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
###################################################### | |
# NAME: Heavy Messing Minimal (NuScorpii V2.5) | |
# Thanks to Karsten Hvidberg for the concept of splitting the rack force | |
(min_force 0.01) | |
# Scaling settings ---------------------------------------- | |
# Rack - amplification of rack forces | |
(detail_lfb 0.7) | |
(rack_gamma 1.7) | |
(tightness 0.6) | |
# FX - generated effects (affected by FX slider) | |
(gyro_scale 1.0) | |
(engine_scale_slow 0.6) | |
(engine_scale_fast 0.03) | |
# Modify tightness using min force | |
(tightness (- tightness (* min_force 3))) | |
(tightness (min 3.0 (max 0.15 tightness))) | |
# Reiza variables ----------------------------------------- | |
(lever_mode 0) | |
(smooth_level 0) | |
(max_change 1.0) | |
(scrub_rack 1.0) | |
(scrub_rear 0.0) | |
(scrub_vibe 0.0) | |
(scrub_scale 0.0) | |
(rack_damping_scale 0.0) | |
# Reiza code ---------------------------------------------- | |
# general multipliers (from ams1) | |
(max_overall_force 11500.0) | |
(recip_force ( / 1.0 max_overall_force)) | |
#mfasr scaler | |
(rack_scaled ( * arm_force ( / max_overall_force M_max_force_at_rack))) | |
(rack_scaled ( * rack_scaled recip_force)) | |
(rack rack_scaled) | |
(rack_smooth (smooth rack M_force_smoothing)) | |
(rack (if M_force_smoothing rack_smooth rack)) | |
# PARKING LOT FORCE :) | |
(parkingForce (* parkingForceMult rack)) | |
(parkingForce (* parkingForce (crossover et 0.0 5.0))) | |
(parkingForce (* parkingForce (- 1.0 (crossover vel_mag 0.0 7.0)))) | |
(rack (* rack (crossover vel_mag 0.0 5.0))) | |
(rack (+ rack parkingForce)) | |
# Engine | |
(max_rps 8000.0) | |
(rps_scale ( / crankshaft max_rps)) | |
(rps_scale ( power rps_scale 0.8)) | |
(rps_scale (min rps_scale 0.02)) | |
(rps_scale (max rps_scale 0.14)) | |
(load_mult (+ 0.8 throttle)) | |
(load_mult (max load_mult 1.0)) | |
(engine_scale (blend (min 1.0 (/ vel_mag 50.0)) engine_scale_slow engine_scale_fast)) | |
(engine_vibe (sin crankPos)) | |
(engine_vibe ( * load_mult engine_vibe rps_scale engine_scale)) | |
(feel engine_vibe) | |
#(scrub_vibe ( * scrub_rack fx)) | |
# Pseudo Gyro forces -------------------------------------- | |
(ratio_scale ( / 10.0 (max 10 steer_ratio))) | |
(ac (power (min 1.0 (/ vel_mag 100)) 0.8)) | |
(mx (blend (max 0.0 (- (/ vel_mag 77) 0.3)) 0.0 ac)) | |
(ms (power (* 0.1 (smooth steering_vel 0.05)) 1.0)) | |
(pseudo_gyro_force (* 20.0 ms mx ratio_scale fx gyro_scale)) | |
# Rack ---------------------------------------------------- | |
# Split out detail levels | |
(rack_fine_detail (- rack (smooth rack 0.02))) | |
(rack_coarse_detail (- rack rack_fine_detail)) | |
# Apply lfb to fine details | |
(rack_fine_detail (lfb rack_fine_detail detail_lfb)) | |
# Apply LFB to coarse details | |
(rack_coarse_lfb (lfb rack_coarse_detail 0.15)) | |
# Apply centre enhancement to coarse details | |
(blend_factor (power (* 2.0 (- (/ 1.0 (+ 1.0 (power 2.718 (* (* -100.0 tightness) rack_coarse_detail)))) 0.5)) 9.0)) | |
(rack_coarse_lfb (blend (abs blend_factor) rack_coarse_detail (power rack_coarse_lfb (/ 1.0 rack_gamma)))) | |
# Limit coarse details to leave room for fine details | |
(sg_g (max 0.2 gain)) | |
(sg_p (/ 0.75 sg_g)) | |
(sg_s (/ 0.5 sg_g)) | |
(sg_f (+ (/ sg_s (+ 1.0 (power 2.718 (* -1.0 (* (/ 4 sg_s) (- rack_coarse_lfb sg_p)))))) (- sg_p (/ sg_s 2.0)) )) | |
(rack_coarse_lfb (if (max 0.0 (- rack_coarse_lfb sg_p)) sg_f rack_coarse_lfb)) | |
(sg_f (+ (/ sg_s (+ 1.0 (power 2.718 (* -1.0 (* (/ 4 sg_s) (- (* -1.0 rack_coarse_lfb) sg_p)))))) (- sg_p (/ sg_s 2.0)) )) | |
(rack_coarse_lfb (if (min 0.0 (+ rack_coarse_lfb sg_p)) (* -1.0 sg_f) (rack_coarse_lfb))) | |
# Combine coarse and fine and details | |
(rack (+ rack_coarse_lfb rack_fine_detail)) | |
# Construct Output ---------------------------------------- | |
# Smooth rack at standstill / very low speeds | |
(slow_rack (drag rack 0.0001 0.0)) | |
(slow_rack (smooth slow_rack 0.1)) | |
(ms (* 0.25 (smooth steering_vel 0.005))) | |
(speed_bias (max 0.1 (min 1.0 (/ vel_mag 3.0)))) | |
(rack (blend speed_bias (+ slow_rack ms) rack)) | |
# Rack damping | |
(rack (+ rack pseudo_gyro_force)) | |
# Combine rack and FX forces | |
(output ( + rack ( * feel fx 0.8))) | |
# Scaler for info, no affect on output -------------------- | |
(scale_window_init 10.0) | |
(scale_window_nominal 2.0) | |
(scale_soft_clear_t 10.0) | |
(scale_min 0.2) | |
(scale_max 2.0) | |
(scale_blend_t 2.0) | |
(signal_scale output | |
1.0 1.0 1.0 1.0 1.0 | |
0.0 | |
0.0 0.0) | |
# Nonlinear Clipping -------------------------------------- | |
(output (* output gain)) | |
(sg_p 0.75) | |
(sg_s 0.5) | |
(sg_f (+ (/ sg_s (+ 1.0 (power 2.718 (* -1.0 (* (/ 4 sg_s) (- output sg_p)))))) (- sg_p (/ sg_s 2.0)) )) | |
(output (if (max 0.0 (- output sg_p)) sg_f output)) | |
(sg_f (+ (/ sg_s (+ 1.0 (power 2.718 (* -1.0 (* (/ 4 sg_s) (- (* -1.0 output) sg_p)))))) (- sg_p (/ sg_s 2.0)) )) | |
(output (if (min 0.0 (+ output sg_p)) (* -1.0 sg_f) (output))) | |
# Lock stops ---------------------------------------------- | |
(custom_lock_stop 2.0) | |
(stops (bumpstop output 0.15 0.5 0.15 1.0)) | |
(output (+ output (* stops custom_lock_stop))) | |
# Statistics output --------------------------------------- | |
(histogram (* output 1.01)) | |
(info2 output) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment