Archive for August, 2012

Windows 8 C++ Notes

Monday, August 27th, 2012

This post is a living collection of notes I’ve taken whilst exploring Windows 8 development. It’s not guaranteed to be well written nor complete, but who knows, maybe it’ll be useful.


Practical C++11 Support for Game Developers

Saturday, August 25th, 2012

So it’s Ludum Dare 24 weekend (Aug 24th), and I’m finally catching up on some work I had to put off as I … ahem … attended to my duties. Now that the event is going strong, it’s reading time!

The main thing I need to do is some Windows 8 research. I installed the Windows 8 RTM (release) Trial on a new machine earlier this week, as well as the Visual Studio 2012 Express. I generated a basic Direct 3D app to discover, “oh crap, there’s some C++11 stuff going on here now” (EDIT: Yes it was some C++11, but specifically WinRT and C++/CX [video]). So I decided to look more closely at what C++11 features can be practically used in a cross platform sense in apps written today.

References: C++0x on Apache Wiki, C++11 FAQ, MSDN Blog C++11 Support (2), C++ Rocks (2)

For a good reference of new things added in C++11, check out Wikipedia.

The 3 Compilers: GCC, Clang, and MSVC

First a quick summary of the data found here.

Clang has extremely quickly matured in to the most C++11 compliant compiler available. As of May of this year, Clang 3.1 was released, and supports most C++11 features. If I was to place a bet, my bet would be that Clang reaches 100% compliance before the other two.

GCC 4.7 is a very complaint C++11 compiler. GCC 4.4 was one of the first GCC versions to add a significant number of C++11 features. It’s been around since April 2009, with the latest version 4.4.7 released in March of this year. Because of its age, it’s fairly common now, and at the point where we can expect nearly all modern devices to use at least this.

Visual Studio 2012 was released a week ago (Mid August), though it’s been in public beta for a while longer. With the impending Windows 8 Launch in October, this one will be getting some heavy usage over the next few years. Visual Studio 2010 added several C++11 features, but the list has grown since.

Target Platforms

A list of current targets and platforms that have C++ compilers, and what they are based on.

Updated: Nov 4th, 2012

  • Android – NDK 8b (ARM, x86, MIPS) – GCC 4.6
  • iOS 5 – Xcode 4.4.1 (ARM) – Clang 3.1 ??
  • Mac OS X 10.8 – Xcode 4.4.1 (x86, x64) – Clang 3.1 ??
  • BlackBerry 10 (and PlayBook) – Native SDK 2.1 (ARM) – GCC 4.4.2 *
  • Marmalade 6 – iOS+Android+BB10 (ARM, x86, MIPS) – GCC 4.4.1 *
  • ChromeNative Client/Pepper 21 (x86, x64) – GCC 4.4.3 *
  • HTML5Emscripten (JS) – Clang 3.1
  • Ubuntu 12.04 LTS – (x86, x64, ARM) – GCC 4.6.3
  • Ubuntu 12.10 – (x86, x64, ARM) – GCC 4.7.2
  • WindowsMinGW (x86) – GCC 4.7
  • Windows XP, Vista, 7 – Visual Studio 2010 Express (x86, x64) – VC10
  • Windows 7 and 8 – Visual Studio 2012 Pro (x86, x64, ARM) – VC11
  • Windows 8 – Visual Studio 2012 Express (x86, x64, ARM) – VC11
  • Windows Phone 8 – Visual Studio 2012 Express (ARM) – VC11
  • FreeBSD 9GCC 4.2.1 *
  • Adobe FlashFlasccGCC 4.2.1 *

(?? – Unconfirmed, * – Legacy GCC)

All that said, if what you care about are Open and App platforms, (aside from FreeBSD and Flascc) you can target every platform today with some C++11 features!

What I can I use?

The safest feature choices seem to be a cross section of things that are available in GCC 4.4 and VC10/VC11. Be sure to enable C++11 or C++0x mode if you’re using GCC or Clang (Google it yourself).

Features Available (GCC 4.4+, Clang, VC10+)

  • Atomic Operations – Spec (VC11)
  • auto – Spec 0.9, 1.0, MSDN
  • decltype – Spec 1.0 (Final is 1.1), MSDN
  • extern template – Spec
  • New function declaration syntax for deduced return types – Spec
  • Right Angle Brackets – Spec
  • R-Value References – Spec 1.0 (Final is 4.0, so it may be unwise)
  • static_assert – Spec
  • Strongly-typed enums – Spec (VC11)
  • Thread-Local Storage – Spec (partial support with __thread keyword)
  • Built-in Type Traits – Spec

Data and Links above are sourced from here and here.

But wait, I don’t need those weird ones

If Marmalade, Chrome’s Native Client, BlackBerry 10, FreeBSD and Flascc don’t matter to you, then you’re in C++11 town. You can use all features supported by Visual Studio 2012 except:

  • Extended friend declarations
  • override and final

You can find the complete Visual Studio 2012 supported list here.


Aside from FreeBSD and Flascc, amazingly, it’s actually possible today to use some C++11 features in your code, and that code will work in compilers from the other 2 vendors. And depending on your needs, you can today use almost everything Visual Studio 2012 supports. Wider C++11 platform support is just a GCC upgrade away… and then we wait for Microsoft’s next compiler upgrade cycle.

Something new, blue, and not for you

Wednesday, August 15th, 2012

So, I’ve been dabbling with something new.

Don't say it... I know what you're thinking... craft

Height-mapped terrain with a look similar to baked Ambient Occlusion.

Up close, showing the results of a lot of work, that doesn’t look like a lot of work

One of the frustrating conclusions I came to whilst working on “Alone, The” was that content creation was way, far far, too much work. I went in to the project with some strong ideals about procedural content being lifeless and uninteresting. I still somewhat believe that, but when reality kicks in, you realize one can not make a seriously large game alone at a decent pace without being somewhat procedural. On the flip side, procedural generation doesn’t necessarily mean it’s less work, just that once you build one version of something, you can get many similar variations for cheap.

That said, I have very little experience in procedural generation. Smiles and other puzzle games I’ve worked on were the majority of my experience until recently. Essentially, randomly generating a grid of tiles, then either tweaking the map due to some rules, or throwing it away and generating a new one if it’s just not suitable.

So I’ve been spending some time recently experimenting.

Some early random island generation work, and a broken water/wave/precipitation simulation

I do have some ideas where I’m going, but I’m playing things quite loose at the moment. If PuffBOMB and Smiles have taught me anything, its that your initial idea is hardly ever what you end up with. Often times, it’s radically different.

That said, I haven’t quit “Alone, The”, but rather have admit that I’m not ready for it. It’s a project that’s a culmination of way too many things, things I haven’t technically done before. I’ve been working on the tech for a while, and made a prototype earlier in the year to start testing some gameplay ideas. I’ve taken books of notes and ideas, and even with this alternative project, it isn’t going to waste. I might even be making the same core game, but without the story and with a different look. Whether it’s a real time action game with fancy physics or a turn based game on a tile grid, rock still beats scissors.

So, this new project of mine is a Sandbox. Not a Sandbox for you (not yet), but one for me. I may let you play in the Sandbox, but the Sandbox is just a scatterbrained host for where the project is going. I definitely have some ideas, but I’m not going to let a design doc take it somewhere it doesn’t want to go.

My main focus right now is making it “pretty”. I’m dabbling with the Simulation side, even implementing some mechanics, but looking at my immediate schedule (travel and some shows in September, November), I want some eye candy. Even if people can’t sit down and play it, I want them to be able to look at it and say “hello, wow, what are you?”.

I should be formalizing the project soon. I have a name for it. It’s kind-of a crappy name, but again, it’s my Sandbox and not your Sandbox. I am making something in my Sandbox, and when it’s ready, it’ll be released to the wild.

So, feel free to follow along. A little bit of pressure is good for me. 🙂