Road and Dust

C_ArtsC_Arts Posts: 10Member

About


"Road and Dust" isn't the game's name, maybe a nickname / sub-name.

An arcade race game, planning to finish (a playable version) at the end of next month.

Features:

  • M/A transmission

To do:

  • Everything else haha
    UI, AI, tracks, cars, implement single/multi player, time attack, ...

The overall look should be similar to the late 90's games.

"Q/A"


I saw some other topics here about racing games and I think I could help, sharing my settings so others can achieve similar results. Probably a good way to learn something new too!

And I'm using blender :)

Thanks.



Tags :

Comments

  • cyberealitycybereality Posts: 926Moderator

    Physics are looking pretty good.

  • eyeEmotioneyeEmotion Posts: 83Member

    Nice!! What type of races is it going to have?
    What are you using to get those drifts? Is this using the VehicleBody?

    How do you do the engine sound? I still haven't find anything on that, just someone mentioning trying to do it with the Audio-busses and PitchShifter.

    Nice to see some other racing projects, because their isn't much resources in regards to (3D) racing games in Godot, so it is nice to have some people to bounce some knowledge and experiences of.

  • SaitodepaulaSaitodepaula Posts: 49Member

    Looking good! Keep us updated!

  • C_ArtsC_Arts Posts: 10Member

    @eyeEmotion

    Thanks. That's true, I spent a lot of time setting it up and the best guide I could found was the docs: Godot's Vehicle Wheel - Doc

    Nice!! What type of races is it going to have?

    First a street race, with several AI against you, with traffic and some cops. (AKA Need for Speed with low budget.)

    What are you using to get those drifts? Is this using the VehicleBody?

    Only VehicleBody. (I'll share my settings soon.)

    How do you do the engine sound? I still haven't find anything on that, just someone mentioning trying to do it with the Audio-busses and PitchShifter.

    I found this software (very usefull EngineSound - GitHub), saved two samples at different RPMs and they are mixed up in the game, changing pitch_scale andunit_db. In the future I will try to record real engine sounds but for now it's much easier with a synth.

  • C_ArtsC_Arts Posts: 10Member
    edited May 15

    These are my vehicle settings, but:

    First things first. Read this page, the Godot's default values are not good to make a car feel like a car:


    Current, my goal is to achieve an arcade style, with a slight drift, based on the physics of VehicleBody. These are my personal experienced-based settings.

    Recommend testing each configuration individually.

    My 3D models are at "real" scale: 1 blender unit as 1 meter.


    The Car

    The car's body and wheels are placed slightly below the floor, this helped me to balance the roll of the car. (Kinda "It changes the center of the mass"? Not sure what is going on exactly.)

    Mass: Between 1000 and 2000, in kg, like real cars
    Engine Force: uses a sin() function to control the force, varying between 500 and 12 500


    Collider

    The car's collider is just touching the upper part of the spring. A CapsuleShape can roll the car back into the correct position again, if it's upside down.


    The VehicleWheel

    Roll Influence & Friction Slip: tweak them together
    Value of 3 is working for an arcade style, values between 0.8 and 1.0 are more real-life.
    Setting value of 2.9 or 2.8 in the rear wheels produce more drifter car, but I think, games like Split Second, uses physics of a ball, but the downside, if you want the car bouncing, you need to code it.

    Rest Length & Travel: just Travel >= Rest Length

    Stiffness: 25 is too soft and 100 too hard, prefer values between 35 and 50.

  • SaitodepaulaSaitodepaula Posts: 49Member
    edited May 17

    Engine Force: uses a sin() function to control the force, varying between 500 and 12 500

    The sin function is to make something like traction control? In other words, to not have max RPM since the first moment you hit the accelerate key?

  • MegalomaniakMegalomaniak Posts: 2,773Admin

    a sine wave is a cyclic thing, cycling from 0 to 1 to 0 to -1 to 0 again.

    https://thesoftwaresimpleton.com/animated-sinewave-f12565eb6d460980214a51b713905917.gif

    You can feed a value to the function as input, it will basically be interpreted as time, per the gif above.

  • C_ArtsC_Arts Posts: 10Member

    It also can be used to simulate a Torque x RPM graph:

    Values between sin(0.05*PI) and sin(PI) are similar to the graph above.
    If engine_force receives a sine function, the maximum speed will come naturally.

  • SaitodepaulaSaitodepaula Posts: 49Member
    edited May 17

    Thanks @Megalomaniak and @C_Arts for the explanations.

    I'm using 6DOF joints in my game. So far, my understanding is that I'm setting RPM (ANGULAR MOTOR TARGET VELOCITY) and Torque (ANGULAR MOTOR FORCE LIMIT) directly . But if I do not code it to behave like a real engine, the wheel will have max RPM from the moment I hit the accelerate key.

    It's good the know about other approaches.

  • eyeEmotioneyeEmotion Posts: 83Member
    edited May 21

    I still don't get how the Torque (engine_force?) at some point maxes out the speed. My programming is currently done with "dummy" proofing. I was never keen on the whole maths and physics things, although I do understand most of it with the right visual learning materials.
    So if I understand correctly, you are just using the radius on a single axis of what @Megalomaniak circle graph shows?

    I just have an if (fwd_mps < max_speed): give value to engine_force , else: engine_force = 0. And to counteract the problems of low speeds on uphills, I'm lerping it: if (fwd_mpsf < max_speed): engine_force = lerp(max_torque, engine_force_value, speed_scale), where max_torque is just the engine_force_value (being an export value) multiplied by 2.
    So currently from 900 to 450.

    These are the settings of my VehicleBody:

    (inertia isn't used at the moment, it's still "leftover-code" I used when I wasn't able to get interactable collisions to work)
    While uploading this image, I noticed that some of my values on this node are different from the same properties inside the node. So which one does it follow actually?
    On the node (image), I have a weight of 1300, yet when I go inside this node, I have a value of 1000.
    Also for the Can Sleep, on the node, it isn't checked, but inside the node, it is checked.

    And these are my VehicleWheel settings:

    So my Friction Slip was first at default value: 10.5, with the rear wheels slightly offset as recommended to get a drift. But that gives unwanted results. Even values below 3 don't give any satisfying results. So with your recommendation around 3, I got it to work. I used 3.5 for now with the rear slightly offset.
    It works, kinda, but still not how I want/need it to. But it's a tiny step forward atleast.
    Since my game in some ways relies on drifts and drafts, I'll probably have to try different approaches. I need more control of the drift (unless I want them to not have full control over it, like near an explosion) and I also need to be able to track such things, to build up a meter that you can use to trigger stuff or to boost.

    For the collider/collision of my car, I just brought the collisionshape (just a box) down a bit, to the floor actually. It apparently also helps to keep the car stiff and not so bouncy. I tried bringing the car down "the floor" like you did, but then I would get a slightly wobbly car again.

    It's nice to see a few other 3d racers over here, so that I'm not feeling completely lost :# :)

  • C_ArtsC_Arts Posts: 10Member
    edited May 22

    @eyeEmotion
    I still don't get how the Torque (engine_force?)
    I just have an if (fwd_mps < max_speed): give value to engine_force , else: engine_force = 0.

    My engine_force function (just a brief):

    func _physics_process(delta):
        if Input.is_action_pressed("g_throttle"):
            calc_engine_force = remapValue(current_speed, min_speed, max_speed, 0.05*PI, 1.1*PI)
            # result a value between 0.05*PI and 1.1*PI
    
            engine_force = sin(calc_engine_force) * maxEngine_force
            #sine of the result, multiply and apply the result
    
            brake = 0.0
    
    #remap function with clamped min and max values
    func remapValue( inputParam:float,
        inputMin:float, inputMax:float,
        outputMin:float, outputMax:float)-> float:
            var result : float = outputMin+(inputParam-inputMin)*(outputMax-outputMin)/(inputMax-inputMin)
            if result > outputMax: result = outputMax
            elif result < outputMin: result = outputMin
            return result
    

    While uploading this image, I noticed that some of my values on this node are different from the same properties inside the node. So which one does it follow actually?

    I didn't fully comprehend. Where is "inside the node"? If you are setting a value inside the script, this value will be override.

    For the collider/collision of my car, I just brought the collisionshape (just a box) down a bit, to the floor actually. It apparently also helps to keep the car stiff and not so bouncy. I tried bringing the car down "the floor" like you did, but then I would get a slightly wobbly car again.

    Try values above of 2 in VehicleWheel -> Damping, both Compression and Relaxation and try with raised CollisionShape. This will make the car more stiff. Lowering the collisionshape makes unwanted collisions with the floor.


    edit:

    Also I'm using the remapValue function to control the steering. Higher the speed, lower the steering angle.

    if Input.is_action_pressed("g_left"):
            var steer : float = remapValue(abs(speed), 170.0, 0.0, 2.0, 25.0)
            steering = lerp(steering, deg2rad(steer), 0.08)
    

    edit2:

    If you change the settings of the node/scene VehicleBody, and this is a child of an another node/scene (e.g.: Spatial), the settings in the Spatial scene will override the original settings.

  • ZireaelZireael Posts: 91Member

    I would have to check the values in my own racer, but off the cuff:
    a) I use smaller steering for bigger speed (see above)
    b) I think my friction slip is somewhere around 1 or maybe 2 (this is what the docs recommend, not because it's the best, but because it is a realistic value)
    c) my rest length and suspension values are bigger, probably too big for a city car :P
    d) the sin() trick for engine force is really neat!

    Also IIRC there's a Godot drift game on Github, you could check it out. I can't help out more because I don't do drifting in my game :P

  • C_ArtsC_Arts Posts: 10Member

    Just keeping updated:

    • added a "block-track"
    • added a simple menu
    • experimenting a car with the physics of a ball
    • some fxs

    I noticed that I've been using very high values for the mass, thanks for the screenshots @eyeEmotion

Sign In or Register to comment.