Frequently Asked Questions (Metamod:Source)

From AlliedModders Wiki
Revision as of 14:49, 22 January 2008 by BAILOPAN (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Frequently Asked Questions

Q: Does Metamod:Source support (some) mod?

Metamod:Source only requests the core public interfaces of Source, so it will run on all mods that work with the version of Half-Life 2 it was built for. However, this may not strictly be true depending upon which Metamod:Source API functions a plugin uses. See the supported games list for more details.

Q: How do I install Metamod:Source?

Please look in the Installation section of the documentation.

Q: Does Metamod: Source Create Lag?

No. Metamod:Source is based off a library called SourceHook. Unlike the original Metamod for Half-Life 1, Metamod:Source only hooks functions when asked to by a plugin. It does not intercept every call by default, and does not require a complex routing table for unused hooks.

In non-technical terms? Metamod:Source is only there when you need it to be. The hooking method, although complicated, is very efficient and takes advantage of some of the odder features of C++.

And unlike the original Metamod, the binary is one tenth the size - the Half-Life 2 engine does not require a massive repository of linked entities to be exported in the same way Half-Life 1 did.

Q: Will Server Plugins run on Metamod: Source?

No. Metamod:Source plugins are separate. You can run them side by side, as long as the server plugins do not have any compatibility issues or private hooks that interfere.

Q: Is there a tutorial/example of how to write a Metamod:Source plugin?

Yes, look in the source code for "stub_mm" and "sample_mm", which contain examples of how to use the Metamod:Source API. You should be familiar with C++ and the Half-Life 2 SDK in order to proceed.

Q: If I create a Metamod:Source plugin, does it have to be open source?

No. Unlike the original Metamod, we decided to use the libpng/zLib license instead of the GPL. This is because Valve does not impose the same restrictions on Server Plugins. We'd like to keep the playing field level, as well as provide everyone with the same freedom and opportunities.

Q: Can you port this to another game engine?

Every game engine is different. Currently Metamods have been developed for three major game engines: The original Metamod for Half-Life 1 (by Will Day), Quake3 MultiMod (by CyberMind), and Metamod:Source (what you're reading about now). Each one needs to be carefully designed and built upon a specific set of rules, so a direct port is usually not possible. However, Metamod:Source is built upon a library called SourceHook. SourceHook provides a fast, efficient, and simple way to create virtual hooks. Any game that uses a modern virtual interface design for engine calls can take advantage of SourceHook.

Q: How does it work? Like Metamod-P?

No. Metamod-P is a highly optimized version of Metamod for Half-Life 1 created by Jussi Kivilinna. By using dynamic link patching, it is able to resolve entity export differences between the Engine and GameDLL - this means it does not require updates for mods like the original Metamod. It also has other related optimization techniques.

Metamod: Source is different because it uses virtual function hooking - which means individual functions in classes can be dynamically altered. Half-Life 1's engine functions were passed as a list of pointers in a struct, which requires an entirely different method of interception (that is, a wrapper set of functions that act as a router to the plugins). You can think of the design in this way:

Metamod: The Engine gives the GameDLL its set of functions, and the GameDLL gives the Engine its set of functions. Metamod sits in between and actually exchanges false versions, which have new functions that allow you to decide whether to override the original calls. Metamod: Source: You can take any virtual function of a known class and declare a hook on it. The hook is applied by patching memory directly, at runtime. The only interception that occurs between the GameDLL and Engine is the factories which provide class retrieval.

Q: What's the difference between SourceMM and Metamod:Source?

We no longer use the name "SourceMM." It was getting too confused with "SourceMod," another AlliedModders project.

Q: Where can I find more about SourceHook?

See SourceHook Development.