Game Development – How Dota 2 Runs on Linux, Mac, and Windows

ccross platformgame development

How do Valve create games that run on Linux, Mac and Windows? I imagine they dont really write one version for each platform bec that would just be a nightmare.. or do they? I imagine it is written in a portable C++ code (or C#?) but I wanted to know more details about this.
I've developed an app on Adobe AIR and considering on porting it to a diff language as Adobe abandoned linux support.

Best Answer

Every Valve product is developed using their own in-house game engine called Source. The Source Engine is written in C++. The source engine contains both an OpenGL and a DirectX renderer which helps it in being cross platform, but the key is SDL. The open source Simple Direct Media Library is used by a team inside Valve which is tasked almost exclusively with taking Valve's popular products cross-platform. SDL allows Valve to focus less on writing redundant code that will work here, there, and everywhere and instead focus on fixing what needs to be changed to allow for the build to work on platform X, Y, and Z and let SDL take care of the rest.

SDL allows for this by creating a simple interface that works for every platform (well not every platform, but the ones that matter) when it comes to things like window management, context management, event handling, etc. Without SDL you would have to write code that makes a window for Windows, OSX and Linux just to get the basic window management stuff to work cross platform. In SDL, you call three functions and you have a window. See the reason why people use it now? SDL is at the heart of most of Valve's games today because they are beginning to think about cross-platform from the beginning.

Here is a good article about Linux support and the team that makes it possible at Valve.

Related Topic