.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   General Bot Coding (http://forums.bots-united.com/forumdisplay.php?f=24)
-   -   How to make my bots to work with metamod (http://forums.bots-united.com/showthread.php?t=2805)

The Storm 18-10-2004 20:49

How to make my bots to work with metamod
 
Hi all I'm the new bot coder of E[POD]bot and I need of some help.
I won to make the bots metamod completeble.Please someone to help me with that think.

Whistler 19-10-2004 12:29

Re: How to make my bots to work with metamod
 
it's simple. just compare the HPB bot 4.0 vs. HPB bot 3.0 :)

The Storm 19-10-2004 22:28

Re: How to make my bots to work with metamod
 
Quote:

Originally Posted by Whistler
it's simple. just compare the HPB bot 4.0 vs. HPB bot 3.0 :)

More information plese ???:(

Pierre-Marie Baty 19-10-2004 23:01

Re: How to make my bots to work with metamod
 
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.

The Storm 20-10-2004 11:00

Re: How to make my bots to work with metamod
 
Thank you PMB but I won to ask you is there a way to make the bots to load metamod.dll instead of mp.dll if it exists(like your bots RACC).

Pierre-Marie Baty 20-10-2004 14:25

Re: How to make my bots to work with metamod
 
oh, sure...

just do a test to see whether the metamod DLL exists, and if it does, load it instead of your mod's game DLL. That's all there is.

But I would highly recommend to make the bot a real metamod plugin instead. It's not that difficult, really.

Whistler 21-10-2004 12:28

Re: How to make my bots to work with metamod
 
that's even more easy.
you can just cut'n'paste the GiveFnptrsToDll() function from RACC :)
but I think LightNinja has already done this. However he has commented it out. Just take a look at the GiveFnptrsToDll() function.


All times are GMT +2. The time now is 07:01.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.