Skip to content

Developing

Alienmario edited this page Nov 21, 2024 · 11 revisions

Prerequisites

  • The game's Dedicated server installed (directly via Steam or SteamCMD).
  • Recommended versions of Metamod:Source and SourceMod installed.

Setting up SourceCoop

  • Grab latest build under master branch from Github Actions tab.
  • Extract it in the game root - where gameinfo.txt is located.
  • This ensures you get all required files in correct places.
    • Game assets are placed under the game root and SourceMod associated files under its root.

Editing source code using Visual Studio Code (recommended)

  • Install VSCode
  • Fork SourceCoop and open it as a folder in VSCode
  • Optionally add your server as a folder in your workspace
  • Install SourcePawn by Sarrus extension from the marketplace
  • Edit the extension settings
    • Sourcepawn: Output Directory Path
      Example: ...\Black Mesa Dedicated Server\bms\addons\sourcemod\plugins/
    • Source Pawn Language Server: Include Directories
      Example: ...\Black Mesa Dedicated Server\bms\addons\sourcemod\scripting\include
    • Source Pawn Language Server > Compiler: Path
      Example: ...\Black Mesa Dedicated Server\bms\addons\sourcemod\scripting\spcomp.exe
  • Compile srccoop.sp
  • Happy developing!

Tips

The game you are compiling for is set via SRCCOOP_* arguments passed to spcomp. The default is SRCCOOP_BLACKMESA.

  • See scripting\include\srccoop.inc for how this is setup.
  • To start with a minimal build, pass SRCCOOP_CUSTOM_COMPILE=1. This allows you to cherry pick individual features. A game definition still needs to be passed, as some constants/behavior may differ depending on the game you compiled for.
  • NO_DEBUG=1 may be passed to deactivate all debug logging functionality, as is done in release builds.

In VSCode you can edit the compiler arguments in your .code-workspace like so:

{
	"settings": {
		"SourcePawnLanguageServer.compiler.arguments": [
			// "NO_DEBUG=1",
			"SRCCOOP_HL2DM=1",
			"-O2",
			"-v2"
		]
	}
}

Sourcemod docs: https://wiki.alliedmods.net/Category:SourceMod_Scripting
Sourcemod API reference: https://sm.alliedmods.net/new-api/
Additional resources: https://forums.alliedmods.net/showthread.php?t=321089
Plugin AutoReload: https://forums.alliedmods.net/showthread.php?t=322045