2 Responses to “Is the source code of the Source Engine available?”

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.

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.