Learning console c++, how do I make games from here?

Started by
20 comments, last by ReubenESTD 13 years ago

EDIT[April 18 2011] Updated my predicament click here to view.
Hey, I have been learning c++ by using 'C++ a beginner's guide' by Herbert Schildt, for the last month and a half or so. I am about half way through the book and I fully intend on finishing it within the next month. The problem is, I'm not sure where to go from there, I'd love to make a simple 2D side-scroller and then maybe move on to more advanced, 3D games within the next year or so, but I have no idea how I can in-cooperate my graphics and drawings with my console code. How can 'cout <<' or even 'switch' etc. effect how my character jumps, how can I animate this jump? How I can add a background, what tools do I need to achieve this?

Thanks for any feedback/advice - it is much appreciated. Having a goal that is not only achievable, but understandable helps motivate me to spend more of my free time learning C++ (bear in mind I am 15 and in full time schooling).
Advertisement
You probably want to use some graphics library.
If you are going to do 2D games then i recommend using SDL or Allegro.
There are many tutorials out there for SDL and for Allegro i dont know.
Continue to learn what C++ offers, and as you approach topics such as classes, STL containers, etc...you'll understand more of computer science logic and how you, as the developer, can communicate to your compiler what you want to happen. You probably won't be using cout << very often for game development, but switch can be a very powerful control structure. Plus, I often use arrays to handle my 2D animation; you'll see those chapters in your C++ book will become relevant when you're deciding how to implement even the most simple features of game development. I suggest when you are comfortable and competent with Pointers and a bit of object oriented programming, I'd start with some SDL tutorials from LazyFoo. It'll seem like a large step from regular console development to graphical development, but that difficult transition is needed and you will grow and learn immensely.
I agree with KHearts, do not stop learning C++, broaden your knowledge, but you still can learn graphics library, my personal recommendation is SDL, I've heard SFML is pretty good.

Deltron Zero and Automator.

Maybe this is obvious, but nobody has mentioned it, and its something I didn't fully grasp at first:

The entire game world has to be represented in the code, then graphics are just a visualization layer on top of that. For example, you made a fancy 3D model in Maya. You dont simply drop this data into your game world and it works. Its position, orientation, collision dimensions, states, and any other information you need about it has to be represented in your code. You could just as easily use no graphics, and have a Text RPG that plays the entire game.

This means, your console programming experience was not in vain! You will be using all of it, and more, to create your game representation :)
Hey all, thanks for the replies, they have really helped me to understand that my foray into console programming is a solid first step that will directly relate to creating games in the future.

However I am still not sure what my next step should be. I find that I learn best when I can assign a theory or function to a practical use - e.g. arrays to 2D character animation. Having said this, I have only learnt the basics - data types, operators, control statements, arrays, strings, pointers and functions. So my question is, do I learn SDL and console based c++ in parallel, attempting to experiment and practice with the syntax functions I learn in a more practical environment, or do I confine myself to the console until I have learnt about more advanced subjects such as classes, objects, inheritance, virtual functions and polymorphism?

Thanks again in advance, it's nice to find such a helpful community.
It just depends how motivated you are.

Most tutorials will expect you to know about classes and Object Oriented Programming because it is a very common paradigm to use when creating games. Therefore, its counterproductive to make a tutorial on "Game Programming without classes!" for example.

Therefore, if you wish to pursue both in parallel, the burden will be on you to stay one step ahead with your 'programming fundamentals' learning (versus your 'games programming' learning).

Its certainly possible, but it will be harder. For example, it will be more difficult to design a complex game mechanic without fully understanding programming fundamentals. Likewise, if a tutorial or example does something you don't understand, it may be difficult to decipher which area of learning the confusion is actually derived from.
I am not entirely sure if this is going to help you or not, but I believe is worth a try.

I have written some very simple games in a paradigm called literate programmng. With literate programming, besides the actual game's code, there are a lot of comments that should explain in enough detail the logic behind the code and the decision taken during its development. You can think of it as heavily documented applications which instead of following the order required by the compiler, the comments and the code are structured for easier understanding by people. At least, in theory.

To give you some examples, one of the games I've done in literate programming is a console based hangman written in C++. Other console based games I've done are a simple pong and a very simple action-strategy game, although these two are in C, not C++, and use the curses library to print on the console instead of straight "cout". I also did a C++ game with graphics which uses SDL, but this one is a little more complicated.

Please note that these are not tutorials. They are merely simple games with a lot of comments that maybe they can help you understand how to put your knowledge of the language at work. Also, English is not my first language, so they aren't as polished as other tutorials you can find out there (and, I hate to admit, my texts are also a tad boring.)

Like I said, I'm not sure if these games are going to help you or not, but if you read these I would like to ask you for your opinion, either good or bad.

Thanks!
[color=#1C2837][size=2]Hey all, thanks for the replies, they have really helped me to understand that my foray into console programming is a solid first step that will directly relate to creating games in the future.

However I am still not sure what my next step should be. I find that I learn best when I can assign a theory or function to a practical use - e.g. arrays to 2D character animation. Having said this, I have only learnt the basics - data types, operators, control statements, arrays, strings, pointers and functions. So my question is, do I learn SDL and console based c++ in parallel, attempting to experiment and practice with the syntax functions I learn in a more practical environment, or do I confine myself to the console until I have learnt about more advanced subjects such as classes, objects, inheritance, virtual functions and polymorphism?

Thanks again in advance, it's nice to find such a helpful community. [/quote]

You're going to want to wait until you have a solid understanding of cosole c++ before you move on to graphics. Trying to learn both at the same time will prove difficult. Once you feel comfortable with that, get into something like SFML. When starting out, I found SFML much easier to learn compared to SDL. You simply had to write a lot more code in SDL just to set things up.SFML will also run better on modern hardware compared to SDL. (Yeah, yeah, unless you use SDL + OpenGL, but why not just use SFML which has hardware acceleration right out of the box?)
Best advice I can give is stick with C++ it can be a very rewarding experience. Also stick with the console there are a very large number of games you can do on a console. Take everything you learned and write a simple Tic-Tac-Toe game on the console it is a great start and can teach you so much. From there keep learning and as you learn improve your Tic-Tac-Toe or implement Connect Four. As you progress you can even write a Single Player Text Adventure game. Once you are comfortable with utilizing the console and the language you can move to SDL or SFML and start learning graphics.

This topic is closed to new replies.

Advertisement