Please help me get past my pothole in C++ Game Development

Started by
7 comments, last by Evil Booger 17 years, 4 months ago
I have a thousand books and tutorials but I don’t know how to use them properly. I usually read them once or twice but I don’t seem to be learning much. Ok, for example, the first thing a book or in-depth tutorial teaches you is how to create and register a Window. I’ve read a million of those but I can’t just start up Visual Studio and make a window without help. So what I want to know is am I supposed to keep re-reading them until I can make a window by myself or does that not really matter because that code will be hidden in the game engine. I understand the concept and I can make a window if I have a step by step guide next to me that only tells me what I have to do but not how to do it. Can a “good” game developer make a window from scratch whenever he or she wants to? Do I have to memorize the WNDCLASSEX structure, or the CreateWindow parameters to ever pass the “beginner stage”? Please help me get past my first pothole (in the road to becoming the best programmer in the world).
Advertisement
Hell no. Thats what google and the internet in general are for. [grin]

Most programmers who start a new project have a hard drive full of old projects that they can copy stuff from. I started a new project and I reckon I robably had to type less than 20 new lines of code before I had a small program up and running.

That said I can usually type up a complete small SDL application from memory and have it compile after some minor fixes and run after a few more.

But SDL is an example of a really easy API.

To get past the beginner stage, finish a game. Be able to repeat. [smile]
Quote:
Can a “good” game developer make a window from scratch whenever he or she wants to? Do I have to memorize the WNDCLASSEX structure, or the CreateWindow parameters to ever pass the “beginner stage”?


Of course not. Don't waste time trying to memorize things like that. I don't even remember how many parameters CreateWindow has. Hell, I don't even remember when it was the last time I actually wrote code about this sort of thing, I just copy it from other projects. In fact, I don't even memorize the parameters of functions I wrote myself. If you know that you need functions like CreateWindow,RegisterWindow and WNDCLASSEX(among other things), you know how to use them and what they do, you're set. For details like the parameters and such you can always use a reference or IntelliSense.
Ok so I don't have to memorize every little thing I just have to know how to use everything little thing. Great. Thanks.
Let me echo what other people have said: This kind of boilerplate code is the reason copy-and-paste exists in the first place. Look it up the first time; copy it the next nineteen times; when you've done so many projects as that, it may be time to consider if you need to change any of the parameters. Rote memorisation is for computers.
To win one hundred victories in one hundred battles is not the acme of skill. To subdue the enemy without fighting is the acme of skill.
Yeah, definitely don't rely on your memory when API documentation is ready at hand. When you need to know exactly how to use some interface, just look it up. What's important is acquiring familiarity with the syntax and semantics of your language, and being able to solve problems logically.

As you write more and more programs, you'll find that you begin to memorize the stuff you use frequently. Write a lot of Win32 programs and you won't even have to look anything up to bust out a basic Windows app. It's not important to focus on this, though; it'll just happen as you use stuff. [smile]
The good news... Windows.Forms is much easier, and everyone will be using it one day anyway. [grin]
Concerning reuse of code:
if you're using an object oriented language like C++, put your windows creation code as its own object (a gameWindow class or something like that).
I recommend organizing the rest of your project components this way as well for three reasons:

1) you can just drop that class into a new project and go.
2) if there is some change in the windows API (or Directx API, or whatever) you know exactly where to go to update your code and fix it.
3) its easier to track down problems with certain aspects of your game if the components of the game are divided up this way

Hope im not saying something you already know :)

G
Ok thanks to all of you that really helped. Now I can move on without worrying that I didn't memorize everything.

This topic is closed to new replies.

Advertisement