Skip to main content

An Ode to Bad Engineering, or Why NFS Carbon Runs So Poorly

· 2 min read

An Ode to Bad Engineering, or Why NFS Carbon Runs So Poorly.

Buying a new graphics card always brings new expectations: beautiful effects in games, higher FPS, and general happiness for its owner. Unfortunately, these days a new graphics card (or CPU, or memory upgrade) often serves only to compensate for poor engineering. This is especially disappointing when world-famous developers and publishers allow themselves such technical incompetence at our expense.

So, NFS Carbon. A major franchise. A leading publisher. Do you have high expectations for this product? So did I. Had.

If you've read my previous posts, you know that I enjoy reverse-engineering the renderers of popular games. Usually I would take a good game and try to understand why everything worked so well. When I launched the demo of the new NFS, however, I found myself increasingly haunted by two questions: "Why is everything so bad?" and "Where are these terrible slowdowns coming from?"

So, let's take a look at this "miracle" of programming craftsmanship known as NFS Carbon. In-game rendering (the first race in the demo): There are between 1000 and 3000 (!) DIP calls per frame. That's horrible. The average is around 2200–2300. Everything is rendered as tiny individual objects. Windows on buildings are rendered separately. And so on. Huge shaders. Extreme levels of generalization. The car shaders account for everything: some kind of fog effects, metallic microflakes (I can understand using them in the garage, where you're inspecting the car up close. But why are they needed during a race?). Thank goodness there are shader LODs for the cars. There are none for static geometry. The total number of shader switches per frame is only around 100–200. Texture switches, however, reach 1500–2000. And render state changes (brace yourselves) exceed 15,000. The sky is rendered terribly. Two textures are blended together by some monstrously complicated shader (around 70 instructions, I think) during the very first DIP calls. Naturally, this occupies roughly half the screen. And then, with a clear conscience, they overwrite about 80% of that sky with buildings. Well done. Do you have a powerful graphics card with dozens of pixel pipelines? Congratulations. Now they finally have something to keep it busy. :)