Jump to content
Eternal Lands Official Forums
Sign in to follow this  
(Athosino)

Simple Bot Framework

Recommended Posts

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 by LabRat

Share this post


Link to post
Share on other sites

hey i like it :P 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

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

i just wanna be able to make a bot move to certain places at my command :P

 

For that you would have to implement a pathfinder, what I really cannot do.

Edited by (Athosino)

Share this post


Link to post
Share on other sites

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

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

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
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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×