Jump to content
  • Advertisement
Sign in to follow this  
korpsce

Writing a pong type game with C++

This topic is 3273 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Howdy. I'm VERY new to C++, within a week or so I should be finishing my first book on learning it, and, as I'm more interested in game design than anything else, I was looking for a good tutorial on making a pong type game. I did a quick google search on the topic, and everything I found pretty much gave me the code to make it, without telling me how the code worked. As I'd rather understand how it works then just blatantly make the game, I was wondering if anyone could point me in the right direction to make a pong-like game, where I would actually learn what the code meant, instead of just the code by itself, with no explanation. The book I have been using is "C++ Without Fear: A Beginner's Guide That Makes You Feel Smart" and once I make a pong like game, I will start working on the next book I have, which is: "Programming Role Playing Games with DirectX (The Premier Press Game Development Series)" Thanks in advance for any help anyone gives me.

Share this post


Link to post
Share on other sites
Advertisement
There should be a fair amount of pong tutorials around on the net for you to digest (just a matter of searching the right one).

But I do admire your effort of taking it step by step,
as you will probably soon realize how hard it is to make a simple game.

To give you a broad view of things..
a Pong program (and most basic game programs) can be broken down into a combination of:
-Graphics
-User Input
-Game Logic
-Sound

And you know, as the game gets more complicated you start adding things like Physics, AI, Networking, etc..but those can be studied a bit later for now.

Usually the first hurdle to climb over at this point is getting to display something on your screen (graphics). I guess you could start from the game logic part..but i find it's always more motivating when you get something on the screen to stare at. = p

There are a couple options to start out with 2D graphics.
You can use APIs - mainly OpenGL or DirectX, i'm sure you have heard these before. While studying OpenGL or DirectX is always great for the future, it might be a bit intimidating at first. You'll experience, getting a .bmp file to display on the screen is no simple task in the beginning. But if you want to study the nuts and bolts of graphics API, there are a lot of tutorials and books to study from. (Google "nehe" for openGL tutorials, and i'm sure directx has tons of tutorials on the net)

There are also some other options, namely using libraries that other people have developed, to quickly get graphics onto your screen. People have been programming games for awhile now, and they've wrapped up a lot of stuff you would normally spend days programming, neatly into libraries for you to simply plug and extend upon. I guess for 2D games Allegro, SDL, and SFML seem to be the popular choices, and there are definitely a lot of tutorials setting up and using these to program your game. These will definitely simplify the process of setting up and displaying stuff on your screen, and are also good things to learn for future use as well.

Really up to you which option you want to try first. Eventually you would want to dive into both options though, if you are planning on really getting into game programming.

After you succeed in setting up a window to display things, you got to figure out how to get user input, and then use that input as data for your game logic. Not to mention add quirky sounds and music.

Once again Allegro, SDL will probably help you out with the user input, and sound part, which is why maybe using such libraries for your first game might be a bit more less intimidating.

I would probably suggest you to get a book in between the current C++ one you have and that DirectX RPG book. Not sure how much basic stuff the RPG one covers, but generally RPGs are quite BIG for a starter project. So it'd be nice to get something in between, something along the lines of "beginner game programming" should be good. Or if you want to dive into SDL or Allegro first, getting a "beginner SDL" or "beginner Allegro" book might not be bad as well. Research first, i suppose.

Other than that, there's a lot of stuff out there to teach yourself, but yeah sometimes they just throw some source code into your face and expect for you to understand it..well take it easy and take it step by step.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!