📜 ⬆️ ⬇️

Learning C ++ through game programming

Hi, Habrahabr.

In this post we want to tell you about the good book by Michael Dawson “ Beginning C ++ Through Game Programming ”. Many are familiar with the work of Michael in the book "We Program in Python ", which many liked. Once we talked about it in our blog. We have not yet made a final decision on the publication of the book, so we decided to once again consult with you. As a review, we transferred the opinion of the site www.gamedev.net . In terms of content, the C ++ book resembles Python, since it has the same style — learning through the programming of games.



The book “Beginning C ++ Through Game Programming” is a much deeper work than similar books on programming games in dynamic languages, such as Python, ActionScript, or Java — and this is not surprising. In books on programming games in dynamic languages, many important topics - for example, memory management are considered almost briefly. They are discussed in the final chapters on “optimization”, and the authors often discuss only such particulars as calling the garbage collector less often. But the C ++ language is known for its applied approach to memory management, and here such topics as the placement of pointers and references and memory management as such come to the fore. Therefore, the book “Beginning C ++ Through Game Programming” covers a slightly different range of topics than other books on the programming of games, the authors of which tell about dynamic languages. For example, in a 400-page book on ActionScript, it is quite possible to describe the development of 10 full-fledged games, while in a book on C ++, theoretical topics such as overload operators and deep copying of objects will be considered on page 400. The thing is that C ++ is one of the most fundamental and complex programming languages ​​that are widely used today. To create an object, it is not enough just to “declare its existence” - although in most dynamic languages ​​nothing is required of you anymore. And in order for an object in C ++ to disappear, it is not enough just to “forget about it” for a while.
')
I'm afraid that it is precisely such difficulties that scare many developers away from C ++. In the book "C ++ Through Game Programming" you will not find any complex full-featured games. Here you will learn how to write games that are controlled through the command line — in particular, tic-tac-toe and gallows. But (and this is important!) Such games will be built in strict accordance with the object-oriented design. It may be that such severity is unnecessary in such a trivial game as the “gallows”, but in those games that you will write after reading this book, the knowledge and skills acquired will be very helpful.

Undoubtedly, the game "Hangman" can be written in Python - it will consist of about 100 lines, and all the work will require you no more than half an hour. However, many techniques that you learn when quickly writing such a game will not be applicable in a game with a code of 100,000 lines. Or a million lines. The essence of the book “Beginning C ++ Through Game Programming” is not to teach you to program the Hangman in a hundred lines, so that after that you can feel like a real game developer. In this book, you will learn how to implement reliable projects that will scale well, while remaining comfortable in support. The techniques that you learn in this book will be useful to you at work and on larger projects.

The book "Beginning C ++ Through Game Programming" will be useful to the reader who wants to take the first step towards the development of large projects. The problem is that this first step will not be as interesting as in other similar books. Having worked this book, you will not be able to write a cool game in C ++, and then trump it in front of your friends. But you can take out from this book such ideas, which later will be useful to you in the implementation of simply amazing projects.

The main problem that arose with the book “Beginning C ++ Through Game Programming” is the same as with other books of this kind - Mac and Linux operating systems are considered at the level: “believe, all this code will work in them, but we We will not dwell on this. " Considering that in the book, as many as five pages are devoted to setting up Visual C ++ Express and compiling the project, five pages — Xcode and five pages — are an IDE for Linux of your choice, this is worth paying attention to. If you can read this book as a cross-platform, then perhaps it is worth reading it.

Source: https://habr.com/ru/post/237375/


All Articles