.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   The Agora (http://forums.bots-united.com/forumdisplay.php?f=38)
-   -   Wannabe bot author (http://forums.bots-united.com/showthread.php?t=9033)

Neoptolemus 12-04-2012 22:12

Wannabe bot author
 
Hi everyone,

Quick intro as I'm new...

I have been interested in AI since I first fired up Zeusbot in the original Quake so I could play some coop (this being when a dial-up connection was expensive and tied up the phone line), and was intrigued by its technical cleverness. I then moved on to Quake 2 and the Eraser bot, counter-strike and PODbot etc. Despite this interest, until recently programming was very much a spectator sport for me.

Over the last year I've become more seriously interested in actually learning programming, and I've built up a reasonably solid grasp of the principals of object-orientated programming and how a program is put together, along with a decent knowledge of java and C++. I'm at a stage where I feel I can start dabbling in developing a bot and actually make some kind of progress rather than sit there looking blankly at reams of code.

I would like to try making a client-side bot for Quake 2, the main reason being partially due to nostalgia, and mostly being due to the fact that I'm using my work laptop and I'm not supposed to have games on it (so ssshhh!). Quake 2 is small enough to not matter too much, but a steam installation and HL1 is probably not the best idea. It would also be interesting to create a bot that mimics a human as closely as possible, hence client-side rather than server-side.

The problem is getting started, since I'll need a good grasp of the client/server architecture in Quake 2. I heard of the Q2BotCore which was a simple program that could connect to a server, spawn a bot, say something then disconnect. This would be perfect for me since I can look through and see how it's done, but alas I cannot find a working link for the source anywhere.

It's a bit of a long shot, but I was hoping somebody here might be able to point me in the right direction, or offer some advice to help me get started. Any help would be much appreciated!

The Storm 15-04-2012 22:43

Re: Wannabe bot author
 
http://code.google.com/p/tossbot/
The link above will lead you to open source bot based on Q2BotCore. :)

Neoptolemus 15-04-2012 23:58

Re: Wannabe bot author
 
Hi Storm, thanks for getting back to me.

Regarding the source for that particular bot, which parts do I need to download and compile to get started? I've looked through the source and it looks like I need to download and compile Q2bot and Q2map from the libs directory, and of course the source for Tossbot itself in the source directory, but I wanted to confirm that first and check there isn't anything else I need. Once I get my head around the basics and how it's all laid out, I can start building the actual bot. :)

The Storm 16-04-2012 16:31

Re: Wannabe bot author
 
Hi,

I didn't download the sources myself, but I guess, that there is "readme" file that will instruct you. If not, just get the Tossbot sources, check which headers are missing and download the needed libraries(Q2Bot and Q2Map or whatever is needed).

You mentioned that you had gained some C++ knowage, so you must be able to do it. :)

Neoptolemus 16-04-2012 21:03

Re: Wannabe bot author
 
Ah yes, that would be a good start wouldn't it? 0_o My bad!

I've got all the sources, but I'm having trouble getting my libraries linked up. It looks like it's having trouble finding the winsock library, as when I attempt to compile Q2map for example, I get a "undefined reference to `WSAStartup@8'" error, along with a load of other similar errors referring to WSA commands.

I'm using Eclipse Helios for C/C++ developers, and my CPP and header files are located in my documents/workspace/C++/Q2map/src

The source file has a quick "#include winsock.h" at the beginning (winsock.h has angled brackets around it, but the message board doesn't like it when I post it with them), but no other reference. I'm assuming there's something I'm missing, any ideas? Sorry, but I've not worked with winsock applications before...

The Storm 17-04-2012 00:49

Re: Wannabe bot author
 
Yep, you must link with the winsock library of course. :) I don't know how to configure the libraries in Eclipse but basiclly the library name is ws2_32.lib.

Neoptolemus 17-04-2012 18:47

Re: Wannabe bot author
 
I'm really struggling to compile the Q2map and Q2bot sources, probably due to my inexperience with Eclipse Helios for C/C++.

I'm using the MingW compiler and it keeps saying it can't find the WS2_32.dll library even though I've added it to the project properties. I've added the C:\WINDOWS\System32 path and the reference to ws2_32.dll, and Eclipse seems to have picked it up as it now recognises winsock commands where before it was complaining about them not being defined. The only error message I'm given is "cannot find -lws2_32.dll" even though it's right there.

It's so frustrating because once I get the code compiling I can actually work on the bot. I've already identified the main loop and I can see how it all works, I just need to get it compiling first before I start modifying it. Aaaaaaah! Come back Java, all is forgiven.

Any ideas? I'd rather not switch IDEs since I (normally) like Eclipse for my Java stuff, but I'd rather get stuff compiled than spend the next week slamming my head against the wall.

The Storm 17-04-2012 23:21

Re: Wannabe bot author
 
Hi,

Remove the .dll extension from the linker. Make it to look like this:
-lws2_32
and it should be ready to go. :)

Neoptolemus 19-04-2012 00:17

Re: Wannabe bot author
 
Ugh, still no luck. Now it just complains that it cannot find -lws2_32

Seriously, compiling this stuff shouldn't be this complex. I've linked the dll directly using the "file" option, I've tried linking the System32 directory and pointed it to both ws2_32.dll and ws2_32 (without extension), but it can't find it regardless. Even better, out of frustration I removed all links and references to ws2_32 and it's still giving me the message!

Do you use an IDE for development? If so, could you recommend one that isn't such a pain to set up?

The Storm 19-04-2012 20:32

Re: Wannabe bot author
 
Microsoft Visual C++ 2010 Express. It is free and very easy to use.

Hint: The linker does not use directly the DLL. It uses files with .lib(MSVC) or .a/so(GCC/Mingw) extensions. After that the final executable needs the DLL that is located in your system32 folder and you should not worry for that because this folder is in the PATH variable on Windows and the application will load the DLL without issues.

So after you download and compile the stuff on MSVC the file name that you must put in the linker is ws2_32.lib. :)

EDIT: From what I saw, the tossbot have MSVC project files already created. After you install the IDE you will be able to directly open them.


All times are GMT +2. The time now is 16:37.

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