Tech Support Guy banner
Status
Not open for further replies.

Control multiple instances of the program at the same time

4K views 13 replies 7 participants last post by  Xsage 
#1 ·
I'm trying to make a bot for a game.
I can open multiple instances of the game client.

My progress of the bot:
Right now I can only run the bot on 1 game window at a time (because I can only focus 1 window at a time), then after the bot finishes doing its task in that 1 game instance, it will move onto the next game instance and do its task and repeat.
(the game instances are stacked on top of each other, and I have a list of each specific instances (processes) in my bot so the bot can just focus on which specific instance it needs to control next)
(I use the user32.dll to do mousemove to that 1 mouse cursor, and windowsinput library to do clicks and keyboard presses)


Problem:
I want the bot to control all the game instances at the same time.
But the problem is it needs to be focused first before it receives mouse/keyboard inputs.

Ideas / What I've done:

  • I tried using the multiple desktop feature of windows 10, opening 1 game instance for every desktop. But I tried running the bot and it doesn't click when I'm not focused on that particular desktop. Also the bot has OCR and it doesn't do OCR correctly if I'm not on that specific desktop that the specific game instance is on.
    (Is there a way to still be able to OCR, say Desktop2's screen even if I'm in Desktop1?, also be able to do mouse click Desktop2's screen even if I'm in Desktop 1?)
  • I'm thinking maybe to use virtual machine, but I don't have much knowledge with it.
    (Is there someway I can use virtual machine to solve my problem?)
  • Maybe multiple mouse cursors and keyboards? Not sure if it's possible.
    (But still the problem of focusing on the game instance is present, so multiple mouse/keyboard might not help)
Again, main point is that I need some way for the bot to be able to control multiple game instances at the same time.

Is this possible?
(if all else fails, I guess I have no choice but to run each instance on different PCs...)
 
See less See more
#2 ·
Hey Tenick, before I begin, let me just say that I am not completely familiar with programming. I am only about a year in to my self-studies. However, I believe you would be limited to the number of mouse command inputs per computer.
With that said, I would like to say that using virual machines to run your games might be a viable solution depending on how graphic intensive and resource demanding the game is since you will have to designate a set amount of resources (RAM, Cores, etc) to those VMs.
A better solution IMHO would be to find the command sent to the server for the action you are attempting and set your script to complete those commands for each instance.
 
#3 ·
Hey Tenick, before I begin, let me just say that I am not completely familiar with programming. I am only about a year in to my self-studies. However, I believe you would be limited to the number of mouse command inputs per computer.
With that said, I would like to say that using virual machines to run your games might be a viable solution depending on how graphic intensive and resource demanding the game is since you will have to designate a set amount of resources (RAM, Cores, etc) to those VMs.
A better solution IMHO would be to find the command sent to the server for the action you are attempting and set your script to complete those commands for each instance.
Hi thanks for replying. I guess I'll give virtual machines a try. I'll come back to share results.
For your 2nd suggestion, It's my first time hearing that kind of approach for automating online software. Do you have any resources that I can read more about that kind of approach?
 
#6 ·
Game bots have nothing to do with cheating in a game. A lot of MMO's and FPS games have bots....and these bots are there just to help the player in a single person game setting, to make it more realistic and fun. Best example is L4D/L4D2....my all time favorite FPS. Which BTW has released a new campaign to the franchise called "The Last Stand".

That said, I think the OP is creating a game and trying to figure out how to code the bots to perform multiple tasks in a certain sequence of events at specific times when the user performs a certain task while at a certain point in the game. This is why the Gaming industry is so lucrative and those guys/gals get paid the big bucks to do such coding.
 
#14 ·
That said, I think the OP is creating a game and trying to figure out how to code the bots to perform multiple tasks in a certain sequence of events at specific times when the user performs a certain task while at a certain point in the game. This is why the Gaming industry is so lucrative and those guys/gals get paid the big bucks to do such coding.
I don't think this is the case based on a few things the OP mentioned:

the game instances are stacked on top of each other, and I have a list of each specific instances (processes) in my bot so the bot can just focus on which specific instance it needs to control next
If he was creating in game NPC bots he would not need multiple instances of a process open. There is no effective way to create co-op NPC bots to assist the player fairly without access to the source code, injecting into the process and altering the code itself or developer build modding tools.

I use the user32.dll to do mousemove to that 1 mouse cursor, and windowsinput library to do clicks and keyboard presses
As he is using user32.dll he is trying to simulate mouse clicks through the windows API itself and not through the game's own code. This only works on not very complex games, think puzzle pirates where botting was a major issue, by sending mouseclicks throught he windows API, there is now way for the game to detect that the user is botting using conventional anti-cheat methods.

Also the bot has OCR
OCR is a technique to take a picture of a portion of the screen and use a neural network to convert that image into a string of character as if it was typed by a keyboard. This is used in things like Adobe PDF to convert scanned documents into word documents.

Again, main point is that I need some way for the bot to be able to control multiple game instances at the same time.
He ends on mentioning about his program needing to control multiple game isntances at the same time, which strongly leads me to believe he is refering to a technique called "multi-boxing", there are two versions of multi-boxing:
  1. One where a human sits there and manually controls all players in multiple windows themselves which is acceptable in some game under certain circumstances,.
  2. One where you get a "bot" to control all or most of the windows to automate tasks in the game and farm things like currency and experience without the user needing to be present or control the game, which can be considered cheating and is against the rules in nearly every online game. The OP seems to be going for the latter as he refers to it as a bot. However, this could be consider acceptable in a single play game.

I don't know much about games but is this a way of cheating or gaining an advantage over others?
So without further clarification from the OP, I would agree with this statement ^
 
#12 ·
I can't say for sure for Windows but for mobile apps, including those that use an emulator like bluestacks to play the MMOs online I can see that happening.. but nowadays it's typically people that have too much (of someones?) money to burn and just going from 1 to 25 in a week that kills the games...
 
#13 ·
Problem:
I want the bot to control all the game instances at the same time.
But the problem is it needs to be focused first before it receives mouse/keyboard inputs.
I suppose you do not own the game? have no control over game?
You can broadcast mouse messages (or any other messages) to all top level windows in the system:
https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-sendnotifymessagew

Important not to forget is to specify HWND_BROADCAST as target window, the rest of parameters specify mouse message.
 
Status
Not open for further replies.
You have insufficient privileges to reply here.
Top