• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
doyleman77

Used old C++, Sudden feeling overwhelmed.

21 posts in this topic

Back in 06 I got into programming from a buddy of mine, and asked for a book on C++ for christmas. I was 17 at the time. Anyway, unimportant. The book was Teach yourself c++ in 21 days; the only one in our local bookstore. I picked it up, and have gone over it a few times. Practiced several things, got into programming light games with SDL, Went to university, and my first day there they jumped me several classes into computer science. They moved me past about 5 computer science classes, all the way up to Intermediate C++. I'm not trying to show off, or brag, just emphasize that I seemed to think I was going places.

 

I passed the course with a B, so I thought I knew what I was doing just fine, but... Now I'm browsing the net, and seeing that what I've been doing is what everyone calls 'C with Classes'. I have barely touched on templates, exceptioins, or STL. In fact, I am embarrased to say I've never once used STL. at all. my course in college had us make our own vector, using templates (my only foot in that part of c++) to build the class.

 

Lately, my head feels... overwhelmed. I want to learn the right way to do C++; to make clean and efficient code. I feel like I almost wasted my last 6 years programming. I learned a few things, sure, but I already knew quite a bit coming from another toolkit I used for awhile; RPG maker 2 for the PS2. Sure, no hard code, but basic scripting that introduced me to control / loops / etc. But most of the C++ I have been writing hasn't really been C++. It's been classes, and C code. And browsing over what C++ 11 looks like just makes me dizzy.

 

I don't know how to word the question I have, but it's basically along the lines of... What do I do about this? Pick up C++ Primer 5ed and try to relearn? I am not sure. Thanks for any advice.

2

Share this post


Link to post
Share on other sites

This whole process is going to be a giant pain, isn't it? I couldn't stand the first 10 minutes of twilight when my sister wanted me to see it...

 

Ok, other than C++ Primer 5ed, what else should I invest in? I hear Effective C++ is a must, and probably the book from Bjarne himself. Those I hear about often.

 

Also, Money is tight, so I can't buy all outright right away; which one would take precedence (the ones I listed and/or any other suggestions you may have)?

0

Share this post


Link to post
Share on other sites

And browsing over what C++ 11 looks like just makes me dizzy

 

I cant see why this is, C++11 is a great improvement

 

I think what you need is a project to work with, something useful to you that can be done with programming, sure there are a lot of apps these days that do stuff but there are more that tasks that don't have apps. You will likely feel more motivated if you are making an app that helps you, don't think too big either (though depending on how much time you have this may not be a bad idea) and do it, you will eventually pick up all the things you need to. This doesn't apply to C++ either, learning a language is one thing but if the project you are doing is dull / trivial you may never learn or have fun

 

http://www.amazon.co.uk/gp/product/0321563840/ref=pd_lpo_k2_dp_sr_1/275-0198393-1684473?pf_rd_m=A3P5ROKL5A1OLE&pf_rd_s=lpo-top-stripe&pf_rd_r=0ESMKHHC1Z6HY5E5GEPB&pf_rd_t=201&pf_rd_p=103612307&pf_rd_i=0321958322

Edit: Hmm, when I read the previous version last year I wasn't too impressed with the way this was written, it read like a math book, but just having a quick look now it reads really well, either I read it wrong last year or got use to it, I would still recommend this with another book though as I feel it may include more than what is needed for a refresher

 

http://www.amazon.co.uk/Ivor-Hortons-Beginning-Visual-2012/dp/1118368088/ref=sr_1_1?s=books&ie=UTF8&qid=1375606617&sr=1-1&keywords=Beginning+Visual+C%2B%2B+2012 This contained enough to get started, though I must admit I missed out all sections after Ch10 simply because it is best to get separate books on other areas, it says VC++ but don't be put off from that its more using C++ in VS than anything, just make sure you don't pick C++/CLI

 

Eitherway its enough to understand the basics and get you started, it wont contain everything, but no book really does, reading one book results in buying 3 more on future areas, I think anything that claims it will make you a pro or teaches you something in 21 days is a load of a shit anyway. Languages are not meant to be learnt in 21 days, just practice a lot and get the experience, you'll get there eventually but just remember there is ALWAYS something to learn.

 

Oh and as for problem solving, or trying to understand something, you will always have a situation where you are pulling out your hair, stressed at why something isn't working or making sense, the worst thing you can do is quit thinking it only affects you, because EVERYONE goes through this over and over and over again, no matter how elite, pro or awesome they are. I have seen so many people quit feeling programming isn't for them due to not understanding something thinking it only confuses them and them only.

Edited by Dynamo_Maestro
1

Share this post


Link to post
Share on other sites

The great thing about C++ books is you know that you only need to read 5% of it to be as productive in C++ than any other language. The difficulty is knowing exactly which 5% to read ;)

 

If you have written your own vector class, then tbh that is a pretty good start. Remember, just because C++ has the STL doesn't mean you need to use it in designing your own classes. Other languages make do fine without it. If you can understand how to use std::vector (easier than C style arrays anyway), then most C++ game engines don't go much further than that.

 

As for exceptions, yeah these are quite useful, so just google some examples on how to use them and then have a fiddle with your favourite C++ compiler.

 

Perhaps don't be so hung up on the language (or scared off by the perceived complexity), start making some simple games and the rest will come to you naturally as you encounter and overcome issues.

Edited by Karsten_
0

Share this post


Link to post
Share on other sites

The ones you listed are a great start. Also, check out Bruce Eckel's Thinking in C++. its free and available online from Bruce.

 

I downloaded the two volumes, thanks for the recommendation on Bruce's books.

 

 

I passed the course with a B, so I thought I knew what I was doing just fine, but... Now I'm browsing the net, and seeing that what I've been doing is what everyone calls 'C with Classes'.

 

Which is fine, though I may get downvoted for saying so. Don't disparage yourself for having learned that much. Using C++ as an extension of C is one way of doing things. It's not in vogue, but it can make functional and effective programs, which is one of the reasons you came to rest at that point.

 

I feel like I almost wasted my last 6 years programming.


No. You've learned a hell of a lot more than most people ever will. Now you have the opportunity to learn more. Take the new concepts one at a time and you shouldn't have trouble. Start with templates, since STL is based on them, then start looking at smart pointers and understand RAII. From there exceptions become more sensible. Move on to containers, and from there you can fill in the rest. It's just like doing a tabletop puzzle. Start putting pieces together, and the more progress you make, the easier it becomes to see where everything fits.

 

 

For as much as programmers need to divide and conquer, I am a bit ashamed to say I forgot I could take the same tactic against the language. Thanks for this advice.

 

 


And browsing over what C++ 11 looks like just makes me dizzy

 

I cant see why this is, C++11 is a great improvement

 

I think what you need is a project to work with, something useful to you that can be done with programming, sure there are a lot of apps these days that do stuff but there are more that tasks that don't have apps. You will likely feel more motivated if you are making an app that helps you, don't think too big either (though depending on how much time you have this may not be a bad idea) and do it, you will eventually pick up all the things you need to. This doesn't apply to C++ either, learning a language is one thing but if the project you are doing is dull / trivial you may never learn or have fun

 

http://www.amazon.co.uk/gp/product/0321563840/ref=pd_lpo_k2_dp_sr_1/275-0198393-1684473?pf_rd_m=A3P5ROKL5A1OLE&pf_rd_s=lpo-top-stripe&pf_rd_r=0ESMKHHC1Z6HY5E5GEPB&pf_rd_t=201&pf_rd_p=103612307&pf_rd_i=0321958322

Edit: Hmm, when I read the previous version last year I wasn't too impressed with the way this was written, it read like a math book, but just having a quick look now it reads really well, either I read it wrong last year or got use to it, I would still recommend this with another book though as I feel it may include more than what is needed for a refresher

 

http://www.amazon.co.uk/Ivor-Hortons-Beginning-Visual-2012/dp/1118368088/ref=sr_1_1?s=books&ie=UTF8&qid=1375606617&sr=1-1&keywords=Beginning+Visual+C%2B%2B+2012 This contained enough to get started, though I must admit I missed out all sections after Ch10 simply because it is best to get separate books on other areas, it says VC++ but don't be put off from that its more using C++ in VS than anything, just make sure you don't pick C++/CLI

 

Eitherway its enough to understand the basics and get you started, it wont contain everything, but no book really does, reading one book results in buying 3 more on future areas, I think anything that claims it will make you a pro or teaches you something in 21 days is a load of a shit anyway. Languages are not meant to be learnt in 21 days, just practice a lot and get the experience, you'll get there eventually but just remember there is ALWAYS something to learn.

 

Oh and as for problem solving, or trying to understand something, you will always have a situation where you are pulling out your hair, stressed at why something isn't working or making sense, the worst thing you can do is quit thinking it only affects you, because EVERYONE goes through this over and over and over again, no matter how elite, pro or awesome they are. I have seen so many people quit feeling programming isn't for them due to not understanding something thinking it only confuses them and them only.

 

 

C++11 has a bit more abstraction than what I am used to, is really all. So much that I get lost and / or confused when I had glanced over some examples once I learned there was the new standard.

 

I appreciate the book recommendations, too. I'll toss them in a wishlist for myself. Maybe another birthday or christmas, another book.

 

Did you not take any algorithms / data structure courses?

 

Actually, I am set up for Data Structures and Algorithms 1 this semester, and Data structures and Algorithms 2 for next semester. I'm still in Uni, I had to leave for awhile because our state suffered a huge flood back in 2011 (north dakota). So I will be tackling this very soon.

 

The great thing about C++ books is you know that you only need to read 5% of it to be as productive in C++ than any other language. The difficulty is knowing exactly which 5% to read ;)

 

If you have written your own vector class, then tbh that is a pretty good start. Remember, just because C++ has the STL doesn't mean you need to use it in designing your own classes. Other languages make do fine without it. If you can understand how to use std::vector (easier than C style arrays anyway), then most C++ game engines don't go much further than that.

 

As for exceptions, yeah these are quite useful, so just google some examples on how to use them and then have a fiddle with your favourite C++ compiler.

 

Perhaps don't be so hung up on the language (or scared off by the perceived complexity), start making some simple games and the rest will come to you naturally as you encounter and overcome issues.

 

I can get the gist of exception handling down, but I don't see a practical use... What was wrong with return values to handle errors?

Maybe I'm thinking about them all wrong...

 

 

Thanks all for the encouragement, and advice. I'll take a crack at this.

Edited by doyleman77
0

Share this post


Link to post
Share on other sites

I can get the gist of exception handling down, but I don't see a practical use... What was wrong with return values to handle errors?

Unsafe as default: if you forget to check a return value, your program may fail subtly and silently (whereas exceptions without handling do the right thing, kill the program immediately and in a way that is easy to debug).

The conditional logic needed to shuffle the errors around makes the code more complicated, quite possibly introduces new bugs, and obscures the normal program flow. The code becomes brittle, hard to read, change or reuse. Clean functional or generic code becomes pretty much impossible.

The differences become apparent even with a trivial example. Suppose we have functions with these prototypes:
string getFilenameWithDialog();
stream openFile(string);
object loadGameObject(const stream&);
Let's say getFilenameWithDialog can fail, openFile can fail in three different ways, and loadGameObject can fail in two different ways. And let's say we want to write a function that uses them, but passes the errors to whoever calls it to handle:
object loadUserObject() {
    return loadGameObject(openFile(getFilenameDialog()));
}
With exceptions, that's it, there's no error handling to write at all. Consider how you'd have to define the functions in the first place, and what loadUserObject implementation would look like, if you tried to use return value error handling. (It will get much worse than that when code gets more complex than this trivial example.)
2

Share this post


Link to post
Share on other sites

 

I can get the gist of exception handling down, but I don't see a practical use... What was wrong with return values to handle errors?

Unsafe as default: if you forget to check a return value, your program may fail subtly and silently (whereas exceptions without handling do the right thing, kill the program immediately and in a way that is easy to debug).

The conditional logic needed to shuffle the errors around makes the code more complicated, quite possibly introduces new bugs, and obscures the normal program flow. The code becomes brittle, hard to read, change or reuse. Clean functional or generic code becomes pretty much impossible.

The differences become apparent even with a trivial example. Suppose we have functions with these prototypes:
string getFilenameWithDialog();
stream openFile(string);
object loadGameObject(const stream&);
Let's say getFilenameWithDialog can fail, openFile can fail in three different ways, and loadGameObject can fail in two different ways. And let's say we want to write a function that uses them, but passes the errors to whoever calls it to handle:
object loadUserObject() {
    return loadGameObject(openFile(getFilenameDialog()));
}
With exceptions, that's it, there's no error handling to write at all. Consider how you'd have to define the functions in the first place, and what loadUserObject implementation would look like, if you tried to use return value error handling. (It will get much worse than that when code gets more complex than this trivial example.)

 

 

 

I see where this can get hairy, after several different return type functions calling one after another. I'll look into exception handling first, before looking into templates, raii/stl, and the new c++11 features like auto. thanks!

0

Share this post


Link to post
Share on other sites

I can get the gist of exception handling down, but I don't see a practical use... What was wrong with return values to handle errors?

I really strongly recommend getting a copy of "The C++ Programming Language" by Stroustrup.  He explains why and when you would make such a choice, and the relative advantages and disadvantages.  He also points out it's OK to program using "C with Classes."  You need to own a copy of that book, it's like the bible only without all the begats (that's in a separate book by Stroustrup, the "Design and Evolution of C++").

 

Also, Guru of the Week.

Edited by Bregma
1

Share this post


Link to post
Share on other sites

I'm not a professional in C++ but the best book I have ever stumbled upon is this one:

 

C++ Programming From Problem Analysis to Program Design [5th Edition]  

0

Share this post


Link to post
Share on other sites
I went through this exact same phase of mind. Look a my blog, I posted about it a lot during that time.

As a side note, I've got a new computer and can finally get active again.
0

Share this post


Link to post
Share on other sites

The way I see it, you're kind of in luck. Nearly all of the must-have books have recently been updated to C++11--Lippman et al's C++ Primer 5th Ed, Bjarne's The C++ Programming Language, and Josuttis' The C++ Standard Library: A Tutorial and Reference being the first three you probably want--Meyers' Effective C++ is not yet updated, and as a book is probably most-useful when you have a better understanding of C++11, along with the standard library; depending on how he revisits the content from the 2nd Ed, the current 2nd Ed may or may not remain a valuable resource. Avoid "More Effective C++" it hasn't yet gotten a 2nd Ed, and it was published between C++96 and C++03, so its pretty outdated (there are some gems of info inside, so read it if you can borrow a copy, just don't waste your money on it at this juncture).

 

If you approach C++11 with a clean slate (that is, leverage your experience with the syntax, but try to forget your "old way" of doing things), then you'll have a good time. While C++ is larger and more intimidating, it actually is a great stride towards writing correct code that's easier to maintain if you use the tools properly, and the C++ standard library has been expanded upon with many helpful classes, like regex and smart pointers, that you previously had to build or find from a third party.

 

Good luck.

1

Share this post


Link to post
Share on other sites

I hear Effective C++ is a must...

 

Actually, that book rocks me... I have a copy (not in my native language, mind you) and have read it several times, each time finding something I did not realize the first time around.

 

I found myself in a similar situation some time ago and well, I am no expert but the STL really, really changed my life. Forever. I think you can find some posts around here where I would use my own string and list classes... Well, to hell with them. Take the STL one step at a time, say, strings, vectors, move on to iterators, harvest the power of lambdas and ranged for loops... You can really have a great time with that!. Actually, is not that much different at all, it just feels more natural and really helps you out speeding up your process.

 

Keeping in touch with new features (there are a lot of them) is overwhelming but all you have to do is take steady, small steps. Incorporate new stuff in your codebase and you will be allright. Get used to read it and tweak it until it feels right. Also, this may come late but I will not waste the chance of saying it: mind the const correctness!!!. Snowball effect at its best.

 

Edit - PS: Internet forums are your friends... I browse them regularly, just reading, learning and, sometimes, getting frustrated. I think most of us really feel overwhelmed reading guru code but hey, it's ok. Everyone has to start small... Someone up there said about starting with small games. That's all about it I think: starting small, getting in touch with people having the same questions, living and learning. And in my case, of course, ending up at square one :P.

Edited by The_Marlboro_Man
0

Share this post


Link to post
Share on other sites

Wow. A lot of replies and advice. I am having flaky internet, so I don't want to test my luck by replying to each one individually, but I promise I did read them all over, twice on most occaisions. I appreciate a lot of what everyone has said to do.

 

I put Primer 5ed as my first book to acquire, and will go through that; and then sometime after will look at the Effective C++ book. I also will be sticking around the professors and other students in my class, seeing if I can learn anything off of them. I am pretty hopeful with these 3 sources.

 

Again, thank you all for encouragement, and advice. If you all don't mind, I would like to make this place my home for my programming and gamedev journey. With it, of course, I intend to adhere to the research before posting guideline, and trying at something for awhile before calling for help. It's been awhile since I found a nice community. Thank you all!

0

Share this post


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
Sign in to follow this  
Followers 0