{{Software Infobox
|developer=Valve Corporation
|programming language=WikipediaC++|C++
|operating system=*WikipediaMicrosoft Windows|Windows
*WikipediaXbox 360|Xbox 360
*WikipediaPlayStation 3|PlayStation 3
*WikipediaAndroid (operating system)|Android
|license=Wikipediaproprietary software|Proprietary

The '''Source''' engine is a game engine developed by Valve Corporation. Its unique features include a large degree of mod-ability, flexibility, an artist-driven, shader-based renderer, industry-leading lip-sync and facial expression technology, and a powerful, efficient, and completely network-enabled physics system.

Source supports both 32-bit and 64-bit environments and the Microsoft Windows, macOS, Linux, Android, Xbox, Xbox 360, and PlayStation 3 platforms. The Source engine debuted in October 2004http// Source engine Official website. with ''Half-Life 2'' and ''wccounterstrikeCounter-Strike Source|Counter-Strike Source''. Since its release it has been heavily modernized by Valve, with the "Orange Box Update", when the aging Source engine was updated with new features for the release of ''Half-Life 2 Episode Two'', ''Team Fortress 2'' and ''Portal''. 

==Technology overview==
FileEp1 citadel 000022.jpg|250px|right|thumb|A ''Half-Life 2 Episode One'' scene running on the Source engine, demonstrating high dynamic range, rim lighting, phong shading, facial expressions, and realtime cameras.

''For a full overview, see http// Source Engine Features on the Valve Developer Community Wiki.''

WikipediaDirect X|DirectX 9 with WikipediaHigh Level Shader Language|Shader Model 3.0, WikipediaOpenGL|OpenGL, WikipediaOpenGL ES|OpenGL ES
3D skybox; an area can be displayed as a skybox at up to 16x its actual size with full 3D parallax.
High dynamic range rendering
Any animation can merge seamlessly with any other animation at any time.
WikipediaInverse kinematics|Inverse kinematics to ensure that characters' limbs react to environments.
;Networked physics
Originate from WikipediaHavok (software)|Havok 2 physics engine
Highly-tuned by Valve
Software only
Fully networked with low bandwidth requirements
Vehicle physics including torque, power, gears, tire material, suspension and mode.
Full WikipediaDigital signal processor|DSP system
Full surround sound support
Software only
Low and high frequency components merged depending on surrounding area and relative position of origin.
Supports DirectX 6 and upwards{{cite web|url=http//|title=DirectX Versions|work=Valve Developer Community|accessdate=9 July 2006}}
Modularity allows for all current and future Source projects to scale back to DirectX 6 if they desire.
;Facial expressions
Full range of human and non-human facial movements
Based on WikipediaPaul Ekman|Professor Paul Ekman's WikipediaFacial Action Coding System|Facial Action Coding System
Over eighty-four "digital muscles"
Works in tandem with facial expressions
Auto-generated, but completely configurable
Stored in sound file itself for localization

==Modularity and notable upgrades==
Source is designed from the ground up to be highly modular. This allows for the easy upgrade and modification of certain features without breaking other areas of the engine, or breaking engine continuity (that is to say, there need be no 'version jumps' from 1.0 to 2.0). When coupled with ''Steam'', these updates can be distributed retroactively and automatically. For instance, if Source is upgraded to support hardware physics, every Source title on Steam will instantly benefit. Entirely new features such as High Dynamic Range (HDR) Rendering have been shown to require developer input, however.

===High dynamic range rendering===
First seen in ''Day of Defeat Source'', then shortly after in ''Half-Life 2 Lost Coast'', HDR was the first major instance of Source's modularity in use. However, whilst in theory all Source engine games and mods were able to use HDR immediately after its release, the game code required to 'hook in' to the new system was not made available to modders until eleven months later, on August 4, 2006. Official licensees and Valve themselves have all made use of the technology since its release.

===Facial animation 2===
FileFacial anim ep2.jpg|thumb|200px|Alyx Vance animated with the Source engine's facial animation system, here in ''Episode Two''.

When ''Half-Life 2 Episode One'' was released on 1 June 2006, it introduced the second version of Valve's proprietary facial animation system. Ken Birdwell explains the upgrade's features in the game's commentary track

''"When we designed the Half-Life 2 facial system back in 2000, our goal was to get a natural-looking performance at a moderate distance. For Episode One, we wanted to extend the characters' facial systems to support more intense performances with a wider range of facial expressions, that would hold up better at close range. These facial improvements included increasing the detail around the eyes and mouth, increasing the number of facial shape targets – think of these as movements of muscle groups – by about 50%, rewriting the rules that control how these shapes blend, and increasing the intensity of many of our existing shapes."''

===Dynamic lighting and shadowing 2===

A new dynamic lighting and shadow mapping system was released for Source, replacing the somewhat limp existing system.{{cite web | url=http// | title=New technology for EP2 | }}{{cite web|url=http//|work=GameSpot|title=Half-Life 2 Episode Two Impressions|date=24 August 2006|accessdate=24 August 2006}} It launched with the various other new Source features with ''Half-Life 2 Episode Two''.

{| class="wikitable"
|+ Lighting and Shadowing system comparison
! Current Lighting and Shadowing System
! Dynamic Lighting and Shadowing 2
| Dynamic shadows in a map always come from the same predetermined direction.
| Dynamic shadows in a map always react dynamically to every light source.
| Models do not self-shadow or cast shadows onto other objects.
| Models can self-shadow and cast shadows onto the world and other objects. 
| Dynamic shadows do not blend with lightmapped shadows and cast through all objects except world geometry.
| Dynamic shadows are more unified with static shadows and don't cast through models. 
| Every object is allowed only one dynamic shadow.
| Any object can cast multiple dynamic soft shadows. 
| The player's flashlight merely illuminates an area.
| The player's flashlight casts shadows from models and world geometry.

===Next-gen renderer===
An upgraded rendering path is in development for future Source engine games on PC, Xbox 360,{{cite web | url=http// | title=Valve Half-Life 2 Episode One Interview | }} and presumably PlayStation 3. For PC, the new renderer has been confirmed to support DirectX 10.{{cite web | url=http// | title=Team Fortress 2 Hands-On Preview | | date=28 March 2007 | accessdate=2007-04-01 }}

===Landscape and Flora Rendering===

FileHl2ep2 gorge.jpg|thumb|200px|right|An open gorge environment in ''Half-Life 2 Episode Two''

Large, open natural environments with heavy foliage, traditionally a weakness for the Source engine, have been supported as of ''Half-Life 2 Episode Two''. The updates were also made available for MOD teams to use shortly after the release.

===Soft-Particle system===

During the July 2006 Electronic Arts Summer Showcase press conference, Gabe Newell mentioned that a new soft-particle system would be introduced into the Source Engine in the upcoming title ''Half-Life 2 Episode Two''. It was first demonstrated in the July 19 ''Team Fortress 2'' teaser, which showed a remarkably realistic flamethrower in its closing moments.

===Cinematic physics===
FileHl2ep2 cinematicphysicsshack.jpg|thumb|200px|Cinematic Physics oversees the destruction of a two-story forest shack

During the July 2006 Electronic Arts Summer Showcase press conference, it was revealed that former Weta Digital employee Gray Horsfield, special effects destruction lead on ''The Return of the King'' and ''King Kong'' among other roles, was building a "Cinematic Physics" system for Source. GameSpy described the new system in their conference report

''"The idea behind this is to give players the opportunity to experience in-game physics in action on a grander scale. As an example of Cinematic Physics in action, a clip from Half-Life 2 Episode Two was shown of a huge bridge collapsing across a vast ravine."''

The system adds the following features to Source's physics simulator

*Deforming objects — before, physics models could not be modified except through animation
*Dynamic crumbling of brush geometry — before, lines of separation had to be specified by the mapper

Cinematic Physics supports a keyframe system,{{cite web|url=http//||title=Half-Life 2 Episode Two Update|date=July 13, 2006|accessdate=22 July 2006}} but its exact nature is currently unclear. It could be that an animator creates a largely complete but low-detail sequence which then sees details added by the physics system, or it could be that an animator creates a handful of single-frame states which are then used as motion targets for the ensuing simulation (in a manner not dissimilar to the Endorphin NaturalMotion technology).

Either method results in a drastic reduction of developer input, thus allowing the creation of far more complex scenes than before with the same budget. It is currently unclear both whether or not keyframes are strictly required, and what number are needed to create a scene as complex as the bridge collapse demonstration.

===Multiprocessor optimizations===

As a part of the Source engine's transition to next-generation consoles, multiprocessor optimizations have been added, resulting in faster processing on PC hardware with dual or quad core systems and the Xbox 360 and PlayStation 3 consoles. Gabe Newell

"Yes. We definitely think that content needs to move forward. For example, one of the things we're reacting to is the speed at which microprocessors are coming out. So, Intel has very aggressively moved up delivery of desktop processors with four different cores; we'll have support for that in Episode Two, and we'll definitely go back to affect, Episode One or Half-Life 2 or Counter-Strike Source, so they can take advantage of that. We'll definitely try to keep the existing games - especially the multiplayer games - current as technology evolves.{{cite web|url=http//|title=Interview Gabe Newell|accessdate=2006-09-20|publisher=PC Zone|date=2006-09-11}}"

Valve has demonstrated the new multi core optimizations{{cite web|url=
http//|title=Multi-Core in the Source Engine Core|accessdate=2006-11-2|publisher=Bit-tech|date=2006-11-2}} which use a multi-threading style they dub "hybrid threading." A Source multi-threading update and benchmark are expected to be released before Half-Life 2 Episode Two, though a date for either and the content of the benchmark are currently unknown.{{cite web|url=http//,1697,2050561,00.asp|title=Valve Loves Quad Core|accessdate=2006-11-2|publisher=ExtremeTech|date=2006-11-2}}

===Unconfirmed future technology===
====Cinematic effects====
FileDoD source film effects.jpg|250px|right|thumb|Cinematic effects including depth of field, motion blur and film grain are demonstrated in this video capture

With color correction and film grain already released,{{cite web |url=http//|title=Day Of Defeat Source Summer Update Coming June 28|work=Steam News}} Valve intends to add other cinematic effects such as motion blur and depth of field to Source when hardware is able to render it to their satisfaction. The effects are accomplished with an accumulation buffer for quality, creating enormous overhead; for instance, twenty to thirty motion blur frames need to be rendered for every one frame that the user sees. For a constant frame rate of thirty frames per second, a video card is required to produce between six hundred and nine hundred frames per second. This causes late 2005-era hardware to require a full two seconds to render each frame.{{cite web|url=http//|title=Cinematic Effects in Source||date=December 9, 2005|accessdate=19 July 2006}}

Motion blur and depth of field can be seen in several of Valve's promotional videos, including

* The ''Day of Defeat Source'' video http// ''Prelude to Victory''
* The initial ''Portal'' http// trailer.

====Image-Based Rendering====
Image-Based Rendering is a technique in which 2D elements are manipulated to appear in a 3D world. In the context of a 3D game, it delivers a significant performance boost by replacing 3D geometry that is far enough away for the transition to be imperceptible with a 2D image. Implementation of the technology in this role can be found applied to Rome Total War's soldiers, Far Cry's forests,Eike Umlauf (24 August 2004) (PDF). Image-Based Rendering of Forests. VRVis. http// Retrieved on 21 August 2006. and various objects in Guild Wars' environments, such as buildings and flora.

The technology had been in development for ''Half-Life 2'', as a 2003 interview with shows,{{cite web | url=http// | title=Interview with Gabe Newell | }} but was cut. It was mentioned again by Gabe Newell during 1UP's 'Valve week'{{cite web|url=http//||title=Valve Week|accessdate=14 July 2006}}

''"There's this technology that was really exciting that I’d like to see us get into production, which is a different approach to rendering complexity Moving things into and out of an image domain and then seamlessly interpolating between those motions as the player moves around. So that everything close to the player is physical and geometry, and everything really far away from the player is an image, but the player has no way of telling that if the player does it properly and things can fly out and come back."''

The June 2006 Day of Defeat Source update included an "image-based texture blending shader",{{cite web|url=http//|work=Steam news|title=Day of Defeat Source Update Released|accessdate=14 July 2006}} and Half-Life 2 Episode Two's expansive environments seem ideally suited to the technology, but it has yet to be dated or even officially announced.

====File streaming====
One of the technologies developed for Half-Life 2's Xbox release was file streaming, wherein a map's resources could be loaded as the player moved around in it rather than in one operation before playability.{{cite web|url=http//|title=Info received from valve| forums}} With the system in place, loading times were reduced to as little as fifteen seconds. The system expanded on the caching system already implemented. There is no time frame for its release, as implementing such a system on the potentially infinite variations of PC hardware setups in use poses serious performance problems (see Stutter section).

Although Valve has explicitly stated that the Source engine has been built internally from the ground up, rumors and myths persist that it is instead merely derived from the original Quake codebase via Valve's GoldSrc offshoot. The primary reasons for this are the manner in which the engine uses similar development interfaces to GoldSrc (to aid transitioning developers), and John Carmack's comment on his blog that "there are still bits of early Quake code in Half-Life 2",{{cite web|url=http//|accessdate=2004-12-31|work=John Carmack's Blog|title=Welcome, Q3 source, Graphics}} expanded through hearsay to be a confirmation that large swathes of code are identical, when no such conclusion can be drawn from the statement. There remains no solid proof that Source is derived from the GoldSrc codebase — and indeed, given the fact that the 2003 code leak did not produce any such claims it can only be assumed that no incriminating evidence was to be found.

However, it is known that Source was developed part-by-part, slowly replacing the GoldSrc engine in Valve's internal projects.''Half-Life 2 Raising the Bar'' This explains its modular nature, and suggests that, even if Source was not derived from GoldSrc, GoldSrc was at the very least modified to plug into it during development.

==Common issues==
The Source Engine uses a caching system, whereby the loading of certain resources is handled and managed on the fly, rather than in a single operation behind a traditional loading screen. Texture and sound data are the primary areas in which this occurs. Textures are loaded to memory but only moved to the system's video card when needed and audio files are loaded with an unusual "soundcache" system only the first 0.125 seconds of each file are pre-cached, and the clip is used to cover the asynchronous buffering of the full sound file in the background when it is first requested.

Both systems keep data in the heap until there is no more room and older resources are flushed out, and when either is held up or otherwise slowed down the engine will either freeze or go into a temporary loop until the data arrives. 'Stuttering', or 'hitching' as it is sometimes known, is the result of these pauses.

While stutter can be caused by poor system performance, it has also been noted on hardware setups that should be more than powerful enough to cope with the data rate, and despite many theories, the precise cause remains unknown to the public even over two years since the engine's debut. Most solutions that have been found involve bypassing the caching system, as it cannot be directly disabled, or system-specific optimizations (e.g. driver updates).

When ''Half-Life 2'' was first released and stuttering became a widely-known problem, community member Mark McWilliams set up a page covering the issue and Valve's communication and work on resolving it.{{cite web | url=http// | accessdate=2004-11-20 | title=The Half-Life 2 Stuttering Problem}} Several updates were released by Valve, the effects of which varied from complete fixes for some users to previously smooth systems becoming "infected" with the problem.

*http// Example (.WMV), showing a relatively low level of stutter. The hitches coincide with the drawing of new areas (a process that is by design not visible without debugging tools).

More recently (February 7, 2006), changes to the Source engine were introduced alongside a beta test of Steam's Friends chat service, with the aim of 'narrowing down' the problem.{{cite web | url=http// | accessdate=2006-02-07 | work=Valve Developer Community | title=Friends Beta}} The update featured a limited implementation of Source's file streaming system (see above). Generally, the response was very positive.

In a recent Source game, Left 4 Dead 2, this has been resolved. Instead of stuttering, the sounds will simply just stop.

===Looping audio===
The Source Engine suffers from an error whereby the asynchronous loading (see Stutter, above) of a new sound file will cause the engine to lock up with looping audio. Because of the nature of DirectX, once the engine enters such a state it will remain on the screen unless the user can blindly terminate the program, or reboot their computer. The error occurs in a standard Windows library associated with on-board sound cards, and in some cases can be resolved by decreasing DirectSound Acceleration.{{cite web | url=http// | accessdate=2006-05-26 | work=Steam Support | title=Problem Games freeze or crash with looping sounds}}

Reports of looping audio crashes increased around the release of Episode One. While it is likely that the spike was simply because there was an unusually high number of people playing the game, changes to the engine, of which there were many for the game, cannot be ruled out. It has been noted that people who have been able to play Half-Life 2 without any crashes and audio errors in fact do find Episode 1 to be more prone to that problem.  A forum thread is dedicated to discussing the problem and attempting to work out solutions, although the experience of the thread contributors indicates that most suggested workarounds and fixes do not remedy the problem.{{cite web | url=http// | forums | title=Ep 1 - Looping Sound Crash Discussion}}

==Valve Developer Community==
On 28 June 2005, Valve opened the http// Valve Developer Community Wiki. The VDC replaced the previously available http// Source SDK documentation with a full MediaWiki-powered community site. Within a matter of days Valve reported that "the number of useful articles had nearly doubled". These new articles covered the previously undocumented ''Counter-Strike Source'' bot (added by the bot's author, Mike Booth) and ''Half-Life 2'' AI, source control for Source engine mods, and more.

==Licensed Source games==

*''wcalienswarmAlien Swarm Source|Alien Swarm''
*''wccounterstrikeCounter-Strike Source|Counter-Strike Source''
*''wccounterstrikeCounter-Strike Global Offensive|Counter-Strike Global Offensive''
*''WikipediaDay of Defeat Source|Day of Defeat Source''
*''wikipediaDota 2|Dota 2''
*''Half-Life Source''
*''Half-Life 2''
*''Half-Life 2 Deathmatch''
*''Half-Life 2'' episodic series (''Half-Life 2 Episode One|Episode One'' and ''Half-Life 2 Episode Two|Episode Two'')
*''Half-Life 2 Lost Coast''
*''wcleft4deadLeft 4 Dead|Left 4 Dead''{{cite web|url=http// | accessdate=2006-11-20 | work=Voodoo Extreme | title=Left 4 Dead Announced}}
*''wcleft4deadLeft 4 Dead 2|Left 4 Dead 2''
*''Portal 2''
*''http// Team Fortress 2''

;Other developers
*''The Crossing''{{cite web|url=http// | accessdate=2006-12-23 | | title=The Crossing Revealed}}
*''Dark Messiah of Might and  Magic''
*''http// Deep 6''
*''The History Channel's ShootOut! The Game''
*''Kuma\War 2''
*''http// Natural Selection 2'' (No longer using Source engine)
*''Postal 3'' (PC, PS3 and Xbox 360){{cite web|url=http// | accessdate=2006-10-18 | work=Firing Squad | title=Postal 3 Officially Announced}}
*''SiN Episodes''
*''The Ship''
*''They Hunger Lost Souls''
*''Twilight War After the Fall'' (production resumed)
*''Vampire The Masquerade - Bloodlines''
*''Mabinogi Heroes''http// Mabinogi Heroes on http// MMO Hut
*Untitled Threewave Software game{{cite web|url=http// | accessdate = 2006-09-16 | work=Gamasutra | title = First-Person Advertiser - Talking In-Game Ads With Threewave Software }}
*''Zeno Clash''


==External links==
*http// Valve's Source licensing site
*{{VDC|Source_Engine_Features|Source Engine Features}}
*{{VDC|Main_Page|Valve Developer Community Main Page}}
*http// GameSpy "Original Half-Life to be Released in Source Engine"
*http// Half-Life 2's comprehensive "Source  Belly of the Beast" article
*http// Source Engine details
*http//'s in depth look at Cinematic Effects in Source

CategoryPages containing wikitables
CategoryGame engines