How to compile the original4 defcon api ai bot to working?
Posted: Thu Jul 15, 2010 3:43 pm
I was interested in messing around with the defcon api here : http://www.introversion.co.uk/defcon/bots/ and http://www.doc.ic.ac.uk/~rb1006/projects:api
I downloaded the source code for the Introversion Original Bot here: http://anormal-tracker.de/downloadcount ... t_v0.9.zip
and the description is basically:
"This bot is modelled after the original bot included in Defcon. The source-code is included, too, so this might be a good starting point to create a customized bot.
The source code has been changed from the original to fit it to the API and to adjust it to libraries that it cannot access from outside Defcon easily. I tried to keep the source-code as readable as possible, and most of it should be pretty self-explanatory. "
I followed his instructions of "To be able to compile a dll for the use with DEFCON , follow these steps:
1. Obtain the code for an existing bot, for example simplebot. Place the code into
any folder, for example DEFCON\AI\myBot\source.
2. Open Visual Studio and create a new project from the existing code. In our
example, use DEFCON\AI\myBot as folder. If possible, select Dynamic Link
Library as default project configuration type.
3. Set the configuration to Release.
4. The following settings will concern the project properties, viewable with Project-
>Properties. For the following settings, the location in the properties for Visual
Studio 20081 have been given in brackets).
5. (Optional) Set the output directory to $(SolutionDir) to create the .dll in the right
place for DEFCON to find. (Configuration Properties - General)
6. Add source/ as additional include directory (Configuration Properties - C/C++ -
General)
7. Make sure Runtime Library is set to Multi-threaded DLL (/MD) (Configuration
Properties - C/C++ - Code Generation)
8. Specify the Module Definition File to source/dl l/bot.def (Configuration Properties
- Linker - Input)
Now you should be able to compile a dll, which works with DEFCON ."
But I couldn't get it to work. I downloaded the free 90 day trial version of the exact same version of Microsoft Visual Studio 2008 that the author suggested..
( http://download.microsoft.com/download/ ... 435622.iso )
but no matter how many times I read his instructions I don't know how to do steps #4, #5, #6, #7, #8...
I've never used Visual Studio before but his instructions simple aren't intuitive and I believe there is a disconnect between what he is trying to instruct and what he actually did to get it to work for himself..
Reason being..
I was able to successfully play around with both the simplebot (which doesn't do anything) and the ivai.dll (IV AI aka Original4 bot) which is basically just the exact same thing as the default AI coded in the default game. So I got the bot enabled version of Defcon and did get the prebuilt and precombiled bots up and running..
However when I ryted to compile I always run into problems following his instructions above.. they are not very clear nor intuitive.. so I found a ivai.vcproj file in the visualstudio_files subdirectory of the iv ai folder and compiled it that way.. basically this was the project he set up and saved and should be the project that he used to compile the ivai.dll that I was able to verify was working on my computer with the bot enabled version of Defcon..
Yet when I build and compile it (no errors) the ivai.dll updates like it is supposed to do. I can't think of what I could be doing wrong.
When I try to run the bot it crashes to desktop and gives me error code 3...
Has anyone been able to figure out how to successfully compile the Original4 source code? I want to be able to compile it and get it going so I can make changes to the code itself and tweak with the default AI to make it more aggressive. Thanks!
I downloaded the source code for the Introversion Original Bot here: http://anormal-tracker.de/downloadcount ... t_v0.9.zip
and the description is basically:
"This bot is modelled after the original bot included in Defcon. The source-code is included, too, so this might be a good starting point to create a customized bot.
The source code has been changed from the original to fit it to the API and to adjust it to libraries that it cannot access from outside Defcon easily. I tried to keep the source-code as readable as possible, and most of it should be pretty self-explanatory. "
I followed his instructions of "To be able to compile a dll for the use with DEFCON , follow these steps:
1. Obtain the code for an existing bot, for example simplebot. Place the code into
any folder, for example DEFCON\AI\myBot\source.
2. Open Visual Studio and create a new project from the existing code. In our
example, use DEFCON\AI\myBot as folder. If possible, select Dynamic Link
Library as default project configuration type.
3. Set the configuration to Release.
4. The following settings will concern the project properties, viewable with Project-
>Properties. For the following settings, the location in the properties for Visual
Studio 20081 have been given in brackets).
5. (Optional) Set the output directory to $(SolutionDir) to create the .dll in the right
place for DEFCON to find. (Configuration Properties - General)
6. Add source/ as additional include directory (Configuration Properties - C/C++ -
General)
7. Make sure Runtime Library is set to Multi-threaded DLL (/MD) (Configuration
Properties - C/C++ - Code Generation)
8. Specify the Module Definition File to source/dl l/bot.def (Configuration Properties
- Linker - Input)
Now you should be able to compile a dll, which works with DEFCON ."
But I couldn't get it to work. I downloaded the free 90 day trial version of the exact same version of Microsoft Visual Studio 2008 that the author suggested..
( http://download.microsoft.com/download/ ... 435622.iso )
but no matter how many times I read his instructions I don't know how to do steps #4, #5, #6, #7, #8...
I've never used Visual Studio before but his instructions simple aren't intuitive and I believe there is a disconnect between what he is trying to instruct and what he actually did to get it to work for himself..
Reason being..
I was able to successfully play around with both the simplebot (which doesn't do anything) and the ivai.dll (IV AI aka Original4 bot) which is basically just the exact same thing as the default AI coded in the default game. So I got the bot enabled version of Defcon and did get the prebuilt and precombiled bots up and running..
However when I ryted to compile I always run into problems following his instructions above.. they are not very clear nor intuitive.. so I found a ivai.vcproj file in the visualstudio_files subdirectory of the iv ai folder and compiled it that way.. basically this was the project he set up and saved and should be the project that he used to compile the ivai.dll that I was able to verify was working on my computer with the bot enabled version of Defcon..
Yet when I build and compile it (no errors) the ivai.dll updates like it is supposed to do. I can't think of what I could be doing wrong.
When I try to run the bot it crashes to desktop and gives me error code 3...
Has anyone been able to figure out how to successfully compile the Original4 source code? I want to be able to compile it and get it going so I can make changes to the code itself and tweak with the default AI to make it more aggressive. Thanks!