basics

Thoughts on C++'s future and the pointer

I've written down some thoughts on the future of C++ and the pointer:

C++ future and the pointer

From the Article:

The last weeks after Meeting C++ 2013 I've been thinking a lot about C++, and also a little bit about pointers. While C++11 brought only little changes for pointers (nullptr f.e.), the semantics and usage of pointers in C++ has changed over the last years.

Nugget: C++1y Automatic Type Deduction -- Tony DaSilva

A short nugget by Tony DaSilva:

C++1y Automatic Type Deduction

by Tony DaSilva

From the article:

In addition to this convenient usage, employing auto in conjunction with the new (and initially weird) function-trailing-return-type syntax is useful for defining function templates that manipulate multiple parameterized types (see the third entry in the list of function definitions below).

Using STL Vectors, and Efficient Vectors of Vectors -- Thomas Young

thomas-young.jpegThese are also the first two articles in a new blog by the creator of the PathEngine SDK.

Note: One or two of the points can be controversial, but the content is interesting and informative especially as an experience report.

Using STL Vectors

Efficient Vectors of Vectors

by Thomas Young

From the articles:

The stuff we do with vectors can be broadly categorised into two main use cases:

  • the construction of (potentially complex) preprocess objects, and
  • run-time buffers for queries, where buffer size requirements are fundamentally dynamic in nature

Preprocess objects include things like the pathfinding visibility graph. These objects can take time to build, but this is something that can be done by the game content pipeline, with preprocess data saved and loaded back from persistence by the game runtime.

Say hello to wxWidgets3.0

A few weeks ago wxWidgets3.0 was released, now it's time to take a look at it:

Say hello to wxWidgets3.0

From the Article

I remember the times, when wxWidgets 3.0 was already talked about, several years ago. Now, its been published in November, though I have to take a look at it. I've been using wxWidgets for years, but moved on to Qt for my own projects. So, lets have a look at wxWidgets 3.0...

Quick Q: Why have move semantics? -- StackOverflow

Quick A: Because value semantics are clean and naturally (exception-)safe, and avoid the brittleness of pre-C++11 workarounds that resort to owning raw pointers.

As often happens, the question contains the answer...

Why have move semantics?

... Can't the client already take advantage of pointers to do everything move semantics gives us? If so, then what is the purpose of move semantics?

Move semantics:

std::string f()
{
    std::string s("some long string");
    return s;
}
int main()
{
    // super-fast pointer swap!
    std::string a = f();
    return 0;
}

Pointers:

std::string *f()
{
    std::string *s = new std::string("some long string");
    return s;
}

int main()
{
    // still super-fast pointer swap!
    std::string *a = f();
    delete a;
    return 0;
}

Dive into C++11 (#2) -- Frametime/FPS, constexpr, uniform initialization, and more

Hello again, I’m Vittorio Romeo, a computer science student, hobbyist game developer and C++ enthusiast.

I've uploaded the second episode of "Dive into C++11" on my YouTube channel. You can find the first episode here.

You can find the complete playlist here.

In this episode we will learn more about two previously mentioned new awesome C++11 features: "constexpr" and "uniform initialization syntax".

Most importantly, we will also deal with a very big issue that every game developer must face: FPS/frametime, and how to avoid the game from behaving differently on slower/faster machines.

In addition, we'll also briefly learn about "const-correctness" and using the "noexcept" keyword.

We will analyze the "time-slice" method to allow the game to run smoothly and consistently on every machine.

In the last code segment, we will also "refactor" our code by creating a `Game` class, making our source much easier to read and maintain.

I greatly appreciate comments and criticism, and ideas for future videos/tutorials.

Feel free to fork the game's source code at: https://github.com/SuperV1234/Tutorials

Quick Q: Why write "5 == myValue" instead of "myvalue == 5"? -- StackOverflow

Quick A: Because it catches most cases where you accidentally wrote = instead of ==.

From SO:

Reason for using '5 == myValue' in conditionals

I've come across some code that flips how a condition is checked and was wondering why this would be done aside from a weird personal quirk. I've never seen any text books use it nor have I seen any sample code done this way.

// why do it this way?
if (5 == myValue)
{
    // do something
}

// instead of:
if (myValue == 5)
{
    // do something
}

I've only seen this way for == operand but not for any other operands.

Dive into C++11 -- Arkanoid clone in 160 lines of code (SFML2)

arkanoid.PNG

I'm Vittorio Romeo, a computer science student, hobbyist game developer and C++ enthusiast.

I've created a 40 minute tutorial/screencast on the creation of a complete game using C++11 and SFML2. The end result is a playable Arkanoid/Breakout clone with a paddle, a ball and destroyable bricks.

I divided the code in 9 segments, that I analyze and execute individually.

The point of the video is showing how easy it is to create something playable thanks to the C++11 standard, and to show a possible train of thought that can be taken during game development.

I greatly appreciate comments and criticism, and ideas for future videos/tutorials.

Also, feel free to fork the game's source code here: https://github.com/SuperV1234/Tutorials

If the idea catches on, I'd love to make a video featuring the best forks.

Thanks for watching!