(Athosino) Report post Posted August 11, 2006 (edited) Okay, I've been playing with bots for quite a while now, so I've decided to create a simple bot framework in C++, completely object-oriented: Simple Bot Framework In C++ Enjoy. P.S.: Thanks to LabRat for hosting!! Edited August 11, 2006 by (Athosino) Share this post Link to post Share on other sites
LabRat Report post Posted August 11, 2006 (edited) Nice work No ini files to mess with, just change the username and password in app.cpp, change the admin in simplebot.cpp, add ws2_32.lib (if you're using Windows), compile and run. Simple, straightforward - the way things ought to be Edited August 11, 2006 by LabRat Share this post Link to post Share on other sites
(Athosino) Report post Posted August 11, 2006 (edited) ...add ws2_32.lib (if you're using Windows)... With Visual C++ it's actually wsock32.lib. Edited August 11, 2006 by (Athosino) Share this post Link to post Share on other sites
peeper :) Report post Posted August 11, 2006 hey i like it soo do i just copy it all into C++? Share this post Link to post Share on other sites
(Athosino) Report post Posted August 12, 2006 hey i like it soo do i just copy it all into C++? Ehm, I'm not sure what you mean by C++ so here what's you do to compile & run this bot: 1) Download Visual C++ 2005 Express here. 2) Install Microsoft Platform SDK following the tutorial here. 3) Download "src.zip" from here and extract it to a folder called "src". 4) Open Visual C++, choose File->New->Project->Visual C++->Win32->Win32 Console Application, name it SimpleELBot and click OK. Now in the Win32 Application Wizard click Next and tick "Empty Project" in "Additional Options". Click Finish. 5) Go to Project->Add Existing Item, head over to "src" and add all the files from there. 6) Go to Build->Configuration Manager and set "Active solution configuration" to "Release". 7) Go to Project->Properties->Configuration Properties->Linker->Input and set "Additional Dependencies" to "wsock32.lib". 8) Hit F7 and run it! The rest you have to figure out yourself Share this post Link to post Share on other sites
peeper :) Report post Posted August 12, 2006 lol from there on there's nothing to figure out, A+ Share this post Link to post Share on other sites
(Athosino) Report post Posted August 12, 2006 lol from there on there's nothing to figure out, A+ Well there is, if you want to customize it and stuff Share this post Link to post Share on other sites
peeper :) Report post Posted August 12, 2006 how do you make it follow you or go too coords etc.. (and thanks so much, it's soo cool) Share this post Link to post Share on other sites
(Athosino) Report post Posted August 12, 2006 how do you make it follow you or go too coords etc.. (and thanks so much, it's soo cool) unsigned char str[5]; str[0] = MOVE_TO; // be sure to copy the value from client_serv.h *((short*)(str + 1)) = x; *((short*)(str + 3)) = y; SendToServer(str, 5); Share this post Link to post Share on other sites
peeper :) Report post Posted August 12, 2006 what do i copy that into? (and ThAnKs!) Share this post Link to post Share on other sites
(Athosino) Report post Posted August 12, 2006 what do i copy that into? (and ThAnKs!) Depends on what you want it to do Share this post Link to post Share on other sites
peeper :) Report post Posted August 12, 2006 i just wanna be able to make a bot move to certain places at my command Share this post Link to post Share on other sites
(Athosino) Report post Posted August 12, 2006 (edited) i just wanna be able to make a bot move to certain places at my command For that you would have to implement a pathfinder, what I really cannot do. Edited August 12, 2006 by (Athosino) Share this post Link to post Share on other sites
peeper :) Report post Posted August 12, 2006 does anybody know how to do that? Thanks Share this post Link to post Share on other sites
(Athosino) Report post Posted August 12, 2006 does anybody know how to do that? Thanks pathfinder.c does Share this post Link to post Share on other sites
(Athosino) Report post Posted August 13, 2006 A new version of SimpleELBot is available. ChangeLog: click Download: click Enjoy. Share this post Link to post Share on other sites
peeper :) Report post Posted August 13, 2006 didnt work for me Share this post Link to post Share on other sites
(Athosino) Report post Posted August 13, 2006 (edited) didnt work for me What exactly "didn't work for you"? Edited August 13, 2006 by (Athosino) Share this post Link to post Share on other sites
DarthCarter Report post Posted August 13, 2006 does anybody know how to do that? Thanks I have a pathfinder in C, with a reasonably clean interface that you may be able to integrate in to another bot. But, you will also need to be able to extract the height map from the .elm files - not too hard, you just need to read the map header and decode a few fields to find the height map. I'm not ready to release the new version of my bot yet, so I'm not going to put the new version on CPAN. Let me know if you want the pathfinder and I will post the function here - it's not that long Share this post Link to post Share on other sites
Aylott Report post Posted September 23, 2006 Great framework. It is easier for me to work with that than with C. I have not quite figured out one thing though. On the new test server shutting down the bot with #die does not work properly any more. The program is shut down (console window disappears) but the bot stays until he gets eaten by a grue. I don't think I have changed anything that could cause this ... any idea where I have to look to fix this? If I shut down the program by closing the console window the bot is gone instantly btw. So I guess something is not sent to the server by just running Disconnect(). Any ideas? Share this post Link to post Share on other sites
Tuver Report post Posted November 17, 2006 out of curosity. the client has it where the home key moves you one step forward. is there a code for one step forward or do I have to use the pathfinder code Share this post Link to post Share on other sites
ttlanhil Report post Posted November 17, 2006 The program is shut down (console window disappears) but the bot stays until he gets eaten by a grue.<snip> If I shut down the program by closing the console window the bot is gone instantly btw. So I guess something is not sent to the server by just running Disconnect(). I don't know anything about the code, but the grue means that it's not disconnected... or your OS is messed up.simply closing the sockets will exit without grue. normally, that always happens. the exceptions being you've got some custom or messed up socket code, or your program is locked up rather than exited (eg: infinite loop, or halted in a debugger), the program isn't closed and its sockets invalidated. I'm guessing that there are threads in use here... if you get console back, but the sockets aren't closed, I'd suspect there's still a thread running holding the socket (but closing the controlling terminal, the console window, will end those background threads as well, hence why that works (unless you explicitly code it so the stuff in background is released from the terminal, which is certainly possible, but you'll usually know if you're using that sort of code)) hopefully that gives you some good hints where to look Share this post Link to post Share on other sites
robotbob Report post Posted November 18, 2006 void CELBot::Loop(){ while (ProcessNextMessageFromServer()) Sleep(100); } IMHO its this piece that would cause the delay. A very rough blocking sockets way to poll for incoming data. I imagine it will miss things, since you have recv timeout + 100 ms. Share this post Link to post Share on other sites