How to compile the original4 defcon api ai bot to working?

Come in here to talk about your sky-net style world-destroying super bots!

Moderator: Defcon moderators

Barbarossa
level2
level2
Posts: 105
Joined: Sun Jul 11, 2010 8:04 am
Contact:

How to compile the original4 defcon api ai bot to working?

Postby Barbarossa » 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!
User avatar
Ace Rimmer
level5
level5
Posts: 10803
Joined: Thu Dec 07, 2006 9:46 pm
Location: The Multiverse

Postby Ace Rimmer » Thu Jul 15, 2010 4:27 pm

I could never get it to compile either, but I have no idea what I'm doing anyway. :P
Smoke me a kipper, I'll be back for breakfast...
Barbarossa
level2
level2
Posts: 105
Joined: Sun Jul 11, 2010 8:04 am
Contact:

Postby Barbarossa » Thu Jul 15, 2010 4:38 pm

Ace Rimmer wrote:I could never get it to compile either, but I have no idea what I'm doing anyway. :P


Yeah I really want to tweak around with the already built default AI bot, I'll try to get it to work. I'm not too fond of Lua. BTW I say on youtube your test runs of the MidNight bot.. I must say it seems much more powerful than the "super ai bot" which had 75% odds against default cpu.. I guess learning and neutral networking isn't much use when it comes to these things.. The best chess engines are programmed by excellent chess players, not neutral network taught through chess engine playing chess engine, etc.. (though opening books are created that way, buts that a different story..)

Is it be possible to create a bot that plays as just another user in a 6 player diplomacy mode?
User avatar
Ace Rimmer
level5
level5
Posts: 10803
Joined: Thu Dec 07, 2006 9:46 pm
Location: The Multiverse

Postby Ace Rimmer » Thu Jul 15, 2010 4:45 pm

Barbarossa wrote:Is it be possible to create a bot that plays as just another user in a 6 player diplomacy mode?

I'm guessing yes, though it can't read the chat box. It can send messages (e.g. "Hey human, I'm going to do this...", and lie/tell the truth) and apparently can join/leave alliances (and I think vote as well) which is something the CPU doesn't do.
Smoke me a kipper, I'll be back for breakfast...
Barbarossa
level2
level2
Posts: 105
Joined: Sun Jul 11, 2010 8:04 am
Contact:

Postby Barbarossa » Thu Jul 15, 2010 4:50 pm

Ace Rimmer wrote:
Barbarossa wrote:Is it be possible to create a bot that plays as just another user in a 6 player diplomacy mode?

I'm guessing yes, though it can't read the chat box. It can send messages (e.g. "Hey human, I'm going to do this...", and lie/tell the truth) and apparently can join/leave alliances (and I think vote as well) which is something the CPU doesn't do.
.

Its frustrating that the default cpu can't make or break alliances.. I wanted to practice the SuiSilo strategy with CPU's in diplomacy mode but realized they can't do that..


Great.. I mean while bot vs bot is fun to watch, I think a super strong bot playing with a group of 5 human players in default or diplomacy mode would be interesting as well...

Joshua's lua code is published at http://github.com/martindevans/Joshua-B ... Joshua.lua I probably take a look at it. Do you know if it actually does anything at this stage?
User avatar
Ace Rimmer
level5
level5
Posts: 10803
Joined: Thu Dec 07, 2006 9:46 pm
Location: The Multiverse

Postby Ace Rimmer » Thu Jul 15, 2010 4:57 pm

If I remember correctly, it places some units and launches a couple of fighters, but other than some fancy whiteboard drawing, no. martin is 'waiting' for GetShots() to be 'fixed'. As of right now a Lua Bot can see that it is being fired upon but can't tell where the shots come from, which means if you continually stayed out of it's Radar, it wouldn't know what to do and you could kill it's navy .
Smoke me a kipper, I'll be back for breakfast...
Barbarossa
level2
level2
Posts: 105
Joined: Sun Jul 11, 2010 8:04 am
Contact:

Postby Barbarossa » Thu Jul 15, 2010 5:28 pm

Ace Rimmer wrote:If I remember correctly, it places some units and launches a couple of fighters, but other than some fancy whiteboard drawing, no. martin is 'waiting' for GetShots() to be 'fixed'. As of right now a Lua Bot can see that it is being fired upon but can't tell where the shots come from, which means if you continually stayed out of it's Radar, it wouldn't know what to do and you could kill it's navy .


Well if I (or anyone) could get the darn Original4 c++ thing to compile that might be more efficient use of time. And was it you that I just played with online? Your bot sure is verbose.. its silos were packaged tighter than any human can do. Why not just ask Chris for the equation or if he knows a way to directly reveal the ETA?
User avatar
Ace Rimmer
level5
level5
Posts: 10803
Joined: Thu Dec 07, 2006 9:46 pm
Location: The Multiverse

Postby Ace Rimmer » Thu Jul 15, 2010 5:30 pm

Haha, yeah that was me. I don't know why it was repeating itself, it should have only made a single comment.

Edit: Whoops, GetGameTime ~= GetGameTime()
Smoke me a kipper, I'll be back for breakfast...
Barbarossa
level2
level2
Posts: 105
Joined: Sun Jul 11, 2010 8:04 am
Contact:

Postby Barbarossa » Thu Jul 15, 2010 5:37 pm

Ace Rimmer wrote:Haha, yeah that was me. I don't know why it was repeating itself, it should have only made a single comment.

Edit: Whoops, GetGameTime ~= GetGameTime()



Is there a 1.43 version of the bot enabled defcon?.. if not.. who is going to be able to play with bots ? When I used the bot enabled .exe and try to see join a server all are incompatible..
User avatar
Ace Rimmer
level5
level5
Posts: 10803
Joined: Thu Dec 07, 2006 9:46 pm
Location: The Multiverse

Postby Ace Rimmer » Thu Jul 15, 2010 5:40 pm

No, technically speaking BotCon and public Defcon are not compatible. Who is going to play with bots? Who knows? I will even if it requires two versions of Defcon.
Smoke me a kipper, I'll be back for breakfast...
Barbarossa
level2
level2
Posts: 105
Joined: Sun Jul 11, 2010 8:04 am
Contact:

Postby Barbarossa » Thu Jul 15, 2010 7:45 pm

Nevermind, I gots it to compile. I works fine now. Sorry I had implied there could have been something wrong with the authors instructions. I guess I'm just a totally computer illiterate person lol!

Return to “AI Bots”

Who is online

Users browsing this forum: No registered users and 5 guests