Blizzard engineer talks about C++11 in games

General discussion around Urho3D.

Blizzard engineer talks about C++11 in games

PostPosted by rku » 06 Oct 2016, 14:14

Very interesting talk, check it out. Talks about all new sweet features in standard library.

https://www.youtube.com/watch?v=8AjRD6mU96s
User avatar
rku
Active user
Active user
 
Posts: 103
Joined: 06 May 2015, 08:24

Re: Blizzard engineer talks about C++11 in games

PostPosted by sabotage3d » 06 Oct 2016, 14:43

Cool thanks for sharing. I watched most of the CppCons but I missed this one.
User avatar
sabotage3d
Have many posts
Have many posts
 
Posts: 515
Joined: 25 Oct 2014, 13:26

Re: Blizzard engineer talks about C++11 in games

PostPosted by Lumak » 06 Oct 2016, 17:45

That was a good talk, but I doubt this is a trend that most devs would follow, not right now at least. The mass concurrency seems to be the high lite of this talk. The constexpr topic was interesting for serialization/deserialization. But w/o there being a multi-threaded rendering capability and the "breath of consumers having a graphics card that can support it," bottleneck would be there.
Lumak
Have many posts
Have many posts
 
Posts: 425
Joined: 08 Jun 2015, 15:38

Re: Blizzard engineer talks about C++11 in games

PostPosted by cadaver » 06 Oct 2016, 18:36

How well can you can rely on e.g. std::thread or std::chrono being on par with the (best use practices of) platform-specific system functions?

Probably quite well if you restrict yourself to the newest compilers. The Ogre thread on C++11 http://www.ogre3d.org/forums/viewtopic.php?f=4&t=80319 is a couple of years old, but they mention the highres clock on VS2012 not really being highres.
User avatar
cadaver
Urho3D author
Urho3D author
 
Posts: 1802
Joined: 16 Jan 2014, 14:52
Location: Finland

Re: Blizzard engineer talks about C++11 in games

PostPosted by rku » 09 Oct 2016, 11:28

Well if something like blizzard find std:: stuff useful it cant be that terrible. Or maybe it is no longer that terrible. We probably could use some of that stuff as well.

I found someone's fnv hash implementation in constexpr. gcc/clang/icc have no problem hashing during compile time. That sounds like potentially nice thing to have for supporting compilers. After all by now there is little reason to stick to older standards and older compilers as even microsoft compiler did catch up pretty nicely with new c++ features.

Compile-time hashing demo: https://godbolt.org/g/ikADrz
User avatar
rku
Active user
Active user
 
Posts: 103
Joined: 06 May 2015, 08:24

Re: Blizzard engineer talks about C++11 in games

PostPosted by cadaver » 09 Oct 2016, 15:10

On Visual Studio, there can unfortunately be IDE usability reasons to stick with an older version, e.g. at some time ago VS2015 was being rather sluggish compared to VS2013. That may have improved with a recent update, not 100% sure.
User avatar
cadaver
Urho3D author
Urho3D author
 
Posts: 1802
Joined: 16 Jan 2014, 14:52
Location: Finland

Re: Blizzard engineer talks about C++11 in games

PostPosted by sabotage3d » 19 Oct 2016, 20:41

I am quite happy wiht C++11 it is fully supported now on Android with Clang and libc++. Is clang an option for Windows users?
User avatar
sabotage3d
Have many posts
Have many posts
 
Posts: 515
Joined: 25 Oct 2014, 13:26

Re: Blizzard engineer talks about C++11 in games

PostPosted by Enhex » 20 Oct 2016, 04:16

sabotage3d wrote:I am quite happy wiht C++11 it is fully supported now on Android with Clang and libc++. Is clang an option for Windows users?

Actually yes, Microsoft ported Clang, not fully IIRC, to Windows and has an extention for VS to use Clang.
https://blogs.msdn.microsoft.com/vcblog ... -released/
http://llvm.org/builds/
User avatar
Enhex
Most active user
Most active user
 
Posts: 325
Joined: 31 Dec 2014, 12:23

Re: Blizzard engineer talks about C++11 in games

PostPosted by S.L.C » 20 Oct 2016, 05:40

Barely anything new in that talk. At least not in 2016. He basically (almost) lost me at the std::distance thing. To me it seems like someone who's been using the basics of C++ (more like C with classes) and then just heard of C++11 and thought he knows enough to tell people that yea, this is the bomb. Most of what he talked about can be found in documentation websites such as cppreference.com. He barely even touched the good stuff. Most of what he covered can probably be found in something like an overview page of the C++11 features. Or a 10 minute 101 course. Nothing really critical to game engines was presented (IMO). Like some revolutionary thing that no one didn't knew until now. And in my opinion C++11 was more like an experiment which was pimped a little in C++14 and finally done right in C++17. Which is why I'm more interested in C++17 than what we had so far.

As @cadaver mentioned, MSVC is not to be trusted when it comes to these features. And if I remember, the chrono issue is even acknowledged. They've delivered compilers with half implementations of the C++y features and then incrementally added them through those CTP updates. And the fun part, is they did not change the value of _MSC_VER in those updates. So it's kinda awkward to know if you're running in a basic install or an updated one.

For example, constexpr was not supported in the release of VS 2013. It was added in in the November CTP update. Then user defined literals was not supported either. They've added them in CTP 14 which later became VS 2015. And a bunch of these incomplete implementations and differences. They've probably released their compilers because they didn't want to fall behind and be left out.

I even remember having to write tons of workarounds because their compiler and standard library was never following the standards. They kinda wen't their own way.

However, I do agree that legacy C++ is dragging a lot of projects behind and let's just say that compilers like MSVC where you never know for sure whether you'll have that feature available or not or whether it works as it's supposed to be, are not helping the situation either.
User avatar
S.L.C
New user
New user
 
Posts: 14
Joined: 24 Dec 2014, 21:08

Re: Blizzard engineer talks about C++11 in games

PostPosted by namic » 10 Nov 2016, 20:49

rku wrote:Well if something like blizzard find std:: stuff useful it cant be that terrible. Or maybe it is no longer that terrible. We probably could use some of that stuff as well.

I found someone's fnv hash implementation in constexpr. gcc/clang/icc have no problem hashing during compile time. That sounds like potentially nice thing to have for supporting compilers. After all by now there is little reason to stick to older standards and older compilers as even microsoft compiler did catch up pretty nicely with new c++ features.

Compile-time hashing demo: https://godbolt.org/g/ikADrz


What's the point in using those hashing functions? Isn't std::unordered_map<std::string, blah> good enough for storing filenames and stuff?
User avatar
namic
Some active
Some active
 
Posts: 64
Joined: 31 May 2015, 23:12


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 0 guests

cron