Partners: KDAB Whole Tomato Software CppDepend

28 March 2013

Interesting links in March 2013

This time:
  • An Interview with Tim Sweeney
  • Why C++ in Game Development?
  • Rule Of Zero - resource ownership
  • DirectX vs OpenGL Performance
  • PS4 Coming!

An Interview with Tim Sweeney

To be honest I had not known who Tim Sweeney was before I read this interview (shame on me :)). But fortunately I came across gamasutra and found the article.
For those, who do not know Tim: He is founder and currently CTO of Epic Games and wrote most code for the first version of Unreal Engine. What is interesting that he still actively codes! Here is another interview with Swenney.
wikipedia - Unreal Engine
In the mentioned interview we can find:
  • Current trends in rendering engines: global illumination, indirect lighting, dynamic reflections.
  • Scalability: engine should run on modern consoles, high end PC... and on tablets as well.
  • Resources and its costs. Better engines support more resources with even more details, but price of those resources also increase.
  • Unreal Engine 4 will be much easier to use. For instance small games can be created without any programming.
  • Shift to Voxels? They look very promising, but more and more research is needed in this area.
  • Mega Textures are cool, but they might increase production time. It is better to combine uniqueness with automatic content generation.
  • Epic works hard and with close collaboration with hardware vendors to make the best product: best engine suited for developers needs.
  • Unreal Engine was actually a byproduct of idea to make the Unreal the Game. But all in all it appeared to be a great business for Tim.
  • Epic will continue to deliver best engines to all platforms.

Why C++ in Game Development?

Link to gamearchitect blog
In this (old?) article from 2006 we can read an interesting story why C++ is so popular in game development. From one side C++ is attacked by group of people who think that C++ is to high level, the other group of criticism touches C++ being so native oriented and not so modern. I especially like one sentence "The paleolithic C++ physical structure", that recently I find very confusing.
Why then, C++ being in the middle, could gain so much popularity in game development?
  • Inertia - C++ was very popular since 90s till beginning of 2000, so it was easier to start creating a game in this environment. Most of engines, SDKs were written (and are still written) using this language. There were some experiments with custom languages (like Lisp variant from Naughty Dog), that did not succeed.
  • better C, with abstraction layer, multi paradigm, etc, etc. Unfortunately it was and it is quite hard to find people who can truly use all capabilities of the language. 
  • standard library, better productivity
What is conclusion? Use C++ for low level stuff like rendering engine, networking, etc, but actually include dynamic languages like Lua to handle game logic. Even in 2006 it was worth using dynamic language for game logic, so currently (in 2013) there is no other option. Now it is even advised to use such, light languages, for the whole game (and use existing engine).

Rule Of Zero - resource ownership

Resource management is not so easy in C++. For a class with simple member fields like int, std::string, double, ... we just need to provide constructor. But what to do when we have a pointer in the class or some strange resource (like Window HANDLE)?
If you need to explicitly declare either the destructor, copy constructor or copy assignment operator yourself, you probably need to explicitly declare all three of them.
Implementing all of those methods in a class can be error prone and daunting task! But today we can use advantages of C++11 and use actually Rule of  Zero:
Classes that have custom destructors, copy/move constructors or copy/move assignment operators should deal exclusively with ownership. Other classes should not have custom destructors, copy/move constructors or copy/move assignment operators.
How can we translate it to practice? Just use smart pointers (unique or shared) wherever you can and they should simplify (and make it safer) resource management in a class.

DirectX vs OpenGL Performance
On g-truc we can find a lot of articles related to OpenGL. I thought that the author likes OpenGL more... so I was amazed that this time we get a blog post that test performance between DX and GL implementations and unfortunately GL appears to be worse. This proves that the author is credible.
Author tested Unigine Heaven and Unigine Valley new benchmarks:
  • AMD: OpenGL is slower by 19%! that DX11
  • on Valley and on NVidia OpenGL is almost 33% slower that DX11!
  • Intel implementations (DX vs GL) does not differ that much
  • DX appears to be better suited for Game development.
Bear in mind that we need to confront those results with article saying the opposite (that GL is faster), based on Left For Dead port to OpenGL. See detailed results in the article. Maybe its time to refresh some DX code?

PS4 is Coming!
Link to extremetech article
  • customized AMD's Jaguar, 8 cores, clocked probably at 2Ghz
  • 8GB of GDDR5!
  • GPU - next generation of Radeon, combined with CPU. It maybe between Radeon 7850 and 7870
As we all see the spec is not so impressive. We will get a mid to high-end version of PC only! 
What is interesting that PS4 (and probably new XBox) shifted from RISC to x86. This will mean a lot easier engine development - since most of the code will be x86 compatible (no matter whether it is PC, XBox or PS4).
Some more links:

Get my free ebook about C++17!

More than 50 pages about the new Language Standard.

C++17 in detail, by Bartlomiej Filipek

© 2017, Bartlomiej Filipek, Blogger platform
Any opinions expressed herein are in no way representative of those of my employers.
This site contains ads or referral links, which provide me with a commission. Thank you for your understanding.