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: 1,664Moderator

    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: 78Member

    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 2020

    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: 78Member
    edited May 2020

    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: 3,826Admin

    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: 78Member
    edited May 2020

    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 2020

    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 2020

    @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: 97Member

    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

  • NeronNeron Posts: 15Member

    @C_Arts said:
    @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.

    Hi! How do I use the enginesound to generate engine sound? I can't see any documentation on how to use the tool. How do I open this thing? How do I even use the sounds generated in my game?

  • SaitodepaulaSaitodepaula Posts: 78Member
    edited February 24

    Hi! How do I use the enginesound to generate engine sound? I can't see any documentation on how to use the tool. How do I open this thing? How do I even use the sounds generated in my game?

    Are you on Windows? Your first need to install Rust (the language used to make this sofware), and then compile the source code.

    To install Rust, I've used this source: https://estada.ch/2020/4/19/installing-rust-on-windows-10-native/

    After installing Rust, you have to use the command line, navigate to the directory where you have downloaded the EngineSound source code, and type cargo build (it's the command Rust uses to compile code).

    If you have any trouble, feel free to ask.

  • NeronNeron Posts: 15Member

    @Saitodepaula said:

    Hi! How do I use the enginesound to generate engine sound? I can't see any documentation on how to use the tool. How do I open this thing? How do I even use the sounds generated in my game?

    Are you on Windows? Your first need to install Rust (the language used to make this sofware), and then compile the source code.

    To install Rust, I've used this source: https://estada.ch/2020/4/19/installing-rust-on-windows-10-native/

    After installing Rust, you have to use the command line, navigate to the directory where you have downloaded the EngineSound source code, and type cargo build (it's the command Rust uses to compile code).

    If you have any trouble, feel free to ask.

    Thanks for responding! I did as you said, and everything compiled and finished. A folder named "targets" was generated and inside there there's an executable named "enginesound.exe". The problem is when I try to open this executable, it opens and closes very quickly. What did I miss?

  • SaitodepaulaSaitodepaula Posts: 78Member
    edited April 29

    Thanks for responding! I did as you said, and everything compiled and finished. A folder named "targets" was generated and inside there there's an executable named "enginesound.exe". The problem is when I try to open this executable, it opens and closes very quickly. What did I miss?

    I also had difficulty trying to run it, but I've made it typing this to run:

    enginesound.exe --44.100

    or

    enginesound.exe --sample-rate <44.100>

    I actually don't remember now...

    Take a look here: https://github.com/DasEtwas/enginesound/issues/7

    At the end of the process, I'm actually using vehicle sounds from this library:

    https://open.spotify.com/artist/6whPaMyAuGAKK63gAFDiFy?si=lMefVTJ5Sl-VofA8WnKhzw

  • NeronNeron Posts: 15Member

    @Saitodepaula said:

    Thanks for responding! I did as you said, and everything compiled and finished. A folder named "targets" was generated and inside there there's an executable named "enginesound.exe". The problem is when I try to open this executable, it opens and closes very quickly. What did I miss?

    I also had difficulty trying to run it, but I've made it typing this to run:

    enginesound.exe --44.100

    or

    enginesound.exe --sample-rate <44.100>

    I actually don't remember now...

    Take a look here: https://github.com/DasEtwas/enginesound/issues/7

    At the end of the process, I'm actually using vehicle sounds from this library:

    https://open.spotify.com/artist/6whPaMyAuGAKK63gAFDiFy?si=lMefVTJ5Sl-VofA8WnKhzw

    Where did you type "enginesound.exe --44.100" ?

  • SaitodepaulaSaitodepaula Posts: 78Member

    Where did you type "enginesound.exe --44.100" ?

    At the Windows command line. First, type the path/directory where the enginesound.exe is located, for example

    C:\Users\<your name>\Desktop\EngineSound> enginesound.exe --sample-rate <44.100>

    You have used the command line to compile and build with Rust right?

  • NeronNeron Posts: 15Member

    @Saitodepaula said:

    Where did you type "enginesound.exe --44.100" ?

    At the Windows command line. First, type the path/directory where the enginesound.exe is located, for example

    C:\Users\<your name>\Desktop\EngineSound> enginesound.exe --sample-rate <44.100>

    You have used the command line to compile and build with Rust right?

    Yeah, I used cmd to compile and build with Rust. This is what I get when I type "enginesound.exe --44.100"...

  • cyberealitycybereality Posts: 1,664Moderator
    edited May 1

    I think you forgot the sample rate flag. Look at the line @Saitodepaula posted again.

  • NeronNeron Posts: 15Member

    @cybereality said:
    I think you forgot the sample rate flag. Look at the line @Saitodepaula posted again.

    I get "The syntax of the command is incorrect" if add sample rate...

  • cyberealitycybereality Posts: 1,664Moderator
    edited May 1

    It looks like it's samplerate (one word).

    --samplerate
    

    I assume it's from this project. Maybe check this page?
    https://github.com/DasEtwas/enginesound/blob/master/README.md

  • cucoogamescucoogames Posts: 2Member

    Hi there! Sorry for being late to the party! B)

    I am also trying to go the vehicle body way for some kind of arcade racer and I am grateful for the setup tips above. They are really give some 1st kind of "feeling" - something to build and experience on.

    I ran into a problem though, for what I am unsure about the solution and I would like to ask if and how you tackled this issue: The main problem for me now is, that my car bumps and flies away on certain plane static body collision meshes. I am talking about gridmap generated trimeshes. I know there are several github issues about this topic and I also tried the smooth_trimesh_collision option with no success.

    Its maybe seems not be a general physics problem, rather it has something to do with myvehicle body and vehicle wheels setup, i.e. if I use more or less standard setups from vids and tuts it works fine, but feels not nice. If I try to "juice" the settings up for a better feeling (i.e. by using your given values above), it starts to bump/jump/clip.

    Has anyone of you experienced this with the vehicle body / wheel pairing?

  • WolfeWolfe Posts: 37Member

    @cucoogames -- It may not be an answer you're looking for, but the best solution I've found for avoiding "landmines" and snags on edges was to utilize SpringArm nodes for a custom raycast-style model. The only mines/snags I encounter in my project are when the main RigidBody makes contact with trimeshes...and in those instances, the hiccups/snags occur with some regularity. SpringArms just glide.

    I've written a guide on how I put things together, which includes links to resources you may find useful in any case. :)

    For an arcade racer, you could skip the tire models I describe in that link, and experiment with something more basic. That would also allow for a lower physics FPS; both of those tire models are better off at a minimum of 120FPS because of how the math works.

    Unfortunately I have no input on the VehicleBody or VehicleWheel. I abandoned 'em pretty quick. One of these days I would like to produce a suitable template or add-on based on my model. But I'm more of a sim-driver than a programmer, so I think I have more tidying up to do, lol.

  • cucoogamescucoogames Posts: 2Member

    Hi Wolfe, thanks for your reply! Yes, in the meantime I found, that I could avoid such "invisible wall" behavior with a positional change (on theY-Axis) of the VehicleBody. Its y-origin is now located below the VehicleWheels y-value which seemed to solve the problem for me.

    I know that many people ditch the VehicleBody/Wheel in order to implement their own solution. Either its too complicated to set up for arcade or it lacks the ability for a proper simulation =) Me too tried different arcade approaches (KinematicBody and Ball-model) but I found, that while easy to implement, they bring their own problems on the table when trying to go for a good arcade feel. So I found the Vehicle-nodes a good allrounder and as I said - the values given above in the threat make for a good start (in my opinion).

    In addition I am experimenting with curves to change i.e. the max steer angle in relation to the speed or the wheels slip value in relation to the duration of the pressed handbrake. At the end, there are many values to tweak which make it difficult to get it right all together as well - but for now its fun =)

    I am aware of your project, its pretty impressive. Together with Trackmaster and Loose Bolts (...and Truck Town :p ) probably the most advanced driving driving/racing projects in Godot.

    A bit OT: Do you plan to go multiplayer?

Sign In or Register to comment.