Skip to main content
gamedev.net
🔒 Locked

Set a noob straight.

Started by Nightingale Apr 8, 2008 at 1:24 AM 12 replies 2.8k views
Original Post
Nightingale
Nightingale
First off I guess I should explain my interests. My main interest is graphic design, visual arts, etc. Game design to a lesser extent. I'm currently a freshman in college and plan on taking computer science, c++, and graphic design classes next semester. If I could have a job in the industry, it would involve art and not programming. That being said, I'm very open to programming. I've decided to go with the "from the ground up" approach, seeing as none of my friends have the knowledge to create a game I could do art for. A more latent reason is that I feel having general knowledge in all aspects of the game development field is vital to fully understanding a specific aspect; so I really don't mind learning a language and spending alot of time making my own games. Onto the main point of this post. I've been teaching myself C++ lately by reading books. I'm a good way through the first one (I went with C++ for dummies, seemed like a good one to act as a primer) and I've learned variables, strings, functions, classes, pointers, classes and constructors. After getting this far, I have a few questions/concerns. The first question I have is how far along am I towards having a general grasp of the language? Just wondering where I'm at. Mid way through classes I started wondering how all of this ties into programming games. I don't mean guess a number, or other games that just involve playing with numbers. I mean something like a 2d sidescroller... how am I going to make a 2d side scroller using classes and pointers? I guess that might come off as an ignorant thing to ask, but what I really mean is how is this code going to display images on my screen (as opposed to how the game functions). On that same note, how far should I take C++? My original(and current) plan was to read this C++ book to get a general idea, make sure I've retained the knowledge by writing simple programs, then move on to books geared more towards game programming specifically. I have alot of books at my disposal, plenty of which are focused on game programming instead of creating software to help you do your taxes. I just feel that books aimed at C++ in general would give me a better understanding of the language. Was I wrong? I'm not interested in generic "create your own adventure" style game-generators. If/when I get into 3D, I'd be open to something like Torque. The reason I chose C++ is because its arguably the most complex and powerful of all the programming languages. I'm fairly smart, and really havent found any of it challenging yet, so I'm not worried about the complexity and more concerned with celebrating its diversity. One last thing, and I'm sorry for posting a novel, but the articles on the main page seem somewhat out of date. They reference games and technology from the mid 90's. Are they still worth reading? Or are the techniques discussed obsolete now? Thanks for any responses, they're appreciated.
Hodgman
Hodgman
C++ for dummies is from the mid 90's so it's fairly outdated now too ;) [EDIT] - although I guess they've been release new editions, haven't they...

I also started with that book, and it's very naive in a lot of ways. If I remember correctly the author is completely afraid of pointers and thus doesn't explain them as well as he could have.

As for how much of the language you know - that pretty much covers the basics of the syntax. But C++ is big... I've been using it for almost a decade, and I'm still learning new things!
The C++ FAQ lite is a good source of info on the nitty gritty, or if you just need clarification on how different parts of the language behave.


If you want to try out some graphical stuff (seeing your book doesn't touch on graphics at all!) have a look at NeHe's OpenGL tutorials on this site. Just learn how to draw some triangles/squares and put textures on them - that's enough to make simple 2D games.
gharen2
gharen2
Quote:
Original post by Nightingale
The first question I have is how far along am I towards having a general grasp of the language? Just wondering where I'm at.


Hard to say really, especially with a language like c++. It has so many intricacies that many people who consider themselves experts still have huge gaps in their knowledge. Especially someone like me who's self taught. I only use it when I have to and only learn what I need to learn. Huge swaths of c++ are utterly alien to me, and probably will always be. I have no need or desire to learn those details.

From what you say, it sounds like you've made a fine start and have a lot of potential. But it takes years to become an expert at c++.

Quote:
Original post by Nightingale
Mid way through classes I started wondering how all of this ties into programming games. I don't mean guess a number, or other games that just involve playing with numbers. I mean something like a 2d sidescroller... how am I going to make a 2d side scroller using classes and pointers? I guess that might come off as an ignorant thing to ask, but what I really mean is how is this code going to display images on my screen (as opposed to how the game functions).


Simple: don't try to do this yourself. It can be done, but it isn't worth it for anything other than an academic exercise. Use an existing solution such as SDL, OpenGL, or Direct3D. They provide you with the tools you need.

Quote:
Original post by Nightingale
On that same note, how far should I take C++? My original(and current) plan was to read this C++ book to get a general idea, make sure I've retained the knowledge by writing simple programs, then move on to books geared more towards game programming specifically. I have alot of books at my disposal, plenty of which are focused on game programming instead of creating software to help you do your taxes. I just feel that books aimed at C++ in general would give me a better understanding of the language. Was I wrong?


I've always learned more through experience and experimentation than books, but that's a personal thing. How far to go with c++? First, it depends on whether you want to do this professionally. If yes, then you can't learn enough of it. Otherwise, just learn as much as you want or need to.

Using myself as an example again, I'm not a professional programmer, so I only use c++ when I absolutely have to. I don't NEED to know the language inside and out. But if I were to program professionally? Yeah, I'd want to know everything there is to know about it.

And one piece of advice you'll hear quite often: you can never know too many languages. Every new language you learn adds to your capabilities and complement each other. For example, I tried to learn c++ on two occasions. First, when I first started programming: c++ was the first language I worked with. And it was a dismal failure, looking at my old c++ code makes me cringe. However, after a few years of working with my favorite language, c#, I gave c++ another shot and found it much easier to learn. Though it's still unnecessarily complicated and fickle for my needs.

So don't lock yourself into c++. Every new language you learn makes you a better programmer.

Quote:
Original post by Nightingale
I'm not interested in generic "create your own adventure" style game-generators. If/when I get into 3D, I'd be open to something like Torque. The reason I chose C++ is because its arguably the most complex and powerful of all the programming languages. I'm fairly smart, and really havent found any of it challenging yet, so I'm not worried about the complexity and more concerned with celebrating its diversity.


If you haven't had any issues learning c++ thus far, great, stick with it. Just to warn you though, that language does have a tendency to shoot you in the foot when you least expect it.

Quote:
Original post by Nightingale
One last thing, and I'm sorry for posting a novel, but the articles on the main page seem somewhat out of date. They reference games and technology from the mid 90's. Are they still worth reading? Or are the techniques discussed obsolete now?


Looking at old resources can be particularly dangerous with c++, because compilers haven't adhered to a set standard for very long (and I imagine some still don't). You don't want to find yourself trying to use some horrid visual studio 6 code in VS.net 2008.

And technology does change. Nothing makes me cringe more than seeing decade old opengl code being used in modern games, for example.

Learning about old games and how they work is always good, especially for someone looking to write their own games for the first time. But take the code with a hefty grain of salt.

Quote:
Original post by Hodgman
If you want to try out some graphical stuff (seeing your book doesn't touch on graphics at all!) have a look at NeHe's OpenGL tutorials on this site. Just learn how to draw some triangles/squares and put textures on them - that's enough to make simple 2D games.


Nehe is a good example of where you should be cautious: while what he was trying to had merit, much of the code in those tutorials are very obsolete. At most, I would recommend looking at the first few tutorials for a gentle introduction, and then move on.

[Edited by - gharen2 on April 8, 2008 2:54:59 AM]
Kylotan
Kylotan
Quote:
Original post by Nightingale
A more latent reason is that I feel having general knowledge in all aspects of the game development field is vital to fully understanding a specific aspect; so I really don't mind learning a language and spending alot of time making my own games.


This is a commendable attitude that I wish more people shared.

Quote:
I've learned variables, strings, functions, classes, pointers, classes and constructors. After getting this far, I have a few questions/concerns.

The first question I have is how far along am I towards having a general grasp of the language? Just wondering where I'm at.


If you truly understand pointers then you're much further along than most beginners.

Quote:
Mid way through classes I started wondering how all of this ties into programming games. I don't mean guess a number, or other games that just involve playing with numbers. I mean something like a 2d sidescroller... how am I going to make a 2d side scroller using classes and pointers? I guess that might come off as an ignorant thing to ask, but what I really mean is how is this code going to display images on my screen (as opposed to how the game functions).


To keep this short... the screen is represented as a two-dimensional matrix of positions. So are individual graphics, typically. So you might have a class which contained 2 numbers, an X and a Y position of a certain character upon your screen. To move the character, you change those X and Y values, and to draw the character, you call a routine that displays a given graphic at the X and Y position on your screen.

The dirty work of actually changing the pixels as a result of the drawing routine is usually hidden from you these days, so that the hardware can do it more efficiently behind the scenes. You mostly need to just manage where you want things to appear, and which graphic you want to appear there.

Quote:
On that same note, how far should I take C++?


As far as you like. Some would argue you shouldn't have started with C++ at all, since there are simpler packages for creating games, just less flexible. Also, there are simpler languages that are arguably better for beginners, such as Python, Java, or C#.

Quote:
My original(and current) plan was to read this C++ book to get a general idea, make sure I've retained the knowledge by writing simple programs, then move on to books geared more towards game programming specifically.


It isn't a case of being able to move from one to the other. You will continue to need to improve your C++ skills as you go. I am still improving mine after programming with it for 12 years. I would advise not skimping on the core learning. It may be hard to see how it is relevant to games, but I assure you that it is. If you continue to use C++, that is.

Quote:
One last thing, and I'm sorry for posting a novel, but the articles on the main page seem somewhat out of date. They reference games and technology from the mid 90's. Are they still worth reading? Or are the techniques discussed obsolete now?


Some are slightly outdated, some are not. It's hard to say without looking at specific ones.
tharblast
tharblast
Nightingale,

I was in a similar situation to where you are now as far as not understanding where to start and how everything ties together. I would not consider myself an expert by any means but I have come a long way in my understanding of whats involved in making a game. Here is what I have learned.

First I would recommend buying Beginning C++ Through Game Programming Second Edition by Michael Dawson. This is an awesome book. It teaches you C++ through making little games. The book was fun to read and it really did a great job of explaining some of the advanced C++ concepts that I had struggled with in other C++ books.

Beginning C++ Through Game Programming

The book also contains a cd with the code examples and it provides an easy to install Dev C++ compiler. So this is a great book to start with. There are also a couple of web sites that have C++ tutorials and documentation that I have found to be useful:

http://www.cplusplus.com/doc/tutorial/

http://www.cprogramming.com/tutorial.html

One thing to realize is that the examples in the book will be console based text games. But thats good because it will keep the examples simple and allow you to focus in on becoming comfortable with the C++ language.

After you have become comfortable with C++, SDL is a good api that works with C++ and will give you access to keyboard and mouse input, graphics, sound, networking, etc... I have actually written a single player game using C++ and SDL if you want to have a look at it.

SDL web site:
http://www.libsdl.org/

If you want to buy a book devoted to SDL, this one is pretty good (Focus on SDL):
Focus on SDL

Some excellent tutorials for SDL:
http://lazyfoo.net/SDL_tutorials/index.php

A game I wrote using C++ and SDL:
http://www.demuria.com/forums/index.php?showtopic=423

SDL is good for making 2d games but if you want to make 3d games you will need to have a 3d graphics engine. If you want to write your own engine the two languages that are used are DirectX which only works on Windows platforms and Opengl which works on Windows, Macintosh and Linux.

Writing your own 3d engine is pretty hard and I would recommend using a free open source 3d graphics engine written by experts like Ogre 3d or Irrlicht. I recommend Irrlicht. It is a great 3d engine and its easy to setup and use. Here is the link to their site:
http://irrlicht.sourceforge.net/

You mentioned that you are interested in graphic design and you may already know about these tools but I will go ahead and mention them anyway.

Blender 3d is a free 3d modeler that you can use to create the graphics for your game:
http://www.blender.org/

Some tutorials for Blender 3d:
http://en.wikibooks.org/wiki/Blender_3D:_Noob_to_Pro

Gimp is a free program that is similar to photoshop:
http://www.gimp.org/

Good luck and I hope this information helps.
agm_ultimatex
agm_ultimatex
I also recommend the game programmer book. Im working on the last couple chapters for reviewing concepts and it is fantastic. I suggest either OpenGl, which ive used a bit for 3d, or the SDL for making a game. I dunno which is better for 2d, but SDL comes off as a good library.
ibebrett
ibebrett
For the millionth time Python is not simpler nor are most languages in regards to C++. There is a difference between C++ being complicated (a bad thing) and complex ( a good thing).

I feel that python (and many other languages) are light years beyond C++ in sophistication. Its the idea that for some reason people think that pointer arithmetic in a language == power.

I'm not at all against C++, but if you look at some of the power Python (or ruby, or Haskell, or etc. etc.) you might feel like you are programming in the stone age.

Also, yes you can shoot yourself in the foot with C++, but you can do this in python. metaclasses, function decorators, coroutines(not really official feature, but achievable through generators) are all powerful enough to let you easily destroy yourself.

So again, I use C++ from time to time, and yes right now it is the *Fast* language , but it is not something advanced. The reason it is tricky is because there are many ways where you can get undefined behavior. Actually, the main reason is that there are so many horrid programmers who use it and do not program correctly.
MaulingMonkey
MaulingMonkey
Quote:
Original post by ibebrett
For the millionth time Python is not simpler nor are most languages in regards to C++. There is a difference between C++ being complicated (a bad thing) and complex ( a good thing).


Quote:
dictionary.com on com·pli·cat·ed:
–adjective
1. composed of elaborately interconnected parts; complex: complicated apparatus for measuring brain functions.


If I can't understand the distinction you're trying to make when armed with a dictionary, I suspect others will have problems as well. Feel free to correct my understandings bellow.

Quote:
I feel that python (and many other languages) are light years beyond C++ in sophistication. Its the idea that for some reason people think that pointer arithmetic in a language == power.

The second paragraph here is meant to give an example of the opposite view, rather than rationalize the first in and of itself, if I'm understanding this correctly?

Quote:
I'm not at all against C++, but if you look at some of the power Python (or ruby, or Haskell, or etc. etc.) you might feel like you are programming in the stone age

...when programming in C++? I read this the other way around at first, but that was confusing and made no sense.

Quote:
Also, yes you can shoot yourself in the foot with C++, but you can do this in python. metaclasses, function decorators, coroutines(not really official feature, but achievable through generators) are all powerful enough to let you easily destroy yourself.

This one's just all over the place, intentionally so this time I think. In which case, I agree, but it's worth noting that python's features are also useful for helping yourself avoid said foot shootings by writing less code, whereas C++'s are more of the performance-hungry-tyrant variety.

Quote:
So again, I use C++ from time to time, and yes right now it is the *Fast* language , but it is not something advanced.

Fast:
Could mean performance (in which case compilers can churn out some fairly decent assembly, yes, although many will be quick to point out languages in and of themselves have no intrinsic performance property)
Could mean development time (which C++ is not at all fast at)

Advance:
Could mean in terms of having advanced features (in which case, yes, C++ is not advanced)
Could mean in terms of the educational topic of C++ (in which case, no, C++ is a very advanced subject in that it is filled with gotchyas and reams of workarounds taking the form of "best practices", rules, and patterns.

Quote:
The reason it is tricky is because there are many ways where you can get undefined behavior. Actually, the main reason is that there are so many horrid programmers who use it and do not program correctly.

I blame the former more than the latter. It's the failure of the language and it's libraries to rise to meet the level of abstraction the programmers desire and should be working at.

Even good programmers get bitten by that kind of issue on occasion, although the reams of horrible programmers certainly don't help the situation.
ibebrett
ibebrett
Sorry about the rambling quality of my post - I was writing in the middle of anthropology class.

I just want to make the point that as far as language features go i consider python, ruby, and many of the functional languages, far ahead of C++. I don't want these "noob" programmers to get the idea that C++ is the next step up when you master a "beginner" language like python. There seems to be this idea on the boards (only when it comes to new comers, not in general) that C++ is this complex and hard language that is more advanced than something like Python. I would say that it is merely more complicated.

again, sorry i can't seem to write a cogent post.



MaulingMonkey
MaulingMonkey
Gotchya. C++ is typically casted as "the next step" to these newcomers because they often have preconceived notions that usually tend to involve the fact that the industry by and large is using C++. To this end, it is, if not the next step, "a future step". At least for their preconceived notions.

My own opinion is that experience with higher level languages -- especially before learning C++ -- should make their advantages in expressiveness self evident to anyone who gets that far down the programmer's path, but there's certainly no harm in pointing it out more explicitly.
ibebrett
ibebrett
Yeah your right. C++ is the industry standard for gaming, and it makes sense because of the compiled nature and speediness in general. It's just I don't want people not to learn some interesting ideas because they are not good for games.

by the way, this is going to sound dumb, but i don't really actively program games. i do a ton of programming though for fun, so my perspective is probably way off for most people on this forum.
Nightingale
Nightingale
Thanks for the replies, they really helped me out. I'm reading C++ for dummies 5th ed. which, as far as I can tell, is fairly new. If I had it on me I'd check the date for you, I'm guessing 2005 or 2006. The author didn't mention being afraid of pointers, so I'm thinking he grew to love them.

I think I'll finish this book then start on Beginning C++ Through Game Programming, which I have available to me.

Thanks again, if anyone else has some advice for me I'm all ears.

Edit: Woops, forgot to ask about SDL. I'm familiar with OpenGL and DirecX but I don't think I've heard of SDL. Could anyone give me a quick rundown? Thanks.
gharen2
gharen2
Quote:
Original post by Nightingale
Edit: Woops, forgot to ask about SDL. I'm familiar with OpenGL and DirecX but I don't think I've heard of SDL. Could anyone give me a quick rundown? Thanks.


SDL wraps platform specific capabilities in a platform independent library. It's also designed to be very simple and lightweight.

That is to say, it let's you create a window, manage events, draw to it, and a ton of other stuff, with code that will work in windows, linux, and osx (and a bunch of other platforms nobody cares about :P ).

SDL has it's own software rendering API, and can also initialise opengl for you. I always use SDL when working with opengl. Even if I don't plan to port my app to other platforms, it's just simpler to use than doing all that yourself.

edit - it's full name is Simple DirectMedia Layer, and there's a gazillion resources about it online.

Quote:
Original post by Kylotan
If you truly understand pointers then you're much further along than most beginners.


To be honest I've never understood why some people don't get pointers. Even when I initially failed to grasp c++, pointers weren't something I had a problem with. Yet it's something that many, many, new programmers struggle with.
stonemetal
stonemetal
Programming in general is complex and you only really get to the complex stuff after you learn a language. To put it in more artistic terms you want to become a great English novelist and you have just started learning English. There are many subtleties between knowing int a = 5; and the masterpiece that is a working game. If you want to work on game art why not head over to the help wanted board.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.