Jump to content

  • Log In with Google      Sign In   
  • Create Account


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


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
21 replies to this topic

#1 White Dwarf   Members   -  Reputation: 96

Like
0Likes
Like

Posted 24 March 2011 - 03:14 AM


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).

Sponsor:

#2 Jeffreyp   Members   -  Reputation: 178

Like
0Likes
Like

Posted 24 March 2011 - 03:19 AM

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.

#3 KHearts   Members   -  Reputation: 103

Like
2Likes
Like

Posted 24 March 2011 - 04:20 AM

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.

#4 kaktusas2598   Members   -  Reputation: 838

Like
0Likes
Like

Posted 24 March 2011 - 08:35 AM

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.
Behind every great fortune lies a great crime.
Honore de Balzac

#5 No Style Guy   Members   -  Reputation: 112

Like
1Likes
Like

Posted 24 March 2011 - 10:05 AM

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 :)

#6 White Dwarf   Members   -  Reputation: 96

Like
0Likes
Like

Posted 24 March 2011 - 03:24 PM

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.

#7 No Style Guy   Members   -  Reputation: 112

Like
1Likes
Like

Posted 24 March 2011 - 03:35 PM

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.

#8 summaky   Members   -  Reputation: 134

Like
1Likes
Like

Posted 25 March 2011 - 02:49 AM

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!

#9 AdrianC   Members   -  Reputation: 602

Like
1Likes
Like

Posted 25 March 2011 - 08:41 AM

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.


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?)

#10 blewisjr   Members   -  Reputation: 620

Like
1Likes
Like

Posted 26 March 2011 - 11:07 AM

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.

#11 White Dwarf   Members   -  Reputation: 96

Like
0Likes
Like

Posted 26 March 2011 - 06:07 PM

Thanks for all the feedback, the route ahead seems a lot clearer now. It seems the general consensus is that I should stick with console based programming until I am comfortable with classes and creating basic games in the console (perhaps using the tutorials mentioned by summaky). Then I should begin learning SDL or SFML (perhaps using the LazyFoo tutorials). Posted Image

#12 Darego   Members   -  Reputation: 156

Like
0Likes
Like

Posted 27 March 2011 - 08:24 PM

Hey guys and sorry to jump in your thread @ OP

I'm in the same boat as white dwarf except I'm using Java as my first language and I'm doing it in college. I was quickly looking through LazyFoos tutorials and they are exactly what I'm looking for except in Java. Does anybody by any chance know some begginers game programming tutorials like lazyfoos except directed towards Java?

Also what APIs do most people use for Java game development? I head redDwarf somewhere around this forum a few days ago so maybe that one?

Thanks in advance and sorry again @ OP :)

#13 SimonForsman   Crossbones+   -  Reputation: 6061

Like
1Likes
Like

Posted 27 March 2011 - 09:44 PM

Hey guys and sorry to jump in your thread @ OP

I'm in the same boat as white dwarf except I'm using Java as my first language and I'm doing it in college. I was quickly looking through LazyFoos tutorials and they are exactly what I'm looking for except in Java. Does anybody by any chance know some begginers game programming tutorials like lazyfoos except directed towards Java?

Also what APIs do most people use for Java game development? I head redDwarf somewhere around this forum a few days ago so maybe that one?

Thanks in advance and sorry again @ OP :)


Red dwarf is a fork of project darkstar , it aims to be a multi node horizontally scalable server architecture for large scale online games / virtual worlds, its not really a generic API for game development.

I'd recommend looking into LWJGL or JMonkeyEngine for more advanced games.
For 2D games you can just use the normal Java API for graphics, sound, etc.
I don't suffer from insanity, I'm enjoying every minute of it.
The voices in my head may not be real, but they have some good ideas!

#14 GunnerMan   Members   -  Reputation: 102

Like
0Likes
Like

Posted 28 March 2011 - 04:03 AM

I also have that book and a few others on c++. I first started learning c++ but I now have moved onto c# as my course demanded it.. which is similar in lots of ways and is becoming industry standard. Also you dont have to use pointers etc it has made a lot of it as standard.. so you can carry on learning c++ or try and switch to the newer laungage which id probably recommend as the more you learn c++ the harder it will be to switch over lol..

#15 White Dwarf   Members   -  Reputation: 96

Like
0Likes
Like

Posted 28 March 2011 - 02:53 PM

I also have that book and a few others on c++. I first started learning c++ but I now have moved onto c# as my course demanded it.. which is similar in lots of ways and is becoming industry standard. Also you dont have to use pointers etc it has made a lot of it as standard.. so you can carry on learning c++ or try and switch to the newer laungage which id probably recommend as the more you learn c++ the harder it will be to switch over lol..


From what I have heard, C# is fairly similar to C++ and I've heard it said that once you know one language it is far easier to learn another (translating English to Spanish as oppose to learning to speak, write and read). Furthermore severing a learning process whilst it is still developing would be catastrophically counter-productive, not to mention demotivating. So no, I think ill continue to learn a powerful language that is still central to modern game coding.

#16 White Dwarf   Members   -  Reputation: 96

Like
0Likes
Like

Posted 18 April 2011 - 12:38 PM

Hello it's me again, I have learnt a fair amount about C++ and have decided it's time to move on to GUI games not just console. I want to make a 2D top down, 2D sidescroller and 3D game (in that order) but I have yet to decide on what I should use to make them. Here is the what I've gathered so far about my various options:


Top-Down/Side-Scroller:


SDL:

Pros:
  • Well established.
  • Lots of tutorials.
Cons:
  • The tutorial I tried didn't compile properly.
  • Outdated.
SFML


Pros:
  • Fairly modern.
  • Faster than SDL.
Cons:
  • Far fewer tutorials.
XNA

Pros:
  • Access to larger market.
  • Lots of tutorials.
  • Still being updated.
Cons:
  • Uses C# (I'm willing to transition if that is a better option.)
As for the 3D I'll first learn UDK and then learn Open GL or Direct X.


Any suggestions and/or input would be great Posted Image

#17 Mozly   Members   -  Reputation: 98

Like
0Likes
Like

Posted 18 April 2011 - 01:53 PM

You cannot go wrong with SDL Because from it you can learn the fundamentals of game design. From your console applications you are learning the fundamentals of programming like handling variables and classes and once you start using SDL you will start learning about movement, getting input from mouse and keyboard, handling events, how to make graphics etc.

I leaned SDL game programming but then applied my knowledge building graphical mathematical applications. So a good place to start is right here at lazyFoo's tutorial. Just click that link and never look back.

GOOD LUCK my friend

#18 White Dwarf   Members   -  Reputation: 96

Like
0Likes
Like

Posted 18 April 2011 - 05:20 PM

You cannot go wrong with SDL Because from it you can learn the fundamentals of game design. From your console applications you are learning the fundamentals of programming like handling variables and classes and once you start using SDL you will start learning about movement, getting input from mouse and keyboard, handling events, how to make graphics etc.

I leaned SDL game programming but then applied my knowledge building graphical mathematical applications. So a good place to start is right here at lazyFoo's tutorial. Just click that link and never look back.

GOOD LUCK my friend


Yeah that is what I tried to start off with but even with the exact same source code and files, I was getting errors on the second tutorial.

#19 nooblet   Members   -  Reputation: 167

Like
1Likes
Like

Posted 18 April 2011 - 09:58 PM

As it's been recommended countless times on the forums -- go with whatever you feel most comfortable with, and not worry about what other's think. If you are comfortable with using C++, then there's honestly no point in switching over to C# at this time if you're ready to get into the graphics side of development. My recommendation is biased, but I'm going to say SDL. There's a ton of tutorials, and LazyFoo definitely is one of the best, if not the best provider of SDL tutorials out there. If you're having issues, then try and solve the errors yourself; if all else fails and you've given it your best shot, then post the error here and we'll help you out.

You're just starting the game development scene. Don't try and burden yourself with "should I learn this" or "should I learn that", but rather find the graphics library and language that you enjoy the most. Again, I'm recommending sticking with C++ as you've already had experience with it. If you find that C# (or some other language) is easier to learn, and you enjoy programming using it, then by all means stick with it. We can't really tell someone they prefer Coke over Pepsi :P.

#20 fisyher   Members   -  Reputation: 136

Like
0Likes
Like

Posted 19 April 2011 - 11:36 AM

Yeah that is what I tried to start off with but even with the exact same source code and files, I was getting errors on the second tutorial.


I'm also interested in learning SDL and even though I have just stumbled upon Lazy Foo's SDL tutorial website mentioned here, I was already very impressed by the presentation of the tutorials after following the first few tutorials.

I had no problems with the second tutorial. It was really straightforward so if you had no problems with the first one, which is the setup of SDL, the second tutorial should worked too. You should find out exactly which SDL_ function call triggered the error by checking the return values of every SDL_ functions called.

I have a suspicion that it could be another "relative path" issue since the second tutorial loads a bmp with a relative filepath "hello.bmp". There were no instructions of where to put that hello.bmp file either so it is likely you have put it in the wrong directory and the SDL_LoadBMP function failed as a result. I have noticed some beginners having problems with relative paths of files when calling Load***(filepath) type of functions. I am no exception to that when I started learning C++. Make sure you understand how "relative path" works with respect to your IDE or OS to save yourself headaches when dealing with file loading.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS