Jump to content

Book to explain 2D game development in c++ for moderate programmer

Poledancerz

Hello, I am interested in learning how to make a game with graphics. 

Around two years ago, I picked up the Python language, and I feel like I'm fairly proficient in learning the important stuff about the language. Loops, objects, data types, nothing too complicated though. 

 

I would now like to expand my horizon a bit and learn a new language, c++, just because I hear that it is commonly used. 

 

I joined a class in my school where we are allowed to do anything programming related and I would like to make a 2D game to present at the end of the quarter (or at least have something that's 2D and I made) 

The kind of game that I have in mind is realtime-strategy type game, that doesn't really require much use of the keyboard, but mostly the mouse. (There are times where the keyboard will be needed, however.) Kind of like a "conquer them all" kind of game, like Civilization, however, much more dumbed down. 

 

I haven't learned very much about the C++ language at all, except to print "hello world" to the console and to make a basic for loop. 

 

Could anyone recommend me a book that I can use in school that may have what I'm looking for? 

I have tried doing a bit of my own research, and the teacher has too. But I would like to get the opinion of others as well. 

Link to comment
Share on other sites

Link to post
Share on other sites

Books are boring so I just have this for you. I'd recommend C#. Most indie studios use C# or Java and most AAA studios use C++. C++ is easy to transfer to from C# if you want to go the C++ route.

 

http://www.microsoftvirtualacademy.com/training-courses/c-fundamentals-for-absolute-beginners

http://unity3d.com/learn/tutorials/modules/beginner/scripting

 

I'd recommend using Unity as the game engine because it's free and has good 2d support and a ton of tutorials.

 

http://unity3d.com/learn

http://unity3d.com/learn/tutorials/modules

http://unity3d.com/learn/tutorials/modules/beginner/2d

 

I've been planning on making a 3D game for over 2 years and I'm in the process of making it. C# is a 10/10 for indie development.

Link to comment
Share on other sites

Link to post
Share on other sites

The O'Reilly collection is reliably good. http://c.learncodethehardway.org Learn C the Hard Way is written by the brilliant Zed Shaw. I have it and it's excellent too.

 

However I would like to ask you to reconsider your choice of C++ for this project, as learning C++ will set you down a path that while enjoyable (at best) after you've learned it, is nonetheless rather painful. You might consider something like Go or Rust, depending on how fast this game needs to be. It's 2D, but is there a 3D engine in it? If not, you might not even need a language as low level as Rust, in which case I'd recommend Go.

"You have got to be the biggest asshole on this forum..."

-GingerbreadPK

sudo rm -rf /

Link to comment
Share on other sites

Link to post
Share on other sites

Only reason why I would recommend C++ over # is because it has a lot more raw power. 

 

@OP This book is great. I'm using it right now. It teaches you the language (assumes you already have a basic understanding of loops and what not) and also tells you what each method/funciton/variable etc would be used for in game programming. Very practical

http://www.amazon.com/Beginning-C-Through-Game-Programming/dp/1435457420/ref=sr_1_3?ie=UTF8&qid=1410631338&sr=8-3&keywords=c%2B%2B+game+programming

 

Although raw power may not be what's needed in a 2D game, my incredibly inefficient methods of coding are definitely where C++ will shine. Thank you for your suggestion (along with everyone else's thoughts). 

I will show this book to my teacher, and have her look at it. 

I have a quick question.

Does this book ever go into graphics? (preferably not ASCII). My goal for the marking period was to create a basic game with graphics, but since my teacher nor myself knows what really goes into making a game with graphics, I'm sure I can get away with a text-based game. 

Link to comment
Share on other sites

Link to post
Share on other sites

C++ is only painful if you try to build your own data structures. Otherwise it's like any other language: learn the libraries and your basic algorithms.

Software Engineer for Suncorp (Australia), Computer Tech Enthusiast, Miami University Graduate, Nerd

Link to comment
Share on other sites

Link to post
Share on other sites

C++ is only painful if you try to build your own data structures. Otherwise it's like any other language: learn the libraries and your basic algorithms.

 

Uhm, not really.

 

But if you mean templates, then... ^_^

Link to comment
Share on other sites

Link to post
Share on other sites

Get beginning C++ through programming. http://www.amazon.com/Beginning-C-Through-Game-Programming/dp/1435457420

It's a great read for starters. After that get a graphics API like allegro, SDL or SFML, and play around with that.
Here is a great online tutorial to get started with C++ and allegro 5: http://fixbyproximity.com/2d-game-development-course/

Link to comment
Share on other sites

Link to post
Share on other sites

C++ is only painful if you try to build your own data structures. Otherwise it's like any other language: learn the libraries and your basic algorithms.

 

That just depends on how experienced you are. Building the basic stuff like std::vector, std::list and std::queue isn't that difficult. Things like quadtrees, KD-trees are more difficult, but are still really doable. Doing this stuff is just as difficult as in any programming language.

Link to comment
Share on other sites

Link to post
Share on other sites

Uhm, not really.

But if you mean templates, then... ^_^

C++ eleven is much cleaner. And yeah, templates suck.

Software Engineer for Suncorp (Australia), Computer Tech Enthusiast, Miami University Graduate, Nerd

Link to comment
Share on other sites

Link to post
Share on other sites

That just depends on how experienced you are. Building the basic stuff like std::vector, std::list and std::queue isn't that difficult. Things like quadtrees, KD-trees are more difficult, but are still really doable. Doing this stuff is just as difficult as in any programming language.

Rolling one's own in C++ has more hoops to jump through than most languages.

Software Engineer for Suncorp (Australia), Computer Tech Enthusiast, Miami University Graduate, Nerd

Link to comment
Share on other sites

Link to post
Share on other sites

C++ eleven is much cleaner. And yeah, templates suck.

 

I disagree. Templates rock, but their syntax suck. Too hard to get into.

Link to comment
Share on other sites

Link to post
Share on other sites

I disagree. Templates rock, but their syntax suck. Too hard to get into.

Yes, template SYNTAX sucks. They're extremely powerful, but building your own data structures in C++ sucks BECAUSE templates and method virtualization were designed by twits.

 

We need a replacement for C++

Software Engineer for Suncorp (Australia), Computer Tech Enthusiast, Miami University Graduate, Nerd

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×