Creating an internal bot

08/16/2023 20:01 theknig4#1
Hi,

I've been creating bots and other cheats for games for a while now. I usually create bots using memory or image detection but my current bots require the game to be active and in the foreground. I want to take it to the next step and have the bot do things in the background. I've read that there is a few ways to do this.

1- AHK Hotkey ControlSend,ControlRawSend (Didn't work)
2- SendMessage and PostMessage (Didn't work)
3- Memory manipulation (I was able to make character move and some limited things but the thing I was never able to find out is triggering the usage of a skill/item)
4- Packet editing (Tried to learn it but it seems I will need a degree for this :D)

If there is a way to control the game in the background using a simulated keypress would be easiest for me but I think that is unlikely. About memory manipulation, I tried to find the function using Ultimap in the cheat engine but the results are so much I can't find the function.

Would love to get tips from you guys maybe there are other methods I don't know about or a bypass to make method 1 or 2 work.
08/17/2023 06:15 JONNST4R#2
Hey,
all the things you enumerated are not necessarily internal because you can do it without injecting your code into the target process.

To write a good bot you have to find a struct/class (maybe data-structure is a better word) for monster, player, skill, ... . You need this data later to call game functions, check hp, select mob, ... . And you have to find game functions. Example: if you want to call the skill function you have to know how to call the function (what arguments to pass and function pointer) and you require the skill object (address/pointer) because it's one argument in this case.

Firstly you have to UNDERSTAND Assembly especially how to pass arguments, a good way to understand it is to write a calculator in MASM with Visual Studio Community with user input maybe exceptions. You can write code in C and look at the assembly code in Visual Studio.

If you ask for asm most people say look at the calling conventions. If you Google for them, you find the assembly code but if you try to debug some real code you see it's completely different, that's why you have to understand how to pass arguments without them.

Now you have to find a related value to the function you are looking for and run "Find out what writes/accesses to this address" in cheat engine, I'm sure you know how to use this because you know Ultimap. If you get kicked for the game if you try it, don't try to inject anything, you get banned because there is some kind of anti cheat.

Then you can call the functions in the background because you are in the memory space from the game process.
08/17/2023 11:37 theknig4#3
Quote:
Originally Posted by JONNST4R View Post
Hey,
all the things you enumerated are not necessarily internal because you can do it without injecting your code into the target process.
Thanks for the reply, sorry for the misleading title, what I was trying to say with internal is creating a bot that won't interfere with the user at all.

Quote:
Originally Posted by JONNST4R View Post
To write a good bot you have to find a struct/class (maybe data-structure is a better word) for monster, player, skill, ... . You need this data later to call game functions, check hp, select mob, ... . And you have to find game functions. Example: if you want to call the skill function you have to know how to call the function (what arguments to pass and function pointer) and you require the skill object (address/pointer) because it's one argument in this case.
I already found the monster entity list, target select, skill to use, AOE skill position, etc. I pretty much got all the values I would need to create a bot.

Quote:
Originally Posted by JONNST4R View Post
Firstly you have to UNDERSTAND Assembly especially how to pass arguments, a good way to understand it is to write a calculator in MASM with Visual Studio Community with user input maybe exceptions. You can write code in C and look at the assembly code in Visual Studio.
I have been procrastinating learning Assembly for a while now but I guess there is no escaping it if I want to get better.

Quote:
Originally Posted by JONNST4R View Post
If you ask for asm most people say look at the calling conventions. If you Google for them, you find the assembly code but if you try to debug some real code you see it's completely different, that's why you have to understand how to pass arguments without them.

Now you have to find a related value to the function you are looking for and run "Find out what writes/accesses to this address" in cheat engine, I'm sure you know how to use this because you know Ultimap. If you get kicked for the game if you try it, don't try to inject anything, you get banned because there is some kind of anti cheat.

Then you can call the functions in the background because you are in the memory space from the game process.
Can you elaborate on how "Find out what writes/accesses to this address" can help find the function that triggers the skill? For example, there is an address that has the value of the skill to use, once you use a skill the value will change to the skill ID. checking "Find out what writes/accesses to this address" will give a few opcodes and I am guessing these ones aren't exactly the ones I need to call but I need to find the one that starts first from using a skill. I read the tracing of the opcode and seeing where it loops will show the beginning of the function but I am not sure how I can make it loop from a keypress as the game freezes when tracing.
08/19/2023 02:07 JONNST4R#4
Which game? If possible upload your cheat table or pattern to the data structures you already found. Maybe I can help you.

I see some misunderstandings you have what you are looking for, maybe I can explain it later with a working example for your case/game.