Where can I learn C++ for gaming project?

Noctosphere

Nova's Guardian
OP
Member
Joined
Dec 30, 2013
Messages
6,769
Trophies
3
Age
30
Location
Biblically accurate Hell
XP
19,040
Country
Canada
Hello

I'd like to learn C++ for 2d and 3d gaming project
First of all, I know VERY VERY well that I won't be able to make my dreaming project on my first shot, I know that SUPER DUPER VERY well, okay? :)
We all agree?
Thanks :)

So, I know the basics okay? Stuff like loops, conditions, functions (idk if they're call that way in english, I learned through a french website), arrays (even multiple layer(?) of array like int var[x][y])
I also learned a bit about class and inheritage, but I still need to learn...
Anyone has an easy to follow guide for c++? I'd like to learn about some library for 2D and later 3D projects :)
If anyone has tips, can you send link please?
The french website I used to learn used an old/outdated version of C++ (mid-2000's I think)
Thanks :)
 

diggeloid

Alex
Member
Joined
Apr 29, 2019
Messages
470
Trophies
0
Age
34
Location
gbatemp.net
XP
2,417
Country
United States
The most important thing to learn about C++ is memory management. Loops, conditions, functions, inheritance, etc you can do in any language. Triggering a segmentation fault because you accessed an invalid memory address is a C/C++ feature. My advice is to learn C first. Not only is it a lot simpler, it gives you the opportunity to learn memory manage the right way.

But if you just want to make games, there's no shame in using something easier. There are a lot of programming languages out there with automatic memory management. When you have more experience programming in general, you can revisit C or C++ if you really want to. You'll learn much more efficiently that way (it's easier to learn memory management when you already mastered all the other parts).

You have lots of options if you just want to make a game:
For game engines, you can use Unity, Unreal, Godot, or go with something easier like GameMaker Studio.

If you really want to go down the C, C++ rabbit hole, you should start with SDL2. It has an easy-to-use drawing API that can be used to make 2D games, but also includes things like input handling with gamepad support, image/font loading, and more.

EDIT: there's also Allegro, which was where I made my first C++ game :). It's pretty old though, and not sure if it's even supported anymore.
 
  • Like
Reactions: pen159263

Noctosphere

Nova's Guardian
OP
Member
Joined
Dec 30, 2013
Messages
6,769
Trophies
3
Age
30
Location
Biblically accurate Hell
XP
19,040
Country
Canada
The most important thing to learn about C++ is memory management. Loops, conditions, functions, inheritance, etc you can do in any language. Triggering a segmentation fault because you accessed an invalid memory address is a C/C++ feature. My advice is to learn C first. Not only is it a lot simpler, it gives you the opportunity to learn memory manage the right way.

But if you just want to make games, there's no shame in using something easier. There are a lot of programming languages out there with automatic memory management. When you have more experience programming in general, you can revisit C or C++ if you really want to. You'll learn much more efficiently that way (it's easier to learn memory management when you already mastered all the other parts).

You have lots of options if you just want to make a game:
For game engines, you can use Unity, Unreal, Godot, or go with something easier like GameMaker Studio.

If you really want to go down the C, C++ rabbit hole, you should start with SDL2. It has an easy-to-use drawing API that can be used to make 2D games, but also includes things like input handling with gamepad support, image/font loading, and more.

EDIT: there's also Allegro, which was where I made my first C++ game :). It's pretty old though, and not sure if it's even supported anymore.
Thanks a lot
I've already learned a bit of GML, but when I learned that it was a unique language on its own (totally different from others and no reliable way to "translate") as well as not supporting well 3d models, I dropped it.
I'll try some of the link you gave me
Do you have a recommendation for someone who aims for c++?
One that you would take over the others?
Thanks again :)
 
Joined
Sep 9, 2019
Messages
904
Trophies
1
Location
Switch scene
Website
github.com
XP
2,663
Country
Korea, North
There are lots of good resources to learn C++ online but I like this book:
https://www.amazon.co.uk/C-Programming-easy-steps-5th/dp/1840787570/
I'm not sure which edition I have.

If you're learning C++ you'll probably want to check out Unreal Engine. I prefer Unity though which is C# only. If you really want to challenge yourself you could create your own game engine but be warned that it's a hard task. You'll have to do everything yourself. Graphics rendering, User input, physics, etc. If you do decide to go that route this is a very useful website for learning graphics programming. You should really wait until you're comfortable with C++ before you try creating your own engine though.
https://learnopengl.com/

Edit: You should look in to some design patterns too, they're not language specific but they will make your life easier and your code better.
 

Noctosphere

Nova's Guardian
OP
Member
Joined
Dec 30, 2013
Messages
6,769
Trophies
3
Age
30
Location
Biblically accurate Hell
XP
19,040
Country
Canada
Thanks guys, but what I'd really like to have first is a website that have a followthrough tutorial for the basics of C++
Everything I need to know before going to 2D gaming
Then, everything I need to know about 2D gaming before going for 3D gaming
Then, everything I need to know about 3D gaming before going for 4D gaming (just kidding, even though I know it's possible)
Do you have such website?
Thanks again
 
  • Like
Reactions: CompSciOrBust

diggeloid

Alex
Member
Joined
Apr 29, 2019
Messages
470
Trophies
0
Age
34
Location
gbatemp.net
XP
2,417
Country
United States
I actually started with GML too! Used it for like 2 years before jumping into C++. It's definitely not that much different from every other programming language. If it wasn't for that experience, I probably would have failed to learn C++. GML doesn't have object-oriented programming (at least, not when I used it), but a lot of language don't support that either. C, for example, does not support classes, inheritance, etc.

You really can't go wrong with either SDL2 or Allegro. I think Allegro is better since it's closer to a game engine than SDL2, but either one will force you to get better with the language.

Here's a tutorial I found just now with a quick search for SDL2 game tutorial. For Allegro there are tutorials on their website.

Just try one, and if you get stuck/frustrated, try switching to the other one.
 

Noctosphere

Nova's Guardian
OP
Member
Joined
Dec 30, 2013
Messages
6,769
Trophies
3
Age
30
Location
Biblically accurate Hell
XP
19,040
Country
Canada
I actually started with GML too! Used it for like 2 years before jumping into C++. It's definitely not that much different from every other programming language. If it wasn't for that experience, I probably would have failed to learn C++. GML doesn't have object-oriented programming (at least, not when I used it), but a lot of language don't support that either. C, for example, does not support classes, inheritance, etc.

You really can't go wrong with either SDL2 or Allegro. I think Allegro is better since it's closer to a game engine than SDL2, but either one will force you to get better with the language.

Here's a tutorial I found just now with a quick search for SDL2 game tutorial. For Allegro there are tutorials on their website.

Just try one, and if you get stuck/frustrated, try switching to the other one.
Thanks but,,, what exactly is Allegro?
Is it some kind of variant of C++?
 

diggeloid

Alex
Member
Joined
Apr 29, 2019
Messages
470
Trophies
0
Age
34
Location
gbatemp.net
XP
2,417
Country
United States
Thanks but,,, what exactly is Allegro?
Is it some kind of variant of C++?
Allegro is like SDL2. It's a library of functions that handles all of the messy details of creating a window, drawing to the window, reading keyboard/gamepad input, loading/playing audio, etc.

Trust me, you don't want to try doing any of that stuff yourself, especially if you're still learning C++.
 

Noctosphere

Nova's Guardian
OP
Member
Joined
Dec 30, 2013
Messages
6,769
Trophies
3
Age
30
Location
Biblically accurate Hell
XP
19,040
Country
Canada
Allegro is like SDL2. It's a library of functions that handles all of the messy details of creating a window, drawing to the window, reading keyboard/gamepad input, loading/playing audio, etc.

Trust me, you don't want to try doing any of that stuff yourself, especially if you're still learning C++.
alright, thanks, I'll try installing all that stuff and try to figure out how it works
Thanks again :)
 
  • Like
Reactions: diggeloid
Joined
Sep 9, 2019
Messages
904
Trophies
1
Location
Switch scene
Website
github.com
XP
2,663
Country
Korea, North
Thanks guys, but what I'd really like to have first is a website that have a followthrough tutorial for the basics of C++
Everything I need to know before going to 2D gaming
Then, everything I need to know about 2D gaming before going for 3D gaming
Then, everything I need to know about 3D gaming before going for 4D gaming (just kidding, even though I know it's possible)
Do you have such website?
Thanks again
That book I linked takes you from the basics beginning with a Hello World program and progresses through to more complex topics with each concept taught with a full program example. If you don't want to buy it you can probably find a "free" digital copy online somewhere.

Although you joked about 4D gaming this video covers it. Her channel has a lot of great game dev videos but she's inactive now.


I haven't used any of his videos but I've heard this guy is good for learning programming stuff, here's his C++ playlist:


Imo books are really better for learning programming though unless you're trying to learn about a obscure concept or algorithm.
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    AncientBoi @ AncientBoi: :unsure::unsure::unsure: uh.. duh