Installing and Debugging the Source Code: Difference between revisions
Jump to navigation
Jump to search
Note:It is on debug compile by default. In order to run the mod with a debug dll you must right click the mod in the Steam game browser, click Properties then Set Launch Options... and add -allowdebug to the end of anything that may already be there (separated by spaces). You can change to a release build (for distributing the mod) in the configuration manager.
(Updated - hope it does the trick) |
(updates and adds) |
||
Line 6: | Line 6: | ||
# Run the '''[[Create a Mod]]''' tool in the SDK to install the source code. | # Run the '''[[Create a Mod]]''' tool in the SDK to install the source code. | ||
# Use Microsoft Visual Studio .NET | # Use Microsoft Visual Studio .NET 2005 to compile the source code. | ||
# Setup debugging parameters. | # Setup debugging parameters. | ||
# Run in the debugger. | # Run in the debugger. | ||
Line 32: | Line 32: | ||
===Debugging=== | ===Debugging=== | ||
* Start the mod using Steam | * Start the mod using Steam (you can start it in windowed mode for better comfort : add a "-window" option in the run_mod.bat in your source directory) | ||
* Inside Visual Studio, Main Menu > Debug > Attach to Process... | * Inside Visual Studio, Main Menu > Debug > Attach to Process... | ||
* Select the hl2.exe process with the title of your mod | * Select the hl2.exe process with the title of your mod |
Revision as of 04:42, 2 June 2008
Overview
The general steps to installing and debugging the source code are:
- Run the Create a Mod tool in the SDK to install the source code.
- Use Microsoft Visual Studio .NET 2005 to compile the source code.
- Setup debugging parameters.
- Run in the debugger.
Step By Step
Run the Create a Mod wizard
- Run the Source SDK from Steam and choose the Create a Mod link.
- You can normally choose any type of mod here, but for the purposes of this tutorial, choose the Modify Half-Life 2 Single Player option and click Next.
- In the top edit control of the next dialog, enter a directory where you would like to create a mod. This tutorial will assume you entered C:\MyMod.
- In the bottom edit control, enter any name for your mod. This will become a subdirectory under your SteamInstallPath\SteamApps\SourceMods folder. This example will assume you entered MyMod here.
- Click the Next button and the source code will be installed on your hard drive.
- Wait for the mod wizard to finish.
Compile the Source Code
Compiling under VS2003
Compiling under VS2005
Compiling under VS2008

Debugging
- Start the mod using Steam (you can start it in windowed mode for better comfort : add a "-window" option in the run_mod.bat in your source directory)
- Inside Visual Studio, Main Menu > Debug > Attach to Process...
- Select the hl2.exe process with the title of your mod
Links
A good next step after mastering this document is to look at the Your First Entity document, in which you will make changes to some of the source code.
If you plan to integrate code updates from Valve, and if you want code backups and revision history, take a look at the Using Source Control with the Source SDK document. Template:Otherlang:en Template:Otherlang:en:jp