Racing Formulas

All that has to do with the power train, gearbox, clutch, fuels and lubricants, etc. Generally the mechanical side of Formula One.
mattd8752
mattd8752
0
Joined: 24 Jan 2007, 01:57

Racing Formulas

Post

I am fairly new to F1 racing. I am currently making an F1 game. What I am trying to do is come up with formulas to find out how long it would take xx car to run xx miles starting at xx mph. Then for turning how much speed is lost and how long does it take to do a xx degree turn coming in at xx mph. also how much of a randomism factor is there for each. Thanks!

manchild
manchild
12
Joined: 03 Jun 2005, 10:54

Post

Perhaps this topic will help you...

:arrow: viewtopic.php?t=1274

mattd8752
mattd8752
0
Joined: 24 Jan 2007, 01:57

Post

Ok, sorry but the link in that thread is dead. Also to be honest I don't understand a word of it. I have no knowledge of physics. This is why I am asking how would I get the formulas. If anyone can teach me this, I am willing to listen and put as much time as I can towards it. I don't necessarily need to be taught how physics work and all of that, but I do need: formulas (use variables) and tell me WHAT input I need and where I would get that. EX) for top speed I am guessing that you would want HP so I would like to be told a is horsepower, or whatever variable you use. That link was pretty good, but I just don't quite understand all of it.

Thanks - Matt

mattd8752
mattd8752
0
Joined: 24 Jan 2007, 01:57

Post

Also, I'd like to have the following info taken into account:
  • -Tire Width (grip vs acceleration or whatever it would affect)
    -Tire Size (Speed vs Accel or it might be something different if affects if I am wrong)
    -Whatever is needed to calculate the time to get from point A to point B (straightaway) starting at X mph. For example, starting at 40mph, going from point a (start) to point b (finish) where they have a 20mile difference the speed coming out would be 50 mph (just a guess for the example, f1s are a lot faster than this), and time to finish this straight away would be 15s (well, thats probably wrong to, but just and example). So basically it would output the last two bits (time and mph) based on the distance and entrance mph.
    -Speed coming out of a X degrees corner, for example: going in at 30 mph, into a 90 degree corner would bring them out at X mph and would take them X mph.
Please use variables and explain what each variable is at the beginning of each equation. If anyone would do this it would be greatly appreciated. Factor as much as you can in there that can be found about parts and cars on the internet. Don't go into things that I won't be able to find about each car on the internet if you don't mind though.

Thanks - Matt

User avatar
Ciro Pabón
106
Joined: 11 May 2005, 00:31

Post

You could try posting your question at http://forum.racesimcentral.com/. If you don't wish to learn physics you'll have a hard time... but there are several simulators in that forum that are not physic based.

However, the only one I know that is "open", that is, that have documentation about all the equations and have a forum where you can ask questions in the link provided, is Race Car Free Simulator, at http://www.racer.nl/. Actually, you can download the code (and the simulator): it has a GNU license.
Ciro

Carlos
Carlos
11
Joined: 02 Sep 2006, 19:43
Location: Canada

Post

What Ciro has kindly directed your interest toward - is sometimes referred to as a "game engine". I am curious - have you studied game design formally? If I may ask - considering so many race games have been written by well capitalised and massively staffed organizations - what - besides the challenge - suggests this project as a constructive outlet - ? - considering your unfamiliarity with related material. Pleas do not think I am discouraging your efforts. I am only attempting to help with process, defining specifications and a project mission statement which may help establish your goal's viability.

User avatar
Ciro Pabón
106
Joined: 11 May 2005, 00:31

Post

Well, Carlos's questions are well funded. There you have a nice thread on the subject, by someone who tried and failed...

I believe Racer Free was developed singlehandedly (well, most of it) by our beloved Ruud Van Gaal, blessed be his name. :) Of course, he build partly on Richard Chaney's Car Demo, another public, one-man-show car simulaton. There are not many of them.

Both are too "physic based" for the kind of programming Mattd8752 is planning. I quote: "If you want to hop in a car, drive off and beat Michael Schumacher's time, then this is NOT the game for you." But some things, like the curves for grip vs steering (Pacejka file) are useful.

However there are simpler approaches, after all, car games have existed for ages. You can check RARS, the Robot Auto Racing Simulator. It's open software but it doesn't center on physics, because it doesn't center on driving, but on artificial intelligence. There is a more advanced version, called TORCS, accesible from the RARS site. Both have well documented equations. RARS is mentioned in the link provided by manchild (in Brian Beckman's text, at the end).

If you really want to go for total simplicity, you could as well learn SDL (Simple DirectMedia Layer). Here there is an example: POV-Ray. Check the animation. Besides, you can develop for SDL in Perl, C or PHP.

I have a page on my site with a few examples of simulation software, mainly for traffic simulations, but it has some driving and vehicle simulations. I confess I tried to write my own simple program rutines last year, for the amusement of Reca... :oops:

I only wish this thread can receive more car-simulation software, hopefully with a link to its documentation, from the old arcades of the 80's to McLaren's full vehicle simulation.
Ciro

Carlos
Carlos
11
Joined: 02 Sep 2006, 19:43
Location: Canada

Post

Mattd8752 - I am glad that my gloomy post stimulated our comrade to offer so many tools to aid your efforts. Although I suspect that Ciro would have offered his knowledge even if I had not posted today. Our forum is fortunate to have many generous members with a vista of information - that is cheerfully shared.

mattd8752
mattd8752
0
Joined: 24 Jan 2007, 01:57

Post

thanks. Could someone explain the documented equations and where I would get each value from. I am coding in php and I know a bit of C++ so the link was perfect.[/quote]

User avatar
Ciro Pabón
106
Joined: 11 May 2005, 00:31

Post

Well, that's what the documents are for. Besides, you can watch the source code in C, matt! Read them, there's no way to avoid that. Besides, most of the public examples are poor documented, these programmers have been enlightened and they truly have transcended zen... ;)

For example, start with "Simulating single rigid bodies". There, chapter 8, you'll find the code for using "RigidBody.c". http://www.chaney.eclipse.co.uk/rigidbody.zip. Try to compile it. You can use that class in your program directly, it calculates quaternions and all, and forget about that part of your programming. Check the licensing with Mr. Chaney. ;)

Then you can check the demo (here, 750K) and the code source (here). If you are a kart driver, you could learn a lot about weight displacement from the "extra" information of this simulator.

Richard Chaney 750 Kb car demo Notice the cool center-of-weight indicator (white big circle, top center) and the slip angle and tire slip data (to the left)
[img:512:384]http://ciropabon.googlepages.com/Richar ... arDemo.jpg[/img]

Anyway, I'd say, start with a 2-D car. Don't worry about the representation, if the movement equations work there, they will work in the 3-D model.

The movement of a car depends on the forces on four patches "the size of a human hand". All you need are the forces on the patches, no matter how you find them. The "main equation" is the relation between the size of these four forces and the position of the car (or its center of gravity) and its orientation, which is what RigidBody.c is for.

You can find the relation between steering wheel position and these forces on the patches the hard way, using a lot of magic numbers that are somehow related to the physical characteristics of the car.

You also can do it the easy way, taking, for example, the Pacejka magic numbers as a starter: they provide the lateral force you get when you move the steering wheel. They are pretty realistic; actually, there is no way to avoid using them that I know (well, not a practical one), which speaks volumes about how "empirically" we understand friction.

Braking and accelerating should be easy, you don't even have to relate them to any "physical" properties of the engine, as in an arcade game, where you can accelerate from 0 to 1 zillion kph in 3 seconds... ;) You won't go into clutch and differential influences at first, I'd say.

The dark art of the collision calculation (against grandstands or objects in the road, or other cars) can be left out for the second part of your project: don't worry if the car goes out of the road, simply "stuck it" for a couple of seconds, or reduce its "tyre friction", or simply, don't do anything in the beginning. Look at the simple solution you get in Car Demo: the car tilts 45 degrees when it reaches the edges...

BTW, please, keep us informed on how far you go, or if you can find a simpler alternative.

@Carlos: there have been quite a few threads on this subject; I learned a lot last year thanks to other forum members. Actually, if you haven't replied, I wouldn't have gone into writing anything else, I'm "mighty busy"... :)
Last edited by Ciro Pabón on 26 Jan 2007, 03:44, edited 1 time in total.
Ciro

mattd8752
mattd8752
0
Joined: 24 Jan 2007, 01:57

Post

Thanks alot for the explination, but thats not quite what Im looking to do since Im looking for every racer to be simulated by AI, but I will read the C++ for the formulas. Thanks

mattd8752
mattd8752
0
Joined: 24 Jan 2007, 01:57

Post

Ok, Im going through this. I understand SOME of it. I am looking in the car editor exe.

First of all, I clicked Rigid Body Parameters. Then, under engine, what is X(m) and Z(m). Then also for wheels, What are X, Y and Z.

Next, I will go back and hit ENGINE. First of all, what are points (and where do I get them). I don't understand the EDIT POINTS and PARAMETERS sections. Next to gear box. It looks like your standard racing game tuning menu. Quite simple to me, only a few questions. For F1 cars, are most 4WD or what? Also for Gear Ratios, I have an idea how they work, but could someone just explain it a bit more.

Next I am in Brakes/Suspension. I don't get any of it... (sorry but its true)...

Wow, again don't get much of the Wheel/Suspension/Steering stuff. Actually, none of it.

Next, what are tyres (yeah, I don't know that much) and what are all of the parameters.

Ooh yeah, and I do want to use the gears. I plan to make this game as realistic as possible, so to do that I am going to factor in the shifting of gears, and also a possibility for error based on your teams skill level.

Thanks - Matt

mattd8752
mattd8752
0
Joined: 24 Jan 2007, 01:57

Post

I'm hoping someone here knows C aswell, anyways, I'm not to good with it and I'm stuck with

float torque = table.herp(vel) * throttle; // torque from engine
float friction = vel * data.frictionKv; // find friction
if (friction > data.frictionTorque)
friction = data.frictionTorque;
acc1 = (torque - friction - clutchForce) * oneOverMass * RigidBody::RKh2;
vel1 = vel;
vel += acc1;

Basically, I've gotten the following out of it

table.herp(vel) -- What is that, but anyway
throttle -- where is it taken from...

friction = velocity * frictionKv
(the inputted one from the other forms I guess).

if friction > data.frictionTorque
friction = data.frictionTorque

So in other words, data.frictionTorque is the max friction, but what is data.frictionTorque and where is it taken from.

Ok, so is this still part of the if? Where does the if statement end, I don't know all the parameters in C.

Anyways from:
acc1 = (torque - friction - clutchForce) * oneOverMass * RigidBody::RKh2;
vel1 = vel;
vel += acc1;

I get: tfc = torque - friction - clutchForce
acc1 = tfc * oneOverMass * RigidBody::RKh2
vel1 = vel
vel += acc1
(I wrote it like that since PHP doesn't do equations in order)
What is oneOverMass and RigidBody::RKh2?

What does += mean? I am going to keep posting these until I get a grip on it if that is okay?


I found
oneOverMass = 1.0f / data.mOfI;

But I don't quite get that line. If someone could tell me what 1.0f is, and what data.mOfI is.


Thanks - Matt

Ps. I may have also misinterpreted stuff in my explanations to myself, please correct those if I made a mistake.

mattd8752
mattd8752
0
Joined: 24 Jan 2007, 01:57

Post

Ok, also:
void CarEngine::RKStep1(float clutchForce)
was at the top of that one, what does it mean? I noticed it is at the top of most entries on the CarEngine page.

mattd8752
mattd8752
0
Joined: 24 Jan 2007, 01:57

Post

Carlos wrote:What Ciro has kindly directed your interest toward - is sometimes referred to as a "game engine". I am curious - have you studied game design formally? If I may ask - considering so many race games have been written by well capitalised and massively staffed organizations - what - besides the challenge - suggests this project as a constructive outlet - ? - considering your unfamiliarity with related material. Pleas do not think I am discouraging your efforts. I am only attempting to help with process, defining specifications and a project mission statement which may help establish your goal's viability.
I'm working with another developer (who does my graphics, flash, and layouts) who is into F1 racing. He doesn't know about the Formulas, but he does seem to know a hell of alot about other stuff. He has sent me lists of data like prices, and parts to cars, lists of cars and their HorsePowers, etc. I just took responsibility for the researching and implimenting this (I don't think I should have :twisted: ). Well, thanks for the help, and sorry I skipped over this post earlier, I never did read it till now.