Sign in to follow this  
Kaanin25

Open source code for a beginner

Recommended Posts

Kaanin25    129
I have a firm understanding of C++ beyond the beginner stuff; I know classes, polymorphism, templates, ect... What I am looking for is some example source code that is properly written to look at. Something small and simple like Tetris or Snake, not huge like the Doom 3 source code.

I found this on LazyFoo's website. [url="http://lazyfoo.net/games/LazyBlocks/index.php"]http://lazyfoo.net/g...locks/index.php[/url] and it's working code, but there are a lot of global variables, C style functions that should be part of a class object, and so forth. I'm not bashing his code, Ive written far worse myself.

[b]I don't need perfect[/b], I just need something with a good format as a reference. Something I can use whenever I hit a roadblock to look and see "how they did it".

Anyone know of or have any open source game code I can look at? Edited by Kaanin25

Share this post


Link to post
Share on other sites
I found [url="http://code.google.com/p/ovgl/"]this open source project[/url] a long time ago through these forums. Although, the developer has not been quite as active lately and the code is a bit of a mess, it has given me some insight into how to design my engine. Personally, It was easier for me to understand than the source code for id Tech 3.

Share this post


Link to post
Share on other sites
marvel_magnum    333
[b]The Secret Mantra[/b]
[quote name='Lazy Foo' timestamp='1339086427' post='4947086']
You want to know the best way to learn design? ... go out and get your hands dirty.
[/quote]

Super awesome LazyFoo! Love ya!

Share this post


Link to post
Share on other sites
DejaimeNeto    4221
Try checking [i]Allegro SpeedHack[/i], it's an allegro "contest" where people make simple games in a short time stamp (not like in hours, but still not years). The games' sources are available (or were). Worth checking!

Link [url="http://www.speedhack.allegro.cc/"]speedhack.allegro.cc[/url]

Share this post


Link to post
Share on other sites
Serapth    6671
[url="http://www.gamefromscratch.com/page/Game-From-Scratch-CPP-Edition.aspx"]This seems to be[/url] exactly what you are looking for. Also, keep in mind, it is ONE way to do things, and it favors readability over performance, but it goes beyond the level of polish of most demos/tutorials.

Share this post


Link to post
Share on other sites
Serapth    6671
[quote name='Lazy Foo' timestamp='1339086427' post='4947086']
You want to know the best way to learn design? Stop going around to other people's projects hoping you'll find some magical piece of wisdom and go out and get your hands dirty.
[/quote]


I agree and disagree with this. The best way to learn just about anything is by doing it, jumping in and getting your hands dirty.

That said, you can learn an absolute ton about design from other people. Past mentors, reading other peoples code, books. There have been some books that had a profound effect on my code, Effective C++, Code Complete, JavaScript:The Good Parts, Refactoring, Design Patterns to name but a few.

You jump right in to learn how to make shitty code; you read books, blog posts and talk to other developers to learn how to make it better.

Share this post


Link to post
Share on other sites
Kaanin25    129
[quote name='Lazy Foo' timestamp='1339086427' post='4947086']
Notice how I very specifically noted that that the source for the game is how not to to make game, in bold and capslock so you know I'm serious. [img]http://www.gamedev.net/public/style_emoticons/default/smile.png[/img]
[/quote]

Notice how I very specifically noted that I was not bashing your code...I understand it was a tutorial designed with the intent to show beginners how to handle the SDL library and setup a very simple game; and for that purpose you did a fantastic job, your tutorial has been very sucessfull and I myself thank you for making it.

[quote name='Lazy Foo' timestamp='1339086427' post='4947086']
You want to know the best way to learn design? Stop going around to other people's projects hoping you'll find some magical piece of wisdom and go out and get your hands dirty.
[/quote]

So you just assume that im sitting around all day just parusing through other people's code without writing any of my own? That I havn't already gotten "my hands dirty". I have been writing code on and off for some time now; I have a few past projects under my belt. I am not an infinite pool of resources unto myself and when I lack the skill and knowlege to solve a problem I seek out others who are better then me for answers.

In my particular case I had a [url="http://www.gamedev.net/topic/626312-best-way-to-design-an-object-list/"]problem[/url] with the game I am developing right now and all the solutions I had come up with on my own have been unsatisfactory. I thought maybe I could get a look at few other open source projects made by better programmers to see how they did it.

learning by example is a very valid form of education. If you don't want to help that is fine, then dont post, but please don't berate me as if im not trying.
Sorry if that was a bit of a rant, but it really upset me. I came looking for help.

Thank you very much for the resources Serapth, EnigmaticProgrammer, and Dejaime. Edited by Kaanin25

Share this post


Link to post
Share on other sites
sednihp    241
I've put up some of my games over [url="http://sednihp.wordpress.com/downloads"]on my blog[/url] if you want some small SDL games to look at. They're nothing amazing (Pong, breakout, space invaders, bomber run clones) but they might give you something to peruse...

I will say, I've only been at this for 4-5 months so I'm no expert, but I'm pretty happy with my code. Edited by sednihp

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