Hi,
I want to create a bot for a 2d isometric game, an mmorpg. I havn't seen it attempted, heard people talking about, or found any groups that do this with any mmorpg's let alone this game. I was thinking since it is a 2d isometric game I could get the information such as the current co-ordinates, health etc. by scanning the screen and getting the information that way. I want the bot to move about and do repetitive tasks by itself.
I could do this myself but i'm having trouble with reading the whole screen into a variable and scanning through it. I've tried using CWnd functions to copy the whole screen. This works to the extent that I can say, copy the screen to clipboard or to a bitmap. But I want to be able to copy every pixel on the screen and be able to check each of them for thier colour and then evaluate whether my health is low or where I am.
If someone could point me in the right direction on how to read pixels on the screen for thier colour and sendkeys to application it would be very helpful. I don't even know if i'm approaching on how to do this so any information would be useful.
Doing what you are proposing isn't very easy for what you want to do, it would require pattern recognition and high intelligence to find points of interest on the screen. If there is only colour required to determine health (and it is on a static point on a screen continuously) then it might be easier but I dont know what functions you'll need exactly... Running through each pixel wont be very good either because youll run through millions of pixels and most likely suffer frame glitches during the game.
Best way is to find an API into the game, if none is available try hacking into the game to find the memory location offsets of the health/"co-ordinates" or whatever, you can find these quite easily with a trial & error approach by using a program such as GameHack or your own built program.
if its a windows program, i think there are methods of retrieving colour information, could update the information each time WM_PAINT message is called (as long as the method is trivial), you can also send messages, keys or other information I believe by using SendMessage() into the window.
Thanks for reply i'll try that. I got slightly further, I used GetPixel to check through bitmap handle for certain colours, still not very effective though. Just wondering if there's any other tools about as im on XP, and GameHack is win98 and errors "Unable to load GameHack.VXD". It is a windows program.
ignore the .missing .vxd error with gamehack. there is actually a bug with it crashing in XP, to fix you must select Win32 in "range mode" in the configuration window of it for it to work properly or else it will crash when searching. then select the process and search mem locations
Hi,
the GameHack tool works and I can get the addresses of thing's like Co-ordinates. But health changes everytime I log in or out or restart the application, unlike co-ordinates. It is always C7XXXXXX, what do I do?
Thanks.
you need the offset of the variable, not the exact memory location..
if you find the memory location of the health and co-ordinates, subtract from the memory location of the beginning of the process, you can find this out on the process window i think, if not try debugging with MSVC and view the modules, it will tell you the memory location of the beggining of the module. Once you find the offset you can get the variable back by casting it as a pointer from the mem location e.g. float coord=*(float*)(ProgramStartLocation + offset)
if you are already doing that then maybe you aren't picking up the correct location, keep searching within the locations you found for changes when health changes, increase/decreases/no change etc until you find just one location (or more that are always the same)
if you've done that too, then probably the program is creating the health from a heap and it will be pretty difficult to find this information. you could find the memory location of sometihng relating to the player such as co-ordinates and try seeing if the offset from the co-ordinates and health is always the same (and not the offset from the program's mem location)
oh, if all else fails, maybe you could see if someone has already made a trainer for the game which messes around with a players health, and contact them to see how they found it.
remember that if the program changes (updates etc) most liekly the offsets will change and you'll need to find them again to update your bot program. you could probably create a neat class that stores the offsets for each version if you can find out the version of the program.
Thanks again, i'll keep trying . I must be doing it from the beginning of the process because co-ordinates offset doesn't change, so it's most likely creating it from heap. Which is going to be difficult is this is the case because co-ordinates dont actually change. Maybe I need an address that stores the offset where all the player information is stored?