In search of the right development stack
In search of the right development stack
Alright, I wanted to make the game play my new music, it needed to be adaptive, yadda, yadda... But the original game is not intended to do this. I knew I had to add another layer on top of the Source engine, and I already chose the FMOD game audio engine (https://www.fmod.com/) that looked promising, open, and adapted to my need. Now I had to hook it to Source... with no prior C++ knowledge.
The Source Engine SDK: the Source of it all
Summer 2023. We all gotta start somewhere, and thinking about the project while reading the Source engine's documentation, all it looked like was that I wanted to make a Half-Life 2 mod. So where do you go? Reading the documentation, learning how to make a mod (https://developer.valvesoftware.com/wiki/My_First_Mod), then starting to mess around with the game.
I worked on this stack up until spring 2024, developing one by one my features on top of Source, learning by the way how to code and compile C++, thanks to helping software developers' hands in my company (Tim, if you read this, you have all my gratitude again). I had a working proof-of-concept with a first draft of music for a map, got stuck at some development step but decided to pause a bit the development to try some music ideas, when re-doing the full game while taking screenshots and notes to have a canvas for music ideas.
Plugins: Adding features instead of overriding
I chose to play the game with a "modern" mod to try having a nice experience, I played it with MMOD (https://www.moddb.com/mods/hl2-ep2-enhased-mod), which I highly recommend to add some immersion, more dynamic combat, and enhanced graphics while staying fully true to the original game. I loved it, but it got me thinking: okay, but this mod needs its own source code compiled, thus its own "server" and "client" DLLs, meaning I can't use those I built...
I had to find a way to add my features without compiling a whole new game, and it turns out there's a plugin system for Source engine. The out-of-the-box plugin system is hella broken and cannot properly compile as of 2024, so I got into forums and discovered the works of people who, for 20 years, are working on loads of additional frameworks and tools for the Source engine: AlliedModders.
AlliedModders: These guys have done it for you (and will do it again)
AlliedModders (https://www.alliedmods.net/) is, as they say an open-source development community, focused on server-side modifications to any and all games on the Half-Life 1 and Half-Life 2 platforms. Their website lists their projects, mainly MetaMod:Source and SourceMod which are of interest here. Their forum and more importantly their Discord server is really active and shows the still current interest of people in working on the Source engine.
I used the forum and later on the Discord to get help on my subjects, and I am very grateful for their help. Shoutout to all the AlliedModders that helped me on the Discord : AI, Anonymous Player, Asherkin, Backwards, Bakugo, Fyren, Kenzzer, Poggu, Psychonic, Nolo001 and Sarrus. You have all my gratitude!
MetaMod:Source: Sitting right in the middle
The first project and approach I used was MetaMod:Source. This custom plugin system is similar to the standard Source engine one... except it works! This allows for hooking into the functions and events of the Source engine and add new features via C++ when installed on the server-side of the game (the game has a server-side and client-side even in single player mode).
I was working with this setup for a while but struggled to start accessing information about some entities. Entities are the player, the enemies, the props, etc., and I needed access to their data to be able to use them as a source of information for the player's surroundings, health, equipped weapons, etc. I asked AlliedModders' Discord and chose to use another tool on top of MetaMod: SourceMod.
SourceMod: Overkill or a helping hand?
SourceMod is a Metamod:Source plugin and a scripting environment. It provides basic scripts and a C-inspired scripting language, SourcePawn, based on the Pawn language. It allows for a more flexible scripting environment, and adds loads of helpers to easily get access to the data I was searching for.
I then finally had my stack up and running, after 4 or 5 full refactorings. My MetaMod:Source plugin became a SourceMod extension, providing low-level interaction with FMOD for the sound system management, save/restore features, etc., while my SourceMod plugin is providing high-level interaction with entities and the player's state.
Comments
Post a Comment