Re-learning C++ and some help with learning it.

Started by
8 comments, last by DragonBooster 9 years, 10 months ago

Hi guys, its been a while. Due to some complicated and private matters i wasn't able to program much in C++ and the thing is, for some reason the 3 years of C++ i had i forgot all of it. I think the problem may be mainly because i wasn't doing much coding and rather just reading without doing many programs. Now because i have some time to create a game that i honestly badly want to create i have ran into this problem.

I have bought the C++ Primer 5th Edition and my main problem is that for some reason whenever i read after like an hour or so and trying to concentrate as hard as i can on reading the C++ Primer 5 Edition and doing its exercises i always start getting dissatisfied with it and i feel so De-motivated and bored. that after 2 hours I stop and i feel as if... I didn't learn anything at all even though i did my best reading the book and trying to do the exercises.

I always just want to get to actually making the game but the thing is and its something that 3Dreamer was absolutely correct about is that, before making a game you should start making very small programs and build your way up from there which he is honestly very right in, because how can i make a 2D game (I think making a 2D game first is a better choice than a 3D game) if i can't even complete some of the C++ primer exercises (its mainly the bookstore program which i didn't get at all, the rest of the getting started chapter i can manage).

Another problem is that i don't feel like I've learned anything at all even after i did the exercises correctly and tried to do variations of the exercises. Mainly because for me, unless I see a moving sprite or something do i feel like I've actually gone somewhere with what i am learning. I am not trying to say its the books fault, i am mainly just confused whether i should make a 2D pong clone first while learning C++ or do text games first which make me kind of lose interest because that's not what i am trying to create at the end of the day.

But at the same time whenever i see games that i like, I always get that motivation to try to make games the developers inspire me to but my impatience causes me to lose interest whenever i try. I also try to find some exercises online but for some reason the ones i find are very difficult for me to understand and i am kind of lost on where and what i do.

The thing is no matter how hard i try and deal with it, in the end i feel like I've learned nothing. Would you guys say its best i start making Pong clones,Space invader clones or should i just keep with text games and then move on to the pong,space invader clones?

Advertisement

Hi, Zero_Breaker. I feel exactly like you. And I understand why you feel so demotivated. The thing is, you're probably (subconsciously, anyway) thinking you'll be learning all this C++ again and forget it again soon. Other reason for your low morale is you don't get to see results of what you've learned. Finally, the third factor is probably you don't feel trully commited to the whole process of digging in, learning and doing.

Programming is a very, very demanding task. You have to learn C++ (considering your approach now). Then, you need to learn 2D/3D math. Then you need to learn how to use a graphics library (OpenGL, or SDL, or a 3D engine...). In the meantime you need to learn how a game is actually coded - the logic of the game loop, how to integrate several source and header files, how to organize the whole code... The list goes on and on.

Don't feel guilty because you're not getting to the finish line. It does take a long, long time. The important thing here is you like the journey, not just the final destination. I'm saying this but I'm on the same boat... I also keep getting lost on what to do next, what to learn next. Maybe we could learn together? I'm sure it would boost the heck of our morales, to share thoughts, maybe even programming stuff together?

If anyone else reading this is on the same boat, drop me a msg or reply to this topic, maybe we could gather a "beginners" group to keep everyone motivated and to help each other learning stuff.

That being said, and replying to your post, I'd say the book you chose (C++ Primer 5th Edition) is a very, very good choice. It's the book I chose too. It gets very deep into C++, and it may be tiring to finish it, but believe me, it will be worth it. It helps to really understand how C++ works. It will help you to avoid magical bugs and compiler warnings/errors popping out of nowhere because you will trully master the dirty details of it all. So be easy on yourself. You're going the right path, but it's also the hardest one. My approach to your problem (feeling demotivated, bored...) was this: taking notes on the details that will most probably be forgotten in a couple of days (because they're not used enough) but represent potential pitfalls when it comes to code. I made a kind of personal "cheat sheet" with some 15 pages of notes about everything I'll need to remind myself of when I want to code. The book itself has over 1000 pages iirc, so bringing it down to 15 pages is a major sense of accomplishment by itself. Heck, I'll share my cheat sheet with you if it helps you, no problem :)

Concerning the bookstore stuff, I can help you with that if you want. Send me PM if you're interested

Cheers ;)

Hi. There is nothing stopping you from starting work on a 2d or 3d
Game. I did 3 years of c c++ at tafe. Had all the basics. Like link list and data type. With all that under my belt I started my first 2d rts game. Sure it was a hard slog learning directx 7 at the time. The hardest part back then was doing alpha blending because you had to support 16 and 15 bit displays sucked big time. In the end I had a 8 player multi play rts game. Which in turn landed me a job at Ratbag games in Adelaide.
After that being said you should just start on your game and do the learning on the job. This way you should fill it's more rewarding this way because it's part of your goal.

Feeling like you have learned nothing is perfectly normal.

A very common mistake people seem to make is they think they need to "learn C++" before they can proceed. Learning a complex language is an ongoing and never-ending process. I've been at C and C++ for over 20 years now and I'm still learning, especially given that the language itself has evolved significantly in that time.

The answer, it seems to me, is to forget all about "learning C++" and just pick a goal that seems reasonable (e.g. writing Pong). Figure out the first step (e.g. create a window) and learn just what you need for that. Then figure out the next step (e.g. draw a square on the window) and learn just what you need for that. Then the next step (e.g. make the square respond to keyboard input), then the next step etc etc.

Focus on each stage in isolation. Forget about feeling like a C++ expert or having a wide base of knowledge. That will come in time, but only as the result of this painstaking, iterative process, step by little step.

I may be wrong of course. YMMV.

Zanman777 and everyone i honestly want to thank you for your help for helping me with this i greatly appreciate it and Zanman777 you are absolutely correct, that is pretty much how i feel and i wouldn't mind working together with you. Aardvajik, ankhd i totally agree with you guys and honestly i want to thank you for your help, i kind of got re-motivated to start some C++ programming again :)

As others have said, the early days are some of the toughest to stay motivated with. Learning about variables, loops, and branching are boring in isolation, and seeing your "guess a number" game in action doesn't really light a fire in your heart. But know that these fundamentals are the building blocks for everything else. Do what Mr. Miagi says and wax on/wax off. One day you'll be looping through a list of bullets and checking for collisions. Huzzah.

It sounds like you might be ready to move on to using a framework. If you were using C#, I'd recommend monogame and some tutorials that could get a sprite moving around on the screen in short order. It's way more inspirational than "Hello World!" :) If you're not dead-set on C++, it's a fine option.

http://rbwhitaker.wikidot.com/c-sharp-tutorials

http://rbwhitaker.wikidot.com/monogame-tutorials

If you are dead set on C++, do some googling or wait for someone nice to suggest a good option. :)

- Eck

EckTech Games - Games and Unity Assets I'm working on
Still Flying - My GameDev journal
The Shilwulf Dynasty - Campaign notes for my Rogue Trader RPG

Thank you Eck, and for C# i want to learn that later after i finish at least my game that i am creating a concept for. I want to use C# with Unity later on.

I felt that same way too when I was reading C++ Primer 5th edition. It is a long book, and you can't read it straight and master it in one run. Forget about finishing the book. Use it as a reference. Go ahead and pick a Game Framework/Engine (I suggest cocos2d-x). As you learn cocos2d-x, look at other people's examples, you'll eventually learn C++. This way, you get to make the game that you want and learn C++ (and the engine) at the same time. Now, if you feel confused about the code, that's when you pick up your book. I'm assuming you already got some programming experience, so it wouldn't be too difficult for you to try this process.

I find this learning process very effective. Because you get to see results, keeping you motivated.

I feel the same way about playing the piano. I would really love to be able to tickle those ivories like a pro and every time I walk by it I feel a little guilty. I just hate not being able to play really well and I have ideas for some really good music, but I hate the learning and practice.

Is there an easier way to get to Carnegie Hall?

Stephen M. Webb
Professional Free Software Developer

@Bregma I never said i hated the learning and practice, i was trying as best as i could to do the examples the book provided and read the material but felt like i achieved nothing. However, as many others above have posted very helpful tips, i became re-motivated and tried out their suggestions such as using it as a reference while doing something like a pong clone like zee_ola05 said which is a good idea to me and all the others above listed some things that have greatly got me out of my De-motivated state.

But i know what you are saying, there is no easy or magic way to tame a beast, it takes patience, dedication, creativity and adaptability to tame a beast like C++ so i definitely know what you mean by what you said.

This topic is closed to new replies.

Advertisement