Advertisement

How should I start learning C++ for game development?

Started by February 28, 2021 01:27 PM
6 comments, last by taby 3 years, 8 months ago

Hello! I am a student who is currently learning the basics of programming with C++. I can see in game dev C++ is kinda next level in game programming. It is widely used in different game engines like UE4 or UNIGINE. So where should i start to learn if I have some knowledge of C++. Should I take a tutorial of creating game in UE4 (or UNIGINE), or maybe start with 2D game with SFML?

If your goal is to learn game programming in C++, using an engine is not the best idea - because the tutorials will teach you how to use the engine, now how or why it works this way.

So, like you said, start with a very simple 2D game and finish it. Then make a new game, a little more complicated than the previous one and so on… ?

If you need some resources, these are the ones I recommend:

I hope that helps you. ?

None

Advertisement

This book is really good for getting started in C++.

https://www.amazon.com/Beginning-Through-Game-Programming-Fourth-ebook-dp-B00LZW07P0/dp/B00LZW07P0/

It is just using command-line apps, but it's a great place to learn before you get started with a library.

Once you read that book you should have a basic understanding of the language (not complete, as that can take years, but enough knowledge to continue). Then try to make some simple 2D games on your own: Pong, Breakout, Snake, Asteroids, Space Invaders, etc.

I think if you are planning on shipping/selling a game, then using an engine is a good idea. However, just for learning you might want to code it yourself with a library. You will learn more that way, and it also gives you flexibility in terms of the code design, whereas with an engine you are forced to do it "their way" which is not always the way you would want. Good luck.

Some knowledge of C++ is not enougth to go for a game. Make sure you have at least the basics done which are not game related. Memory management and the basic data structures (array, vector, map …) for example as you'll need them sooner or later so going for it sooner than later is always a plus.

Game programming is not a single topic so you should consider what you really want to go for first, working on gameplay mechanics, base systems or the engine itself?

Then there is no issue on using an existing engine in my opinion, for as long as it fulfills a single criteria: being open source! This way you can jump quite high into the code and have a look how it works, this helped me a lot on understanting the idea behind the system. Unreal might be a bit of an overkill for that purpose but Urho3D for example seems to be good enougth to start. Don't go for Godot because I saw some naive implemented code parts that'll make some trouble sooner or later

I believe everyone's journey is different and that what you want to do and your learning style is at least as important as what you're supposed to do.

As a kinesthetic learner myself I've always learned most and enjoyed most learning through practice and by copying only the basics to make a thing of my own, so I started out by using an open source game project known as Open Tibia (2d mmorpg), which to be honest I've been playing for a long time anyways, learned the basics such as installing dependencies, compiling on Linux and on Windows, started modifying the game client lightly in Lua and C++, hired someone else when I was out of my depths, and started writing my own server mainly in C++ to learn and make a simpler server (the current de-facto standard Open Tibia server is 100k lines just in C++, another 100k for Lua, and so on, it's a mammoth), took about a year or two of casual coding (avg 30min/day) to make a half decent server (10k lines) that does all the basics and a little extra, almost always had fun, and learned a ton: network encryption, filebased encryption, code design, bunch of C++, doing benchmarks, optimizing code, parallel code, parsing and transforming text, wrote my own libraries for reuse in other projects, etc, it's been a blast.
Open Tibia also has a sizeable playerbase of an avg 15-20k players online at any given time (100k+ unique players each day), so I feel like I'm in a position to take advantage of an already existing market share within this community without having to rely on ads and promotions from outside, which is a nice bonus.

In the end I recommend working on whatever interests you the most and gives you the opportunity to learn what you want or need to learn, or whatever feels right honestly, though starting with something relatively simple and work your way up is probably a good idea.

Edit: double post.

Advertisement

After many years, and many libraries later, I have found SDL and OpenGL to be a formidable combination. Make your own simple game using this combination, piece by piece. Once you know how to make a game from scratch, using an engine like UE4 (soon to be UE5) would be a lot easier.

All you need to know is that OpenGL renders primitives, like points, lines, and triangles. it’s awesome.

Just my two cents.

P.S. The books The C++ Programming Language, and STL Tutorial and Reference Guide are both indispensable for beginners.

This topic is closed to new replies.

Advertisement