Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Is the full C++ source code of the Source Engine available?

I know the SDK is available with the purchase of a Source-based game, but my goal is to find a open-sourced game engine that includes its full implementation details for learning purposes.

share|improve this question

2 Answers 2

up vote 33 down vote accepted

No, it is not. You may obtain a source license from Valve, but Source itself is not open-source.


Further, it is generally a very dangerous approach to use entire existing engines as learning material without guidance from somebody who was heavily involved in the development of that engine.

Source code alone only tells you the how of particular design decisions, not the why behind most of those decisions which is often extremely important given that so many choices in software engineering are from among generally equally-valid options. You need context to understand why a choice is good, and if you just look at the source of some engine and parrot their techniques and idioms, you are hardly learning anything useful.

Further, just because code shipped a game doesn't make that code good (Source in particular is prone to lot of now very outmoded design decisions with respect to C++ and OO, for example). There are plenty of horror stories dwelling in the engine codebases of even the most successful AAA titles. And as an impressionable neophyte, how are you going to be able to tell the good code from the bad?

Be very careful using source code as a learning resource, and make sure to pair it with as much supplementary information as you can.

share|improve this answer
    
I know I am digressing by asking but can you link me to a question here or tell me a open-source game engine? –  BDillan Jan 29 at 3:03
3  
No, I cannot. You can trivially search the internet for that sort of thing and it is off-topic for this question and this site. –  Josh Petrie Jan 29 at 3:04
3  
"Source code alone only tells you the how of particular design decisions, not the why behind most of those decisions which is often extremely important given that so many choices in software engineering are from among generally equally-valid options. " I think this is my answer. –  BDillan Jan 29 at 3:10
    
@BDillan indeed, some people learn that the hard way.. although companies will hire you to work with huge piles of engine code you don't understand and don't have the time to and end up just debugging. –  teodron Jan 29 at 13:01
    
Note that ID software have made several of their engines available: github.com/id-Software –  pjc50 Jan 29 at 17:30

tl;dr: Learning how to make an engine is often as useful to game making as learning to build your own computer and operating system from scratch. If you not an expert in the field, you probably do not want to make an engine. Make a game instead, the engine part already exists. Later on if none of the engines you have access to meet the criteria for your game design, you could focus on building that specific aspect and hell it might be useful to others as well since you are creating something new and not rehashing a less robust version of something that people already invested thousands of hours in.

Long version: If you really want to learn how to write an engine, don't look at an existing engine yet. Learn instead of the parts (algorithms) that make an engine, be it rendering, physics or path finding etc. Once you gain a deep understanding of a specific aspect, you may want to check out source.

You normally do not wish to learn directly from source unless there is no superior alternative. Even experienced programmers normally would not look at the source of an entire engine to learn from it (if they can help it), they would most likely inspect a specific part of it or tweak a certain part of it. Trying to look at the source for pure learning purpose would not expose the procedure and thought process behind the engine code; That would be like tearing a building apart ti pieces in an attempt to see its insides in order to learn how to build one. While I agree with Josh's answer, I will take it another step further, you do not even learn the "How" in many senses (unless you are familiar with the field); for instance, what methodology was used by the programming team? What principles did they rely on to implement working code? What tools and techniques did they use for debugging? All these questions are sometimes more important than the code itself (for learning purposes).

If you do wish to learn from source, look for source that is well documented and has a strong community built around it. Reading (engine) code, even if you've written it yourself, is often confusing.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.