I’m making a new try at getting vehicle physics into the game. It started out as fixing the safe/top speed system and ended up being a kludgy physics simulation of vehicles. It was done about 9 months ago, but due to problems with SDL2 and cata running too slow to test I moved on to other stuff. Recently cata has gotten a huge speed boost and is super-responsive (wohoo! Also SDL works) so I want to implement this again.
Coolthulhu suggested I make a thread here. Not sure what to expect, I usually just hang on IRC. Kevin wanted me to split the changes up as much as possible, so the first PR just adds the physics stuff without doing anything with it. I’ll add on more commits gradually until everything’s in. The changelog from my previous attempt is:
Safe speed/top speed system removed, replaced with actual physics.
Status screen shows acceleration time 0-60mph or 0-100km/h instead of top speed.
Status screen shows current and best (fueled and fully repaired) values for some stats.
Top speed now depends on engine power, wheel grip (depends on surface), and air resistance.
Braking depends on wheel grip and surface and honors proper physics.
Don’t expect to stop anytime soon if you drive at 300mph over rubble.
Fumble chances, skidding, and skill gain systems updated.
You can drive safely at * 20 mph, any faster and you might fumble.
Grabbed vehicles reuse the same move code, and now sink in water/trigger traps the same way.
[quote=“vidarsk, post:1, topic:8465”]Top speed now depends on engine power, wheel grip (depends on surface), and air resistance.
Fumble chances, skidding, and skill gain systems updated.
You can drive safely at * 20 mph, any faster and you might fumble.
Grabbed vehicles reuse the same move code, and now sink in water/trigger traps the same way.[/quote]
Those sound the most interesting to me.
First because it could actually make offroading worse than driving on roads.
The other three because they add what is essentially missing features. Fumbling system is very simple right now and I always wanted a speed-dependent one. Grabbed vehicles are handled by code that breaks for vehicles larger than 2x2.
I love the vehicle system in CDDA, so it’s always exciting to see more work being done on it.
One thing I’m wondering; with these changes, will your typical 12 tonne steamroller/tank/monstrosity still go into a skid when you run over a small bush?
I want it to be more realistic. So if you’re driving at 200 mph then yes, that bush will probably cause you to spin like a washing machine working overtime, with no hope of stopping until you’re smeared across every tree in the vicinity.
If you’re driving at more sensible (boring) speeds you should be safe though.
if physics were correct, a steamroll should not skid at all and instead drive almost stubbornly im a straight line, stopped doing so only by fumbles, walls and damage to the front roll.
Correct, it would continue in a straight line. However I imagine at that speed it would have no grip at all and thus spin like crazy from the slightest impulse.
How about top speed being limited to 40% while going backwards? If a sportscar has a top speed of 200mph doesn’t mean that can hit the same speed in reverse.
Also, I may be wrong but as of now vehicles can trigger landmines when you drive on it, doesn’t matter which part “touches” the landmine.
Shouldn’t landmines trigger exclusively from wheels or other parts that touch the ground?
[quote=“Vareruma, post:8, topic:8465”]How about top speed being limited to 40% while going backwards? If a sportscar has a top speed of 200mph doesn’t mean that can hit the same speed in reverse.
Also, I may be wrong but as of now vehicles can trigger landmines when you drive on it, doesn’t matter which part “touches” the landmine.
Shouldn’t landmines trigger exclusively from wheels or other parts that touch the ground?[/quote]
When going backwards, cataclysm 0.B limits it to 25% top speed and 60% acceleration. I’ll keep the 60% acceleration (engine power) limit, and top speed in reverse will be calculated based on that. Normally the gear box would be the main limit to reverse speed, so since gear boxes are not in the game (yet), reverse speed will probably be pretty high. I don’t have a problem with that, some cars can drive really fast in reverse. The 60% value can easily be lowered if people disagree with me.
What about electrical systems? From what I recall the entire engine/alternator/battery situation was coded by someone who had no clue how cars actually work.
Just popping in to say that I’ve done 40 MPH in reverse, manual transmission, was a Mazda of some sort. Just learning how to drive at the time and had a wide open lot.
It’s not that it isn’t working, just that it is a simplification.
For one, I’m pretty sure alternators aren’t just an on/off thing.
In current system, you can’t disengage the alternator and you can’t make it take more power when using it as a generator. Their load on the engine is totally separate from the one that powers the wheels (ie. having a truck alternator won’t slow down your car, except for the weight) and is also relatively minor.
Batteries are also simplified in that they charge sequentially (in the order in which they were installed), have 100% efficient charging/discharging and don’t lose power for idling. This means that when you’re using electric engines, the best choice when installing batteries is installing as many as you can (except on the bumper). Real life pure electric car batteries are heavy as hell.
They also have no performance degradation from old age, but that’s actually a good thing - aging batteries you need to constantly dispose of/reinstall would be annoying and very bad design.
[quote=“Coolthulhu, post:14, topic:8465”]It’s not that it isn’t working, just that it is a simplification.
For one, I’m pretty sure alternators aren’t just an on/off thing.
In current system, you can’t disengage the alternator and you can’t make it take more power when using it as a generator. Their load on the engine is totally separate from the one that powers the wheels (ie. having a truck alternator won’t slow down your car, except for the weight) and is also relatively minor.
Batteries are also simplified in that they charge sequentially (in the order in which they were installed), have 100% efficient charging/discharging and don’t lose power for idling. This means that when you’re using electric engines, the best choice when installing batteries is installing as many as you can (except on the bumper). Real life pure electric car batteries are heavy as hell.
They also have no performance degradation from old age, but that’s actually a good thing - aging batteries you need to constantly dispose of/reinstall would be annoying and very bad design.[/quote]
While it would be great if everything was simulated perfectly, I have to choose what to spend time on. I’d rather fix collisions than work on batteries. While working on basic vehicle physics I’ve done some changes to power and alternators, but everything is still simplified.
I think that simplification is a good thing. It avoids tedium. Keep working on the physics rewrite though; I’m looking forward to it.
I’d like to implement something like tank/construction treads that have low speed but are harder to stop via collision. Would this rewrite make that easier?
All of this sounds incredibly exciting. Deeelicious!
Wheel grip/traction being the top scorer in my eyes, I have to wonder, will suspension be introduced as well? Let’s say you’re riding a simple bike (stiff frame, no proper suspension) on dirt/grass. That’s a pretty tough ordeal if you’re in full combat gear + wearing a lot of storage items. Well, at least it should be. Get a mountain bike with some suspension and you’ll likely be able to get up to a more… comfortable speed.
Rambling. Thinking out loud. Still, I’d like some more complexity for traction stuff.
Something that I personally would appreciate a lot would be realistic aerodynamics limiting vehicle speed, and a “cruise speed”(optimal distance/fuel speed) based on that and friction.
[quote=“Llamageddon, post:19, topic:8465”]Something that I personally would appreciate a lot would be realistic aerodynamics limiting vehicle speed, and a “cruise speed”(optimal distance/fuel speed) based on that and friction.[/quote]I doubt that aerodynamics have any place in the vehicle system as if is. As it is, the frames do not have any true shape. As it is, all cars would “aerodynamically” behave like giant lego scooters.