SDK Overview: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 1: Line 1:
__NOTOC__
__NOTOC__
[[Category:SDK_Documentation]]
[[Category:SDK_Documentation]]
<div style="max-width:75%;min-width:80ch;margin:0 auto;font-size:1.1em;line-height:1.65em">
= What is the SDK =
= What is the SDK =
The Source SDK is a development kit for creating and modifying games built on the Source Engine. It includes a wide range of source code files and scripts that enables you to build your own systems and game logic on top of the Source Engine framework.
The {{User:SomeoneTookSeven/TemplateSDK}} is a development kit for creating and modifying games built on the {{source|4|nt=1}}. It includes the relevant source code files that enable developers to modify and create internal games systems. While the {{User:SomeoneTookSeven/TemplateSDK}} does not provide access to the engine, it does provide header files. These header files can be used in conjunction with other SDK code to interface with the engine allowing communication between the public SDK code and {{Valve|4|nt=3|addtext=s}} Closed-source engine code.


== What The SDK Offers ==
== What The SDK '''Isnt''' ==
The SDK provides:
It’s important to understand that the {{User:SomeoneTookSeven/TemplateSDK}} '''''DOES NOT''''' include {{source|4|nt=1}} code. This means that while you can interface with low level systems, you '''cannot change them'''. However anything above those systems, you can! While its obvious that the game code is available. {{Valve|4|nt=3}} also included other {{Visual Studio|4|nt=4}} projects along with the SDK ''(like compiler tools)''
* Full access to gameplay code written in C++
* Tools to compile maps, models, and materials
* Build scripts and Visual Studio project files
* Example projects, including full working games
 
These examples are fully functional games you can compile, run, and modify. They serve as excellent starting points, especially if you’re learning the SDK.


== What The SDK '''Isnt''' ==
== How the SDK Operates  ==
It’s important to understand that the SDK does not include the full Source Engine code. Low-level systems such as memory management, rendering backends, and core engine behavior are still closed source. These components are proprietary and not exposed for direct modification.
As we described earlier The {{User:SomeoneTookSeven/TemplateSDK}} '''IS NOT''' The {{source|4|nt=1}}. This means we are still going to need the engine to run our game. To get this engine, {{Valve|4|nt=3}} published {{Source SDK Base 2013 Multiplayer|4|nt=4}} on steam. Downloading this software off steam, grants us a relatively barebones version of the engine that we will use to launch our SDK mod.


However, Valve provides the necessary header files for these systems. While you can't change their implementation, you can interface with them allowing your code to call engine functions and respond to engine events.


== How It Works ==
Valve designed the engine from the ground up to be highly modular. As you start reviewing SDK Code you should see this pattern emerge. At the lowest level the engine will dynamically load and unload <code>.dll</code> files depending on what logic is needed and when. This means that we can launch our SDK using the original {{Half-Life 2|4|nt=0|addtext=.exe}} without needing to recompile the entire engine. Instead all that is required from us is tell the <code>.exe</code> file that we want to use our SDK code instead of the original.
For any mod, you’ll need to install Source SDK Base 2013 Multiplayer from Steam. This serves as the foundation for your project, supplying the engine binaries (for example, <code>tier0.dll</code>) that the SDK doesn’t include.


When you launch your mod, you're not running a separate executable, you’re launching the original hl2.exe with custom parameters that tell it to load your game’s DLLs, assets, and scripts instead of the default ones.


This works because the Source Engine is highly modular. It’s built to dynamically load and unload DLL files at runtime, which is how mods can hook into the engine without needing access to its internals.
This happens by using launch parameters. The SDK should setup this up for you automatically without you realizing it. If you inspect the properties of the <code>Client (HL2MP)</code> project in {{Visual Studio|4}} under <code>Configuration Properties -> Debugging -> Command</code> you should find it set to: <code><drive>\STEAM\steamapps\common\Source SDK Base 2013 Multiplayer\hl2_win64.exe</code> This is telling you that whenever you build your SDK project and launch it to use this <code>.exe</code> program to try and do it. Just under it you'll notice <code>Command Arguments</code> ''(what it will pass the the <code>.exe</code> program as it trys to launch it)'' is set to: <code>-game "C:\Users\User\Desktop\SDK\source-sdk-2013\game\mod_hl2mp" -dev -w 1920 -h 1080 -windowed</code>. These arguments is what tells the source engine to launch our mod.


== Getting Started ==
== Getting Started ==
The Source Engine is LARGE with a lot of complexities, features, and systems all intertwining with one another. This is why you here "Source Spaghetti".
Now that you know the fundamentals of what the {{User:SomeoneTookSeven/TemplateSDK}} is and what it actually does. You start exploring the codebase. With this being said, {{source|4}} is '''''LARGE''''' and really old ''(potentially older than some of its developers)'' meaning its recommended you take some more time to learn about some generic SDK concepts as well as some generic CPP concepts that are used heavily throughout the engine.  
 


Due the engines age and the way it is constructed you will often come across anomalies that are less frequent in modern codebases. For Example, you can find code written in the 2020's next to original c code because C++ didn't exist when they wrote it.
The next article that is recommended is [[VPC_Scripts]]. These "Valve Project Creator" scripts is how {{Valve|4|nt=3}} ensures everyone on their team is working in a relatively consistent development environment. They do this by controlling project settings and some pre-processor functionalities with these scripts allowing everyone on the team to have a uniform baseline project.

Revision as of 14:46, 27 July 2025

What is the SDK

The "SDKImg" Source SDK is a development kit for creating and modifying games built on the Source Source Engine. It includes the relevant source code files that enable developers to modify and create internal games systems. While the "SDKImg" Source SDK does not provide access to the engine, it does provide header files. These header files can be used in conjunction with other SDK code to interface with the engine allowing communication between the public SDK code and Valve Valves Closed-source engine code.

What The SDK Isnt

It’s important to understand that the "SDKImg" Source SDK DOES NOT include Source Source Engine code. This means that while you can interface with low level systems, you cannot change them. However anything above those systems, you can! While its obvious that the game code is available. Valve Valve also included other Visual Studio Visual Studio 2022 projects along with the SDK (like compiler tools)

How the SDK Operates

As we described earlier The "SDKImg" Source SDK IS NOT The Source Source Engine. This means we are still going to need the engine to run our game. To get this engine, Valve Valve published Source SDK Base 2013 - Multiplayer Source SDK Base 2013 - Multiplayer on steam. Downloading this software off steam, grants us a relatively barebones version of the engine that we will use to launch our SDK mod.


Valve designed the engine from the ground up to be highly modular. As you start reviewing SDK Code you should see this pattern emerge. At the lowest level the engine will dynamically load and unload .dll files depending on what logic is needed and when. This means that we can launch our SDK using the original Half-Life 2 HL2.exe without needing to recompile the entire engine. Instead all that is required from us is tell the .exe file that we want to use our SDK code instead of the original.


This happens by using launch parameters. The SDK should setup this up for you automatically without you realizing it. If you inspect the properties of the Client (HL2MP) project in Visual Studio Visual Studio under Configuration Properties -> Debugging -> Command you should find it set to: <drive>\STEAM\steamapps\common\Source SDK Base 2013 Multiplayer\hl2_win64.exe This is telling you that whenever you build your SDK project and launch it to use this .exe program to try and do it. Just under it you'll notice Command Arguments (what it will pass the the .exe program as it trys to launch it) is set to: -game "C:\Users\User\Desktop\SDK\source-sdk-2013\game\mod_hl2mp" -dev -w 1920 -h 1080 -windowed. These arguments is what tells the source engine to launch our mod.

Getting Started

Now that you know the fundamentals of what the "SDKImg" Source SDK is and what it actually does. You start exploring the codebase. With this being said, Source Source is LARGE and really old (potentially older than some of its developers) meaning its recommended you take some more time to learn about some generic SDK concepts as well as some generic CPP concepts that are used heavily throughout the engine.


The next article that is recommended is VPC_Scripts. These "Valve Project Creator" scripts is how Valve Valve ensures everyone on their team is working in a relatively consistent development environment. They do this by controlling project settings and some pre-processor functionalities with these scripts allowing everyone on the team to have a uniform baseline project.