toddw123 / RotMG_Clientless

Compatible with version X16.0.0
MIT License
11 stars 4 forks source link

lol lootbots #25

Closed toddw123 closed 7 years ago

toddw123 commented 7 years ago

This is the loot ive gotten after running it for about a 12 hours: http://imgur.com/oWrVyQ5

Its not anything crazy spectacular lol but i still find it interesting. I also had it outputting any pm's the lootbots got, its amazing how many people will pm them and say crap like "fuck you" "give that back!" or whatnot haha

I tried to make mine as fast as the others you see in the nexus. It really is surprising how fast those guys run. To give you an idea, even with moveModifier set to 4, they were still quicker sometimes. But i lowered it back down to 3.5 just because at 4 you tend to get dc'd anytime you move. at 3.5 its not as much. The other ones still beat mine sometimes, but hey oh well.

I also dont have my lootbots sitting at set points. They move to wherever the bag is, and stay there until a new bag drops. It seems most of the ones in the nexus will jump to a bag but then reset to their normal spot.

This has just been a fun little time waster that i wanted to put together. Ill probably continue to add on to this as it is fun to play with. Once i get the objects.xml parsed that will help both the master branch and this one, since right now the items the lootbots pickup are hardcoded. I also want to get something set up that will reconnect disconnected bots after X amount of time. Right now the bots will reconnect up to 6 times if they get dc'd, but after that 6th time they stop (this is just to avoid a never-ending loop).

Anyways, just wanted to share the loot that they've managed to get lol. I have it set up where theres 1 per server. I compiled it for release and am running it that way, having 21 bots running is taking up like 0.2-0.5% cpu for me haha so i could probably bump it up to like 2 or 3 per server if i wanted too.

Anyone else give them a try yet? Interested to see if anyone else has gotten anything or played with the lootbot branch i made yet.

edit: oh and i will say that doing this has helped me find some bugs that i havent figured out yet. For example, sometimes the socket for the client will return INVALID_SOCKET yet the WSAGetLastError() message that gets printed is "Error: The operation completed successfully." lol. So clearly its saying there was no error. Really strange. I also need to come up with a better way to handle reconnecting when the server dc's the bot. Im not too happy with how ive set it up for the lootbot branch.

Zeroeh commented 7 years ago

Yeah, for movement, iirc there are 2 different ways to move. One method is move packets normally but there is another way too. I think by sending fake goto packets to the client will trick it into moving to a coordinate, that's probably how they are so fast.

toddw123 commented 7 years ago

a clientless bot cant do gotos to move. The way you move when you are in a client is you fake getting a goto packet (ie, you send the packet to the client, not the server) which makes your player move on the screen, which by moving on the screen it causes the actual game client to send out the real move packets.

They are definitely doing move packets, but they have an insane move speed lol.

I also think i figured out why i occasionally get a "Error: The operation completed successfully" message when i call WSAGetLastError(). The WSAGetLastError checks the last winsock function that was called, well when you have 20+ threads running and each one is calling winsock functions, the last function called might not be the one you are trying to get the error result for lol.

Zeroeh commented 7 years ago

Yeah, thread safety is something on my todo list.

toddw123 commented 7 years ago

Im checking out getsockopt() right now to see if it can return the error codes for the specific socket instead of trying to get the error code with WSAGetLastError. Theres an option called SO_ERROR that sounds like it does what im looking for. But yeah idk yet

eidt: getsockopt() for errors only seems to work if the socket is non-blocking, i cant find anything useful online about it.

toddw123 commented 7 years ago

so ive made a few more changes, have been messing around with the lootbot code throughout the day. I know i should get back to the regular master branch but this is fun and relaxing for me lol.

Im interested to see how many bots i can have running at once. Although Im worried that if i have too many active connections it will set off some sorta flag/alert. but technically since i have them dispersed between the servers they might not see that many active connections. Right now im running 3 bots on each server (1 server is down), so its like 62 or 63 running all at once ha. Compiled in release mode with debug output turned off the program seems to hang out around <%1 for the most part. Occasionally i see the cpu jump up past %1, but i dont think ive seen it pass %2. My guess is the reason it jumps sometimes is probably due to some of the larger servers someone could be hanging out shooting/using ability/etc (like the trade server im sure has a lot of data being sent to the client). Im wondering if i should try to bump it up to 4 bots per server, which would be 80+ at that point. Maybe ill try that tomorrow haha.

Zeroeh commented 7 years ago

Yeah, my buddy who has clientless in C# managed to get his cpu down to 2% idle with 200 bots.

The lootbot is a nice turn from updating master but I noticed that if there are 2 bags on top of each other the bot only picks up one and leaves the other... I think it's not updating the bag positions after it picks up.

toddw123 commented 7 years ago

it doesnt update any bags manually, it only removes a bag from its list of bags when the update packet tells it the bag is gone, same thing with the contents of the bag. Due to all the other lootbogs (and their speed), i have watched countless times as my screen output "X picked up item in slot X" but was too slow to actually pick it up. The server should send out the update packet with the updated contents of a bag as soon as the item gets picked up though, so i cant see it being that big of a problem.