Skip to content

Comment on Game Programming Patterns (2014)parent

Comments

This book is timeless, it is abstract and the topics apply to Java or the latest fad language.

One good thing about HN is quality material can be reposted. The rules say once per year the same topic can be discussed.

Given the absolutely dismal state of higher education and how shittily it prepares students for the workforce, posting books like this regularly for the next generation is very helpful.

You’ll find this in the other discussions, but:

- the content is covered more succinctly by the Wikipedia page on programming patterns.

- the content is out of date and doesn’t apply to most modern game engines (yes, it really doesn’t; yes, if you’re implementing flyweight or component yourself you’re writing a game engine not a game).

- it doesn’t cover actual game programming patterns like gpu kernels or blackboards (see for example Ai for Games by Ian Millington for a comparison of a book that gives actually useful advice).

Yes, it’s free.

Yes, it covers basic trivial programming patterns.

I think people can make their own minds up if they think it’s worth their time…

…but, regardless, I think it’s pretty fair to put 2014 into the title.

It’s old, and the advice in it is out of date.

Is there a more up to date ressource? My limited knowledge is the move from Unity/Godot toward a component model and that's pretty much all.

Yep, it's full of raw pointers. Smart pointers were already available in 2014.

The author explains why in the first chapter^:

The goal of this book is not to teach you C++. The samples are kept as simple as possible and don’t represent good C++ style or usage. Read the code samples for the idea being expressed, not the code expressing it.
In particular, the code is not written in “modern” — C++11 or newer — style. It does not use the standard library and rarely uses templates. This makes for “bad” C++ code, but I hope that by keeping it stripped down, it will be more approachable to people coming from C, Objective-C, Java, and other languages.

^ https://gameprogrammingpatterns.com/introduction.html#about-...

So what? Smart pointers are not a superior alternative to raw pointers. They are a memory management device that you may or may not want to use.

For example a pattern that I think is common in low level game programming is to allocate a big chunk of memory containing a many objects and deallocating them all at once when you are done with them, let's say a level with its maps, textures, entities, etc... It doesn't really make sense to pass individual objects (ex: a single texture) using smart pointers because you can't delete them individually, in fact, unless you have overloaded the delete operator, it will crash if you do.

In fact, if you never use raw pointers, I think that you are better off using another language than C++ if you can. Manual memory management is a big part of what gives C and C++ its performance (at a cost). If you don't do that, there are languages with well optimized garbage collectors that will outperform you.

To be more precise, they were already part of C++ libraries when C++98 was still in progress, e.g. ComPtr in MFC.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.