   C++ game programming for "codophobes"
  Hi guys, thought I'd link this tutorial on C++ it's still in progress but seems to be written in such a way its more accessible to beginners than most I've read, quite refreshing. One to keep an eye on anyway...I know when I started programming (or learning 3d for that matter) seemed like techical lingo sent me on a paper trail all around the net, annoyed me no end, so I always appreciate it when I see this kind of thing. Perhaps a bit too newbie guide for anyone who already knows a bit of programming, but there ya go:Linky!Hope its of some help to someone!lemmy   
  Looking good so far, although there's naturally a lot more left to write to get to the finished-game point :) Anyway, I would like to congratulate you on starting with *design* of classes.That said, you're missing return types off the member functions ;) Although I don't really know how you'd work them in with your teaching approach. Or data protection, for that matter (maybe not too hard). In any case, you'll probably find you want to edit this stuff later, and that typing out a bunch of forum posts is hardly the best way to organize the information. You might consider setting up a personal wiki or other sort of content management system, if you indeed prefer writing your stuff on the computer and having it available online right away. (Life's too short for hand-coded HTML, after all.) Otherwise, editing a .doc or .txt (etc. etc.) at home and making it downloadable might be the way to go.   ;  Hi Zahlman thanks for the feedback on my WIP tutorial (and cheers lemmy for linking :))> That said, you're missing return types off the member functions ;) Although I don't really know how you'd work them in with your teaching approach. Or data protection, for that matter (maybe not too hard).This is exactly why I've left it out (though I do reference it as something that will need sorting out later). At that time what is important is they understand attributes and methods of classes... explaining return types, void, and public/private etc would be too much at the time.The focus of my tutorial is to ease people in who find all the information given at once too much to handle. Section 3 starts with explaining the void main() function, and thus is the natural way to start on return types... then I go back to that class and say "remember I said there was a coding practice I let slide? Well this is what the deal is..."Likewise I want member access to be explained when the person follow my tutorial can't compile due to private access members... it's easier to learn when presented with a solution to a problem you're having, than being given the solution without ever experiencing the problem... if that makes any sense :)Also I have thought about the Wiki thing myself, and may do that at some stage... but one focus of this is creating content FOR the forums, thus moving stuff out of the forums would be somewhat counter-productive :)anyway part 3 will be up in the non-to-distant. Thanks for your support!chris @ cgempire.com   ;Quote:Original post by cgempireSection 3 starts with explaining the void main() function, and thus is the natural way to start on return types...*cough* int main() *cough*;  *cough* Anyone got any tuts I can read then? ;)I think having a return value for a console app is pretty much semantics nowadays since they're all but legacy stuff. You make a game on PC nowadays and you'd have a WinMain, for a start... The goal here is to get some total newbie to understand this stuff. Not to teach someone up to "industry qualified" level, it's so someone who never thought they could program could learn to cobble together a game on their own... I'd rather someone learnt coding who wouldn't have done by using a void main instead of int main, than them not manage to learn it at all because they got so bogged down with semantics and techical jargon.That comes when they've learnt how to make a game on a more conceptual level, have a good idea how C++ works, game loops and everything... what I don't want to do is bang on about return types for two pages at the start and lose 90% of the readers...If you pull apart "void main" then the tutorial is definitely not aimed at you ;p>> Section 3 starts with explaining the void main() function, and thus is the natural way to start on return types..** I should point out that the return types from all the classes in the tutorial are void, thus why I don't want to go into int return types just yet...   ;Quote:Original post by cgempireI think having a return value for a console app is pretty much semantics nowadays since they're all but legacy stuffTell that to anybody who's writing shell scripts.Quote:I'd rather someone learnt coding who wouldn't have done by using a void main instead of int main, than them not manage to learn it at all because they got so bogged down with semantics and techical jargon.I can understand that, but I've also wasted much time getting people to unlearned things that they got from outdated books and tutorials. I knew people who dropped out when faced with complex numbers, because it flew in the face of what they had been taught before.Consistency in teaching is good. Leaving something (int main()) as an exception at first, and then explaining the general rule (return types) is IMHO better than having to correct what you had taught before. You never know if the correction will "take".Quote:That comes when they've learnt how to make a game on a more conceptual level, have a good idea how C++ works, game loops and everything... what I don't want to do is bang on about return types for two pages at the start and lose 90% of the readers...You should have thought about it before choosing C++ as the language you wanted to teach. You're better off explaining that all functions return a value (with the usual arithmetic function examples) unless you tell them not to with void than try to pass off void as an useless appendage and teach them to use void main() ... which modern compilers will reject anyways.If push comes to shove, you can just tell them that main() needs to return 0 without elaborating on where that return value goes.Quote:If you pull apart "void main" then the tutorial is definitely not aimed at you ;pOne more reason to make sure the tutorial is accurate: your readers won't know when you're teaching them something that is wrong.Quote:>> Section 3 starts with explaining the void main() function, and thus is the natural way to start on return types..** I should point out that the return types from all the classes in the tutorial are void, thus why I don't want to go into int return types just yet...Then just say that the reason for int main() will be explained later, that it's just the way it is, and that they need to get used to some arbitrariness in the way programming languages are designed. God knows C++ holds much more confusing surprises in store for them.   ;  > Then just say that the reason for int main() will be explained later, that it's just the way it is, and that they need to get used to some arbitrariness in the way programming languages are designed. God knows C++ holds much more confusing surprises in store for them.As I said in my original reply that you picked apart? ;)"then I go back to that class and say "remember I said there was a coding practice I let slide? Well this is what the deal is..."Also, I would say a console app is pretty much legacy for game development.shell scripts == games?Look, I can only assume you've not read the tutorial, or you would see that I do go back to things and explain them in full. I just happen to know a little bit about teaching, and how people learn. I'm sure you are an extremely talented programmer, but unfortunately I, and many others, have read one too many tutorials or other guides written by someone who doesn't understand how people learn. Those are the tutorials which, while they may be chock full of extremely insightful ideas, very good coding practices and top notch code they're useless to anyone who doesn't already have a basic understanding of the subject... who just gets lost in a bunch of jargon, or learning a bunch of stuff with seeminhly no useful application for three chapters..If you look at the document, this tutorial is aimed at people who want to have a crack at home of making a game... artists, or would-be indy developers who look at a bunch of code and almost throw up... i.e. not someone you'll be working with any time soon...It states exactly in the document what they will and will not learn. It states that after this they will still need to learn the more techical aspects of C++ programming... it says however that reading such stuff will no longer "fry their brain". Furthermore do you really expect in the rest of my tutorial that I would not bring up these things?This is not someone who is hoping to apply wherever you work when they reach part 10... this is someone who wants to make a little platformer and be chuffed to bits that they did it, when they thought coding was too "complicated and confusing" because of reading "sublimely accurate and comprehensive tutorials" as I suspect you would write.i.e. the things you're pulling apart are the only reason they will still be reading by part 10, and the only reason they have not long closed the browser and give up on programming forever...If you disagree with my teaching methods, then I'm sure the feeling would be mutual. aimed at different audiences, there is a more techical programming tutorial on the same site, and I stand by my decision.Agree to disagree ;) I'm not saying any more on the subject...cheers for the interesting argument anyway ;)   ;  Fruny's point was that anything other than "int main" is not valid C++ and some compilers won't compile it. So, anyone using a strictly compliant compiler will just get an error when they try "void main". That's not going to go over well with a beginner.;Quote:Original post by cgempireAlso, I would say a console app is pretty much legacy for game development.shell scripts == games?Of course not, but the game creation pipeline (and the network it runs on) is all about gluing apps together by pipe or return code. It's totally necessary, unless you have a million dollars and can buy your pipeline completely out-of-box. If I had that kind of money, the last thing I'd be doing is sitting behind a desk. :DFor what it's worth, void is as much of a data type as int is. So doesn't that defeat your argument of easing them into it?   ;Quote:Original post by Dave HuntFruny's point was that anything other than "int main" is not valid C++ and some compilers won't compile it. So, anyone using a strictly compliant compiler will just get an error when they try "void main". That's not going to go over well with a beginner.Free downloadable compiler link in tutorial;)sorry guys if I got a bit short there... just if you read the intro to the tutorial you will see I'm aware of this stuff, and that I made a conscious decision to provide a tutorial that hopefully will find an audience of people who just couldn't handle a full bore C++ documentation. i.e. this tutorial is aimed at those who tried reading all the other tutorials but never made it...Half the point of the opening section is to *fool* them into writing a class, writing what they consider logical "notes" about their game objects, without knowing they were actually writing C++... hence there is a certain process I've gone through which I think is very useful, but alas missing the return types on the members. But as I said I'm making sure I cover all bases properly in the long run.   