Wednesday, November 14, 2018

Why is C++ used for game engines? How about its future in game engines?



C++, as I have seen, is being heavily used in 3d video game engines.... Is it because of the performance issues, legecy code or libraries such as DriverX?


If performance, libraries and code infrastructure are the reasons, dosen't that make C++ indispensible, at least for game engines? (ie, we have no other option even in the very distant future).


I asked this because, I have the right to know the upcomming future trends in game engines.



Answer



Some reasons off the top of my head because there are no, IMHO, technical no goers to have say a C# engine:





  • It has been like that for long time (so Nintendo won't send you a python engine because your team programs in python)




  • C++ is Fast (which is good not only for physics engines but also for scene node traversal, occlusion queries, ...)




  • I'm not sure about this but maybe (personal opinion here!) : You hire a C++ programmer because if you can program in C++ you are at least at a minimum level and can easily learn other languages / techniques. Maybe I'm just believing that there is some sort of C++ Lisp-like genius myth though.




  • C++ can be very efficient when it comes to memory usage. A low overhead of your triangle class is important when you want to load up 12 million triangles in your octree.





  • There are a lot of libraries compilers and tools, well tested, out there for C++.




But I guess it's most historical reasons.


Don't forget that many engines comes with bindings to other languages. They are coded in one (say C/C++) but can be used by another (say java).


No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...