Warning: Ridiculously long post here. Got carried away. Basically they're some thoughts on collision detection/response in general as well as a bit about online implementation challenges that perhaps some might find interesting. If not, skip it and carry on
There are quite a lot of things to look at in collision detection/response, especially in the case of online racing. Make no mistake about it, this is a very tricky thing to pull off and in my opinion LFS does an impressive job of it. As does rFactor.
Maybe I can clarify a couple of things here into separate areas.
First, looking at pure collision detection without the online lag aspect. I.e., during offline racing when you hit a wall or an AI car or something.
There are a few approaches to solving the problem which can depend a bit on what sort of collision primitives you're using and whether you're doing a dynamic versus static test (made up terms just now for discussion). A static test is one where you take two objects "now" in the simulation and see if they are interpenetrating. If they are, you do the collision "response" which itself can be done a few different ways. I.e., in the Grand Turismo series and Ferrari 355 Challenge the "response" is simply to move the cars apart from each other a little bit so they are no longer colliding. They don't bounce off each other one bit (not that I've noticed). A more typical way is to add a force so that they bounce apart. Yet another way is to use a combination of the two. More on this later.
About the "now" part mentioned earlier. One further step some systems do is to backtrack the motion of the objects and see where they were a 1/2 time step ago. If they weren't hitting then, then you go forward a 1/4 time step, then back or forth an 1/8, etc., until you find a reasonably close point and time of collision. This can be fairly expensive for the CPU to do and is probably not necessary in a car racing sim. I don't do this in my engine because I have another way of taking care of the interpenetrations (I'm working on it now, so perhaps it will be horrible. We'll see).
On to the collision primitives. If you use the actual car mesh to do collision detection you are looking at checking a triangle against another triangle. When you roll slowly into a wall and the left front bumper hits it, you'll see it. This can be very slow though due to the shear number of triangles involved so is probably not very common in racing sims. You can improve this by breaking the triangles down into sections outlined by invisible boxes that are checked first though, which greatly reduces the number of triangle checks.
Another way of doing it is to use other sorts of primitives like boxes. I.e., the car "mesh" that collides with something in the physics engine is not literally the body of the car, but rather a series of boxes that wrap around it and fit it as tightly as possible. Even though a little part of the car mesh might be touching something, the boxes aren't, so there's no collision. This is a little bit on a tangent from what you guys are discussing, but since we're on the subject I thought it might be interesting to throw out there. The point is that in some sims where two wheels might be touching each other and yet don't effect anything, this might be why. It's not necessarily an inherent flaw in this type of system though. It might just be that the creators didn't make boxes for the tires. It becomes sort of an art issue at that point rather than something wrong with the engine. I.e., a modder might be able to fix it himself.
BANG! Ok, our "collision detection" has determined that a car has hit something. What now?
Typically what you do is find a collision point somewhere. The actual volumes are interpenetrating so you need to come up with a point in there somewhere to apply a force to. Then, you can find the velocity along the "collision normal" (finding that can be tricky too). I.e., if a ball is tossed onto a flat table, the collision normal points straight up. It's just a vector (think of it as an invisible ray) that might be perpendicular to the surface that was hit.
Now, when a rigid body hits something and there is no energy absorption at all and no friction, the collision point's velocity is reflected along that collision normal vector. I.e., some force or impulse is applied to that point in the direction of the collision normal.
Calculating this force or impulse can be done a couple of different ways, but the gist of it is you're trying to answer, "what force/impulse, when applied along the collision normal, will make that collision point reflect off with the opposite velocity it had coming in?"
To absorb whatever percentage of energy you want all you need to do is multiply that by 0 through 1, so that's just a variable you can change somewhere in the system or model, most likely. (In my stuff it's just a variable in the source code). This 0 through 1 number is called the "coefficient of restitution."
Ok, what this force or impulse does is cause the objects to bounce off each other. The ball hits the table and bounces back upwards. However, there's an additional here: At that time step where you applied the force to reflect the velocity of the collision point, you did not actually move anything. On the next time step, the objects might still be interpenetrating. Fixing the interpenetration is another area. If you don't do anything about that, then what's likely to happen is the collision detection sees on the next step that they're touching, only this time in the opposite direction. Now a new collision force/impulse is applied to reflect the velocity, only this time it pushes the objects back together, resulting in another opposite reflection.
Back and forth, back and forth. The end result is that if the objects hit each other hard enough (more appropriately, "fast enough"), they might stick together and vibrate. This doesn't happen in LFS or any racing sim I've ever seen, so it's very likely that something is in fact being done about penetration, either by preventing it from happening in the first place (the stepping backwards in time mentioned earlier), or fixing it after it has happened (which is what I'm working on).
In short, on top of the force that reflects the velocity, you can calculate another force that will fix the interpenetration. This would in fact scale with the penetration depth.
The linear and angular momentum change caused by this extra impulse needs to be subtracted/negated on the next time step, otherwise you can get a huge extra kick on top of what you should have had just due to the impact velocity. Scaling the impulse down just a touch or limiting it somehow is not a bad idea either. If the penetration is fixed over a few physics engine cycles you probably won't see it.
Because the collision detection process itself might yield a strange collision point at some orientations (perhaps a box primitive that's nearly perpendicular to a wall and close to one of the triangle verticies in that wall, for example), the interpenetration that is calculated might be way, way in excess of what it is in reality. If you're using a method like I am to fix the penetration, you might give the car a HUGE impulse to fix the penetration. If you do not subtract that momentum change on the next step, the car is blasted to the moon...
My guess is that something along these lines happens with the barriers at the autocross track in LFS.
_________________________
Now, going to the online situation. This gets really messy and I have not done it myself yet except in Virtual RC Racing, where I used a very simple collision system indeed and the only online bit was on a LAN where there's no latency at all and we can send packets back and forth every single graphics frame. Collisions work just great on a LAN in VRC. If the collision velocity is more than some amount, there is no penetration correction force applied at all. At high velocities the reflection stuff will usually cause the cars to bounce apart from each other so I don't calculate it there. In this case it's as others here mentioned where the reflection velocity, mass, and all that stuff is the sole factor that determines the force. It works pretty well.
Introduce lag into this picture as well as being restricted to a pitifully low number of packets that can be sent every second. If I'm not mistaken, most online racing sims send only 5-10 updates or so every second. Yikes... Now you're sitting in your physics engine running at 50 or more times that speed and are attempting to figure out if two cars hit each other now, or on step 20, 30, etc.. It's tricky
If you're playing Billy online and are getting only 5 updates per second telling you where he is, you have to do something in between times. Otherwise the car shows up and the position is updated only 5 times per second. This shows up as a wildly stuttering car that's an unrecognizable mess. Really, really bad. This even looks horrible at 40 updates per second (I've done it).
In short, you need to artificially move his car somehow in between times. This is where racing sims often differ a bit in how the online aspect appears. The most cpu friendly way is to smooth the motion somehow. "Dead reckoning" is the most simple way. In the last packet you received you had Billy's position, but if you also included his velocity, you could interpolate between graphics frames, moving Billy's car around so at your 50fps his car is still moving even though you only know for sure where he actually is every 10 graphics frames.
Introduce a big lag spike. For 0.25 seconds due to a network stutter or something you get no update at all from Billy. He continues moving right along at the speed he was going 0.25 seconds ago on your computer, then suddenly his update comes in and his car jumps a few feet to his actual position. This is basically why in (most?) sims you see the cars moving smoothly, but also jumping just a tiny bit here or there a few times per second. rFactor has none of this at all and is the smoothest I've seen, but I must admit that I'd rather have a bit of minute jumping here and there than see some of the things I see there. Primarily they don't appear to interpolate the cars' rotations in a way that matches up with the translation. I.e., if they projected the rotation interpolation forward in time and used that instead (if they really aren't already), it would probably look a lot better.
To minimize this jumping in VRC I restricted the distance that the car could move per graphics frame. I.e., if due to a little lag spike or something Billy's position should be corrected 2 feet to the right, I might only let it move 0.25 feet. Eventually within a few graphics frames it slowly moves over to about the right spot. Your representation of Billy's car is always sort of chasing his actual position down. This is how it appears to work in rFactor too. You could, however, say that if the update position is really huge, don't bother smoothing it, just pop the car back where it's supposed to be and carry on. This appears very smooth with no jumping at all, but when you have a really big lag spike occur of a second or two, the car doesn't just jump back to the right spot like it does in LFS. Instead, it zooms very quickly over to that position and continues on its way. This is how it appears to work in rFactor where you get "fast forwarding" instead of a sudden teleport to the correct position. Keep in mind that the programmer here is supposed to be magically figuring out what the other guy did with his controls some time ago without the information having been sent yet. God forbid if the other guy actually hit something during that period and was sent off in a totally different direction than you know about yet. Tricky problem
Another way is to let the physics engine run for the other nearby cars. I.e., Billy's car position, throttle and steering inputs, and so on, are sent to you and you treat him like an AI car (with or without the actual AI driving) in the mean time. The car rolls along, the suspension is moving the car around, and so on. This is what appears to happen in LFS. I must admit it looks very good and is very convincing. It requires more CPU time to do, but it works well in LFS on my system. A minor improvement in LFS might be to use a hybrid of the two by allowing a tiny bit of position/orientation interpolation to be done on top of the running physics to minimize the jumping. Although I must admit that when actually driving, I don't see any jumping at all. From TV cam mode it's a bit more apparent, but not a major deal to me at all and I hardly ever notice it.
These two approaches both have their pros and cons. Collision detection without any network involvement at all is a serious b*tch to get right. Add in network stuff and woooaahoooaaaa, Nelly!
On your computer Bily's car may appear to be touching yours due to the dead reckoning or whatever smoothing algorithm you're using, but on Billy's computer you might not be touching him. So how do you determine if a collision has happened in this case? You're all familiar with this I'm sure in one sim or another where a bit of lag causes you to hit somebody else when you swear you didn't really hit him at all. Well, you did on his computer and you didn't on yours, so you're both right
If someone would kindly remove the speed of light barrier it would make all this stuff much easier
Once you did determine that there was a collision online, you're solving the same problem as you do offline. You calculate an impulse and apply it equally/oppositely to both cars due to velocity, and depending on how you do things, you might also do an additional impulse to eliminate the penetration. If you do this *before* you render the graphics you theoretically won't see the penetration offline, but due to the network issues it is somewhat inevitable otherwise unless both systems give their cars different impulses. And you better subtract that momentum change that the penetration impulse gave on the next cycle or else large penetrations will shoot you to the moon, and even small ones can introduce energy into the system that shouldn't be there.
My guess is that subtracting this momentum change might not be done in LFS. If it isn't, it's a pretty easy fix. Chances are though it's more complex than that. The collision point itself might be wrong in some situations. I haven't licked that one myself just yet even for a simple box touching a triangle, so don't have much to say there.
Anyway, as said before, this whole area has nothing to do with the rest of the physics model, the car's handling, and so on. It is indeed a part of the physics model of course because you're just adding another force or impulse into it, but calculating that force vector and application point is a different algorithm and doesn't say anything about any other part of the physics engine.