Re: How to make my bots to work with metamod -
19-10-2004
First you need to understand well how a game DLL (like a bot DLL) works. What are the engine functions, what are the DLL functions, and which ones are internal functions the developer has added to make his programming easy. You also need to understand perfectly how the function interfacing is done between the HL engine and its game DLL.
Heavily simplified, engine functions are those in engine.cpp that start with "pfn". And DLL functions are those in dll.cpp that start with "pfn" too. They start with "pfn" because it stands for Pointer to FuNction. In a normal game DLL, these functions MUST be present.
In a metamod DLL, these functions need not be present if you don't use them (like, you don't need functions like pfnPlayerPostThink() or about 80% of the functions of the engine interface and the DLL interface, since you don't add code of yours in them). Metamod enables us to declare what functions we want to use in a struct, and throw the rest to oblivion.
The main difference also, is that at the end of a metamod-called game function, you don't call the other side of the interface like we would do in a normal DLL - example : (*g_engfuncs.pfnStartFrame) (); instead you let metamod do this for you. To do this use the macro RETURN_META (). Read up the metamod docs to understand what these macros do and how to use them right.
If you want to be quickstarted, download one of my simple plugins from the filebase and hack it away until you understand how it works. Notice the correspondence between game functions (like StartFrame) and their slot in GetEntityAPI2() and GiveFnptrsToDll(). You have to declare which functions you use there, before you can use them.
Anyway, don't forget to RTFM.
RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."
|