![]()
Visiting guest. Why not sign in?
|
|
|
Possible ApproachesAs you may expect, there are multiple ways of getting your own bots into a game. Each has its advantages and disadvantages, which are listed below. Your first task should be to ascertain what exactly you want to do with your bots, and decide what approach to use. Server Side![]() Some first person shooters include the ability to modify the game itself, allowing anyone to create their own “mod”. Often only the most polished multiplayer games allow you to do this, so don't expect it from any game. To allow you to modify the code, the company that developed the game usually releases a “Software Development Kit (SDK)”. This allows you to create your own game DLL - a standalone library that is loaded by the main engine. You need to modify the source code provided in order to insert your bots into the game. You're going to have to wait a few pages before we tackle this issue in more detail, so keep your panties on! AdvantagesSince you're actually recompiling an important part of the game, the sky is literally your limit!
DisadvantagesSince you're actually recompiling an important part of the game, everything can go drastically wrong!
Game Interface![]() In some cases, the game is still controlled by a custom DLL, but the code may not be available to you. This implies that you cannot modify it at all, so you cannot tweak that to insert your bot into the game. A solution involves having an intermediate DLL, which sits between the main engine (EXE) and the game mod (DLL). You're code is the layer between the two, hence acting as an interface. When you're DLL is loaded, it in turn loads the game DLL. During normal play, the engine calls to it are passed to the game DLL, and vice-versa. Only when it wants to perform bot AI related tasks does it intercept the calls, and execute its own code. To do this, you either need to be extremely familiar with windows DLL loading and the game's internal workings, or you can find someone that has already written a working skeleton. Your task will then be to recompile this skeleton, and insert code where necessary. This will be discussed in following pages. AdvantagesWith this approach, you're code sits in between the two main components of the game. There are many advantages to this:
DisadvantagesThe interface approach also has its disadvantages.
Client Side![]() The final option for inserting your bots into a game involves modelling the internet multiplayer approach: your bot is a stand-alone program that connects to the main server. Achieving this involves being able to recognise the server commands, understand them, and reply to them. For some games, there already exist programs that let you do this. All you have to do is write the AI code, and you let the rest of the code handle the server dialogs. Obviously, this makes your task much easier than having to deal with that yourself. AdvantagesHere, your AI is completely independent from the server. This has many benefits:
DisadvantagesThe fact that your code is not directly involved with the game has its downfalls.
In SummaryIf you want to keep things simple and don't mind not having limited information, use a client side approach. If you like the power of being closely linked with the engine, but the code for the game DLL is not available, use the interface approach. Finally, if there is no sample code available for a game interface and if the code for the game is available, use a fully server side approach Remember you can visit the Message Store to discuss this tutorial. There are already 8 replies in the thread, why not join in? Back to the Artificial Intelligence Depot.
|