Dota 2 running on Linux, Mac and Windows – How do they do it?

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.

8

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.

5

I’m not specifically talking about Dota2 but about most of cross-platform games in general.

Usually developers create/use a middle were called GameEngine. It’s usually in a form of a large scale library containing tools for all sorts of things such as handling game physics, loading and rendering graphical objects, loading and running scripts, managing network related stuff, and so on…

That GameEngine thing can also provide support for those kind of things across multiple platforms. It provides developers with a unified interface, while having different implementations across different platforms. The same thing happens almost every time you see a cross platform application. Even C# itself that you mentioned is doing the same thing under the hood; it’s providing a unified developing experience across all platforms, while handling platform-specific differences under the hood.

In case of valve (Dota2 and their other games) that GameEngine is called “Source Engine”. while anything built on top of Source Engine is platform independent, the engine itself have different implementations for different operating systems. Here is an example: the engine might have a function to draw an sphere. In windows this routine is written using DirectX while in linux and mac it’s using OpenGL.

It means higher level developers including those who are implementing game logic and pretty much everything in a game, won’t even notice platform changes, but in it’s base level code Dota2 (and pretty much any other game) is written once per platform.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật