SourceMod is a Metamod:Source plugin for Half-Life 2. It provides comprehensive scripting for the Source engine and mods written using the Source SDK. It has features for administration systems, commands, console variables, events, network messages, timed actions, math and string routines, entity modification, and more. It also features a safely versioned, object oriented API usable from "extensions" written in C++. The extension API can be used to add scripting language callbacks and native features.
SourceMod scripts are written in the SourcePawn language, which is derived from Pawn. Some of the differences include:
- Passing functions as "objects," instead of by name
- Natively packed and tagged strings
- Dynamic local variables
- A 'decl' operator for creating uninitialized variables
- A new virtual machine and JIT, both rewritten in C++
- A new file format
SourceMod was officially announced on October 7th, 2004, as a successor to AMX Mod X for the Half-Life 1 engine. It was targetted as a complete rewrite of AMX Mod X, with the following fundamental changes:
- Use of multiple (pluggable) scripting languages
- An object-oriented module API
The Source SDK was released on December 1st, 2004. A few weeks later, SourceMod released its source code on December 25th. Then, development began to stagnate. The concept of multiple languages was over-ambitious and improper. The system was largely too complex and too unorganized for developers to understand. Most importantly, the integral calling abstraction layer, designed to let Core talk to plugins without knowing the target scripting layer, was never viable. Because of this and the inherent complexity of MetaEng, scripts were not testable.
By May of 2005, SourceMod had become completely abandoned. The codebase was scrapped for a rewrite, called "Core 2." This was also quickly abandoned. This timeline and the details therein are explained on the SourceMod Dev Log. The remaining members of the SourceMod team went back to AMX Mod X.
By January of 2005, it was apparent that Valve's API would not be sufficient for plugin development in C++. SourceMod and AMX Mod X Developer Pavol "PM OnoTo" Marko started working on an API for safely hooking virtual functions via vtables.
By March of 2005, it was apparent that this technology would be more useful as a separate project. Thus, SourceHook broke from SourceMod and the Metamod:Source project was started. Metamod:Source was first released on May 26, 2005.
In March of 2006, a public survey was held to determine if the community still wanted SourceMod. Since the response was good, the project was restarted, but in secret, to avoid the same public relations mistakes. From March to September, SourcePawn was written, which included:
- A new JIT, written completely in C++
- A new virtual machine and API, written in C++ with object oriented API
- A new file format
- Various new language features
From November 2006 to January 2007, SourceMod evolved into a usable scripting platform based on SourcePawn. As of March 16, 2007, it contained enough scripting-level features to be usable, and builds were made available to the public.
SourceMod remains an ongoing development project which now runs on over 38% of all Source servers.
- See the credits page.
As of the time of writing, SourceMod version 1.4.2 has been released and version 1.5 is under development. New API functionality and game support is added to SourceMod with every update.
SourceMod is licensed under the GNU General Public License.