Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

A lot of black magic is done in game engines to get that level of performance with that level of quality.

Carmack always (ab)used the hardware to the highest level in its code to get that performance/quality ratio and this is why he always kept the latest engine closed.

Unreal engine also had tricks up on its sleeve since Unreal Tournament days, however I don’t know the exact details. IIRC, it was about lighting and shadows mostly.

I had two friends who wrote their own engines. One built a company around that. Other one did visual simulations. Former one told me about the war stories which he battled against NVIDIA drivers, how driver behave the way it wanted, and how he had to abuse it to get the performance it wants. Also both AMD and NVIDIA drivers sometimes implement alternate paths to fix some engines’ performance and artifacts.

He also told how some big studios’ developers abused the driver in a way which can be only defined as “hacking”. I don’t remember the details, but they modified some data in place to bypass the graphics APIs to gain performance. Of course that is pretty brittle.

Latter friend told me how he had to optimize calculations, do great yet cheap approximations and abuse the strong parts of a GPU to get the performance he wanted.

So, a lot. All of these are considered black art and trade secret. Crytek should have some patents about some of the rendering methods they have developed even. They stopped sharing tech demos to prevent being copied, too.



I've worked on games where a static reference is found in the host libraries, and that's used as an offset to stomp on the unnecessary parts of the library provided by the vendor; and therefore recover slivers of precious console memory space for the game.


IIRC, Andy Gavin said during the development of Crash Bandicoot, he stomped pages in the Sony system/OS libraries. As long as the game kept running, all good!


< distant screaming >


Still a (well-known) old favourite of mine:

    static uint8_t data[1048576]; /* IMPORTANT: ASK LEAD WHEN FAILING CERT DUE TO MEMORY */


> Also both AMD and NVIDIA drivers sometimes implement alternate paths to fix some engines’ performance and artifacts

Nvidia moreso than AMD. An interesting artefact of this (or maybe the specific tricks that Nvidia chooses) is that Nvidia's cards need to be paired with a strong CPU, or you can suffer a performance penalty of up to 25%.


How are those two things related?


Driver interrupts the engine instructions, applies fixes or other does other processing on the CPU, and renders the modified code. Think as a SQL query optimizer running real time.

So, you need a fast CPU to keep data flowing to the GPU at the correct rate, without much hindering.


Do they really apply these optimizations on every draw call/frame/flush without any significant caching?


I don't know about caching, but I remember in a particular instance, a game engine (CryEngine IIRC) was calling a very expensive function which should be called seldomly (or every 10 frame or something) every frame, and hurting performance of the card severely. It was very bad PR for the card company.

The driver detected the game (possibly via checksum of the executable), and ignored that function call (while returning success to the game engine), and only executed the function in full, if there's a necessity to do so.

Back in the day, ATI's drivers used shading and texturing optimizations in Need for Speed series to reduce the load on the card for faster frame rates for very minor visual changes.

Do these kinds of optimizations for tens of games, and things get complicated. I remember these optimizations are done for Need for Speed III, Quake 3, Far Cry series, GTA3 (nVidia's budget cards ran the game better than ATI's faster cards at that time), etc.

Since these drivers bent a lot of corners for specific games and made things very complicated, an embedded platform provider decided to re-fork AMD's Open Linux drivers to Windows (IIRC) since they were vanilla, honest to spec drivers with no convoluted pipelines.

A cutting edge graphics card driver is possibly one of the most complex software in today's software ecosystem, IMHO.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: