Sign in to follow this  
kibokun

Good open source games to learn from

Recommended Posts

I've been browsing a couple games on sourceforge to get more hands-on experience with C++. This is a big deal for me since I learn best by doing. However, some of the games I've seen have been so poorly formatted and documented that It's been really difficult to get much out of them. They haven't all been bad, and I haven't seen a ton yet, but some of what I've read has been very hard to follow. Of course, it would help if I had more experience with DirectX or OpenGL, but my biggest issues with the code were language/API agnostic... Since I don't want to learn and repeat poor habits, what open-source projects do you guys recommend? Preferably using DirectX or OpenGL. Definitely in C++ as that's what I'm trying to learn right now. Thanks for any input.

Share this post


Link to post
Share on other sites
Quote:
Original post by kibokun
I've been browsing a couple games on sourceforge to get more hands-on experience with C++. This is a big deal for me since I learn best by doing. However, some of the games I've seen have been so poorly formatted and documented that It's been really difficult to get much out of them. They haven't all been bad, and I haven't seen a ton yet, but some of what I've read has been very hard to follow.

Of course, it would help if I had more experience with DirectX or OpenGL, but my biggest issues with the code were language/API agnostic...

Since I don't want to learn and repeat poor habits, what open-source projects do you guys recommend? Preferably using DirectX or OpenGL. Definitely in C++ as that's what I'm trying to learn right now.

Thanks for any input.


I think this could be the wrong way to go about it. The only way to learn not to make mistakes is to actually MAKE them, realise what you've done and correct it. You can't learn that by looking at other people's code.

And besides, there's more than one way to skin a cat. Don't take anything you see for gospel.

I recommend doing it yourself. If it works, great, if it doesn't, fix it. If you think a function you've written could possibly be done better, do 5 minutes research and write it again. Once you've finished something you're happy with, post the code here for some constructive feedback.


Share this post


Link to post
Share on other sites
And let's not forget that your average game on sourceforge is by no means a textbook example of design and software engineering. In fact, even the commercial games which have been open-sourced (such as quake, et al) tend to be stunningly bad examples of good programming practices.

In either case, the imperative guiding the development was usually 'get it done', and as such, many, many obscure shortcuts are taken for the sake of convenience/performance, and the result makes for a very poor teaching aid.

Share this post


Link to post
Share on other sites
Learning by doing is fine, but it's also important to be able to learn by example. When you're out in the real world, your coworkers aren't going to be patient with you wanting to reimplement everything your own way just so you can learn from your own mistakes. Learn from other peoples' mistakes too. :) Contrary to what Deadstar said, this is in fact doable, but it requires understanding not just what the code does, but why it does it that way. Understand the thinking that lead someone to the right answer. Recognize why the wrong answer was wrong.

I like to think that my own project is written reasonably well; I've tried to abstain from "do what it takes to get it working" design. However, it's far, far from complete. And it's written in Python, when you said you wanted C++.

Share this post


Link to post
Share on other sites
Attempting to at least answer the OP's question.

Look here: http://www.idsoftware.com/business/techdownloads/

The 4th entry down is the entire source code for QuakeIII. Quote: "This is the combined source code for Quake III Arena and Quake III: Team Arena."

Looks like you get tools, doumentation, the whole wad! Bwha! Pun intended. Look around there and download what you think you need or want.

Now a critic could exclaim: "Wooo, that's too much for a beginner." Well, he's already stated he's looked at game code and wants more. I try to answer the question asked.

HTH and Good Luck. ;-)

Share this post


Link to post
Share on other sites
Quote:
Original post by JustBoo
Now a critic could exclaim: "Wooo, that's too much for a beginner."
I think a critic is more likely to say "Quake is know for some of the most obscure source code in the history of games", but hey [smile]

Share this post


Link to post
Share on other sites
Once again, in actually trying to answer the question...

Witness a veritable cornucopia of games! Er... well, how about a list of open-source games that ostensibly gives you the source code.

http://en.wikipedia.org/wiki/List_of_open_source_video_games

Enjoy Dammit!

Share this post


Link to post
Share on other sites
I can definitely agree that the Quake source code was difficult to follow at first. Even so, it is a commercial game and is an important resource to check out. It's probably one of the most studied open source games, so I'm sure there are resources on the web out there that describe in some detail how things are organized. Try it out, and if you run into a problem you can't figure out then post it here - I'm sure a few people around here have seen that source code before...

Share this post


Link to post
Share on other sites
I've tried to present some good programming habits in my video tutorial series, however every now and again, when I go to add something new to the engine I have two choices. The easy way is to break my coding style to get the thing working OR, rewrite a bunch of code to allow for the new feature to work properly.

Unless you can lay everything out right at the very beginning before you write a single line of code, I think you'll always run into this problem when trying to add new features that you didn't anticipate.

Just my 2 cents.

Recommendation: practice practice practice! the more you do the more you learn what is good and what is bad.

Share this post


Link to post
Share on other sites
Even if you do lay out everything at the start, you're going to find that your initial assumptions were flawed, or circumstances changed, or something else will lead you to that same situation: do it the quick way that breaks your design, or the hard way that doesn't. Having the discipline to do it the hard way is an important quality for a good programmer (and having the strength of character to let your programmers hold out for the right way is an important quality for a good manager!).

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