Page 1 of 5

serious this time

Posted: Mon Mar 01, 2004 5:32 am
by Joey
ok, now i am serious. i think i can scrounge up some free time to learn a language. everyday after school, ill do my homework, and then get right to studying a language for atleast an hour. but let me know if C++ is the right decision. i have done a lot of AGI programming, and I hear that is like c++. i have about 4 books on c++. do you think i should learn c++ or atleast give it a shot? i want to learn it now so when summer vacation comes i can start working on a game i could sell eventually. i have a game programming book that uses c++, so should i use that? i tend to learn a language easier if i am making something i would enjoy (games). thats how i learned agi. i changed others games and thats how i learned. but let me know what you think. i really want to learn c++, and i have plenty of c++ books to help me along the way. what do you think (i know ive posted stuff like this 80 times but im serious now and i want to learn this)

Re:serious this time

Posted: Mon Mar 01, 2004 6:37 am
by Schol-R-LEA
Well, you already know my opinion on this: that you could learn both programming and game design easier in Python first. BTW, did you ever get to take a look Pygame.org? It had some decent example material, IIRC.

As a beginner, the biggest advantage with C or C++ is that there is a lot of gaming related resources for them; most of the material at sites like gametutorials.com assume C++. The problem is, to get the advantages of C++ as a game programmer, you have to know most of the language pretty well already, and C++ is not a very easy language to learn. If you do decide to jump right into C++, I would mention that unless you already have a full, legal copy of VC++, then you should save your money by downloading Dev-C++ instead. In fact, you may want to get it even if you have VC++, as the two are rather different and you may prefer Dev-C++. Also, gametutorials.com has tutorials on learn C and C++, and covers the range from simple text games, to board games (tic-tac-toe, othello, chess), and so on up to full-blown 3D FPS and RTS games. The tutorials are often quite sketchy, however, and often hard to follow - you'll definitely want a book or three to suplement them.

Java might be a suitable compromise, as there is a fair amount of Java game programming information around and is a somewhat easier language to learn than C++. However, it is still a much more difficult language to learn than Python, and it is enough like C++ that trying to learn C++ from a Java background could be confusing.

Under other circumstances I would recommend learning Scheme, and in fact I still think it would be worth your trouble; it shouldn't take more than a few days to learn the basics of the language. Take a look at the tutorial I wrote and it should be pretty clear (I hope; it's not the greatest tutorial in the world). The downside is that there is relatively little gaming related material for Lisp family languages, though a handful of popular games, including the Crash Bandicoot series, have been written in at least partly in Common Lisp. If you want to get into game AI or really complex simulations in a big way, you might want to look at the essay "Thoughts about Game & Simulation Programming Architecture" by Stover. It is also, I might add, a great language for text-based games, and several MUDs have been written using it.

Some gaming related reference material I've found:
Pygame.org
Java Game Development Tutorial
gametutorials.com
2D Game Tutorial
Burfman - a small game tutorial in C and assembly (never seems to have been finished, though)
Game-AI
Gamasutra
gamedev.net
Digital Game Developer
East Coast Games
Flipcode
AI Guru (has a section on gamebot design)

Re:serious this time

Posted: Mon Mar 01, 2004 8:07 am
by CESS.tk
An alternative to Java might be http://processing.org/
I've heard some pretty good things about it, and it should be easier to learn.

Here's a simple game written in processing:
http://www.hardcorepawn.com/zombie3/
(based on http://kevan.org/proce55ing/zombies/ )

Re:serious this time

Posted: Mon Mar 01, 2004 9:01 am
by Kon-Tiki
Wolf 3D source code
Doom I source code
Quake I source code
Duke Nukem 3D source code

Once you have a decent understanding of C++, these ought to help you along the way of making games.

Re:serious this time

Posted: Mon Mar 01, 2004 1:28 pm
by ark
Although I don't see anything wrong with learning C++ as a first language -- in theory -- it may not be the best place to start.

AGI programming is "like" C++ programming in the same way that algebra is "like" calculus. The same concepts may apply in many instances, and certain parts of the two may look the same, but calculus is quite a bit more advanced than algebra and thus more difficult to learn.

The biggest problem with choosing C++ as a first language is that I have never seen a book that teaches C++ the way it should be taught. I have never seen a book or resource that starts you out using the STL, for example.

Most C++ books try to teach you how to program in C and then jump to C++, which isn't a very good way to learn, because the new C++ stuff is supposed to eliminate a lot of the headaches with the C part of the language. And a lot of books have their concepts of "advanced" topics backwards, putting pointers (which take most people quite a while to get comfortable with) within the first few chapters and putting concepts such as templates and namespaces (which can be explained in five minutes, once you have a very basic understanding of the language) way in the back.

The result is that most people who learn C++ don't learn to use it properly, and they don't take advantage of some of the things that C++ does to make your life easier.

Add on top of that the fact that so many books teach you to do bad things like put "using namespace std" at the top of every program, and what you've got is a language that in the end shouldn't be as hard to learn as it usually is because most of the resources on it suck.

Re:serious this time

Posted: Mon Mar 01, 2004 1:36 pm
by ark
Also, on learning from a game programming book: while I understand that you probably do want to work on something interesting and not stupid example programs, the game programming books I've seen aren't exactly good examples of good programming style.

I put a lot of emphasis on programming style because ultimately a good coding style makes it easier to write and modify programs.

Re:serious this time

Posted: Mon Mar 01, 2004 1:51 pm
by Joey
let me just clear everything up first. i quickly typed the above before i left for school this morning so i couldnt cover everything.


i have atleast 4 books on c++, 1 which is about game programming. i want to spend from this time, until late june LEARNING c++. in late june, summer vacation will have started, and i will have more time to work on things, and then i want to start working on a game i could sell. in the meantime that i am learning it, maybe i will mess around and write little text games to hone my skills. i know a little bit of c++ already, and i have done a lot of AGI programming,
which people say is like C++. i understand it will be hard, but i want to put my mind to it and work hard.

let me know what you suggest.

also, Schol-R-Lea, is that Dev-C++ a free compiler that could be used for distribution of programs? i have VC++ starter edition, and you cannot distribute games with it.

one more thing. i did some work with the Wolf 3D source. a while ago i used some tutorials for making new guns and stuff. i dont really remember too much from it, but im sure i could dig it up again and learn from it. the first game that i eventually make and that i will want to distribute, is an RPG like castle of the winds, OR a platform game, somewhat like mario.

thanks for the help everyone.

Re:serious this time

Posted: Tue Mar 02, 2004 12:07 am
by ark
You should be able to distribute the programs you write with Dev-C++. I don't know if you can sell them. Read the license agreement. Dev-C++ isn't actually a compiler -- it uses free compilers like mingw (i think). Dev-C++ itself is the IDE.

Re:serious this time

Posted: Tue Mar 02, 2004 2:39 am
by Schol-R-LEA
Dev-C++ is mostly used as a front end for the MinGW port of GCC, so it all depends on your interpretation of the General Public License, Version 2.0, and what it implies concerning programs generated by GPL'ed tools.

There is no question you could distribute programs compiled with GCC under the GPL - that's the whole point of the license in the first place. It is generally agreed that you can distribute programs compiled with it under other 'open' licenses such as the Artistic License or the FreeBSD License, with the appropriate covenants for the part of the code covered by the GPL or LGPL. The question is whether you can produce a commercial program with GCC without violating the GPL.

Part of the question has to do with the use of the GCC version of the C standard library, the source code for which is all covered by the GPL. The other part of it is whether code generated by a GPLed program is itself automatically under the GPL.

While the issue is subject to debate, it is generally agreed that the answer to the latter is no; while the earlier version of the General Public License had a lot of ambiguities on the subject, version 2.0 was rewritten to be more specific (with little success). Regarding the former issue, the Library General Public License was particularly devised to allow library use in non-GPL programs. A number of commercial programs have in fact been written using GCC and other programs covered by the GPL; most simply include as part of their own license a notice that part of the code is covered by the GPL, and include a copy of the GPL and the library code used with the distribution.

Nonetheless, the reputation of the GPL as the 'General Public Virus' still remains; the fact that there has never been a serious legal challenge either defending or quetioning the GPL has left the issue hanging fire. Many programmers prefer to avoid using GPLed source code for this reason; this is the purpose behind the PDCL, for example.

If you mean to eventually start writing commercial code with Dev-C++, you may want to filter the license through your legal counsel and see it panic()s. :) In the meanwhile, I'm sure that Solar can fill you in on the 'con' side of the argument if you ask; he has studied the issue more than I have.

Re:serious this time

Posted: Tue Mar 02, 2004 5:37 am
by Joey
Or I could just buy VC++ Professional Edition for about $200! ;) IF I ever get really good at C++, to the point where I could make the kind of game I want, I will look into selling it, and maybe purchase a better program like the VC++ Pro Edition.

Also, do you think I should start off with the Game Programming book I have, or with Learn C++ Today! ?

Re:serious this time

Posted: Tue Mar 02, 2004 6:11 am
by Candy
Joey wrote: ... and maybe purchase a better program like the VC++ Pro Edition.
Uhm... quality of programs is, at least at this moment, usually inversely proportional to its cost. Free programs are usually better than commercial software. At least, have had more eyes upon them.

As an aside, you really do NOT need commercial software for gamedev in c++ on windows. Try dev-c++, allegro and allegro3d, and make your own DX direct3d games (ugh for me) in windows, without anything commercial. And even that doesn't require you to GPL or be free (see also Tuxracer).

Re:serious this time

Posted: Tue Mar 02, 2004 8:45 am
by Nychold
Don't bother with MSVC...seriously. Dev-C++ is a perfectly fine IDE, though I rather prefer Borland C++ Builder X, myself. It has some hefty processing requirements (like 256 MB RAM, minimum), but it's totally cross platform. The IDE is written in Java, so you can run the program on Linux, Windows, OS/2, MacOS, etc. (Well, very nearly anyway...^^) Plus, it has one of the best looking syntax highlighters I've seen in a while (blows MS's away.) Plus, Borland C++ Builder X can use more than one kind of compiler, and ships standard with Borland C++ 5.6 and GCC, so there aren't many limitations on distribution.

</sales-pitch>
Still, use whatever feels most natural to you, and worry about the distribution rights later. If all you're doing is learning C++, any C++ compiler will work.

Re:serious this time

Posted: Tue Mar 02, 2004 3:36 pm
by Schol-R-LEA
One minor piece of advice with Dev-C++: when running a console program from the menu (Execute:Run and suchlike), Dev-C++ does not automatically pause the console when the program quits the way VC++ and some other IDEs do. As a result, the last few lines of output may disappear before you've read them. To get around this, I usually insert a [tt]getchar()[/tt] call at the end of the program, which will cause it to wait until you hit Enter:

Code: Select all


main()
{

 /* ... your program here */

 puts("Hit enter to continue...");
 getchar();  /* waits for a line of input */
}
BTW, if anyone knows an option to change this so this wouldn't be necessary, please let me know. I've around the options settings and havien't found anything for it. It is something of an annoyance and I'd like to change it if I can.

Re:serious this time

Posted: Tue Mar 02, 2004 3:50 pm
by Therx
haven't used the IDE but surely you'd have to just add those two lines to the stem which calls main in the clib and recompile it?

Pete

Re:serious this time

Posted: Tue Mar 02, 2004 8:22 pm
by Schol-R-LEA
Well, that could be done, but the problem is that you don't want that added to finished code, or to non-console programs.