Optimizing SourceMod and Configuring SPEdit – Part 1

This is a guide for anyone doing development on the Source engine. It includes information on:

  • How optimize SourceMod by removing unecessary plugins and extensions;
  • Configuring SPEdit;
  • Using the built in SourceMod commands to minimize server restarts.

Basically, it reduces the time you spend doing usual tasks and allows you to focus on writing the code.

Note: If you have your own SRCDS/SteamCMD server setup, skip straight to the Setting up SourceMod section.

Basic Server Setup

First thing you need to have setup is the base SRCDS (Source Dedicated Server) or SteamCMD (Steam Command) Dedicated Server. The guides will be based on the server type you’re running, directly from the Valve Wiki:
SRCDS Server Setup: https://developer.valvesoftware.com/wiki/Source_Dedicated_Server
SteamCMD Server Setup: https://developer.valvesoftware.com/wiki/SteamCMD

Once you have the server setup, all the files downloaded and you can confirm it’s working, proceed to the next step which will run over Metamod:Source and SourceMod installation.

Installing MetaMod:Source and SourceMod

Now that we have the base server installed, we will need to get Metamod:Source and SourceMod setup.

  1. Start by accessing the offical mod page here and follow the simple install gulde. 2. Now that we have a basic install, let’s get the admin access done – you have two choices the simple admin configuration or the groups assignment (personally, I think that it’s best going for the simple configuration unless working on a live server with many users).  Follow the guide here and decide on what suits you most.

Note: Don’t forget to put “127.0.0.1” in SourceMod/configs/simpleadmins.ini, if you’re working from a local dedicated server and give yourself full admin access (or play with certain flags, if your plugin requires them, in order to confirm it’s working as intended).

Setting up SourceMod

Once you confirm that SourceMod is installed and working correctly, with admin access setup, it’s time to start removing unnecessary plugins and create a development environment. Open the “plugins” folder of SourceMod, and proceed to move everything listed below to the disabled directory.

Plugins to Disable:
  • adminhelp.smx – Displays command information
  • antiflood.smx – Chat flooding protection
  • basebans.smx – Basic banning commands
  • basechat.smx – Basic chat communication commands
  • basecomm.smx – Provides methods of controlling communication
  • basecommands.smx – Basic admin commands
  • basetriggers.smx – Basic info triggers
  • basevotes.smx – Basic vote commands
  • funcommands.smx – Fun commands
  • funvotes.smx – Fun Vote Commands
  • nextmap.smx – Provides nextmap and sm_nextmap
  • playercommands.smx – Miscellaneous player commands
  • reservedslots.smx – Provides basic reserved slots
  • sounds.smx – Sound commands

Now that we have the non-essential plugins disabled, let’s make sure we have the essential ones enabled.

Enabled Plugins:
  • admin-flatfile.smx – Reads and parses the admin access files
  • clientprefs.smx – Client preferences and settings menu

Now the active plugins are set, let’s keep or remove some optional extensions. I’ve also added a short explanation, about what each extension does. Keeping or removing the extensions is down to your preference, depending on what you need.

Optional Extensions to Keep or Disable:
  • clientprefs.ext.dll – Saves client preference settings
  • dbi.mysql.ext.dll – MySQL driver implementation for DBI
  • dbi.sqlite.ext.dll – SQLite Driver
  • game.cstrike.ext.2.csgo.dll – Remove unless working with CS:GO
  • game.cstrike.ext.2.css.dll – remove unless working with CS:S
  • game.tf2.ext.2.tf2.dll – Remove unless working with TF2
  • geoip.ext.dll – Geographical IP information
  • regex.ext.dll – Provides regex natives for plugins
  • sdkhooks.ext.1.*.dll – SDK Hooks – Personal Choice, if plugin is mod specific
  • sdkhooks.ext.2.*.dll – Same as above, but a higher Source engine version
  • sdktools.ext.1.*.dll – SDK Tools – Same as above
  • sdktools.ext.2.*.dll – Above, but a higher Source engine version
  • topmenus.ext.dll – Creates sorted nested menus
  • webternet.ext.dll – Extension for interacting with URLs / CURL

Make sure to only disable extensions you’re 100% sure won’t be used. Mistakes can lead to server crashes or calling a none existent function, because you disabled the wrong extension.

Now we’ll move on to an IDE (Integrated Development Environment), used to create the plugin and run the build script.

Downloading and Configuring SPEdit

When SourceMod was first released, the only real editor choices, with syntax highlighting, were Notepad++, UltraEdit or PSPad. Since then, 2-3 custom IDE’s have been released: Pawn Studio (wasn’t updated for SourceMod at the time) and SPEdit (came out quite recently and it’s my favourite for it’s simplicity and UI).

  1. Let’s start off by getting SPEdit. You can go to the official thread here and download it.
  2. Run the installer or extract to a directory of your choice.
  3. Run the main executable or shortcut the installer created.
  4. To configure the IDE we need to setup directories in the “Configurations->Edit Configurations Menu”. You should see a dialog like this – Configured for CS:GO:

SPEdit Configuration

Inside the dialog, we need to set the “Copy Directory:” to your server plugins folder, then the “Server Executable:”  to the directory where your “srcds.exe”  is located, depending on the game you’re working with.

The final task is the “Server-Start Arguments” settings. Use the same ones as recommended by Valve from their Wiki guide and add this “-allowdebug -debug -dev +sv_lan 1” at the end, as shown in the picture above (Missing +sv_lan 1). These options enable better console output for developers (with more information) and disable Valve Anti-Cheat.

Creating Your Plugin

This step is really simple, thanks to SPEdits facile and intuitive UI.

Load SPEdit and select the menu option “File -> New”. Confirm it’s set as “SourcePawn Script”  in the main dialog which pops up and click the “Magnifying Glass” icon in the bottom right. A save dialog should also pop up, allowing you to decide where to save the plugin and allows you to pick a name for it.

Note: It’s best to set this as your main plug-in sourcecode directory.

Now you have the IDE configured, get to coding your plugin and be ready for part 2. This will conclude part 1.
Thank you for reading this far. Part 2 will follow up with an overview of the SourceMod commands which are useful for developers.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.