Results 1 to 6 of 6

Thread: Foundations of botting another game

  1. #1
    Join Date
    Jun 2018
    Posts
    3
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default Foundations of botting another game

    There doesn't seem to be a lot of people using Simba for non-RS stuff, would this be the right place to post questions for that? In the giant essay below I had to remove some links to threads on here, and just put the thread/post ID instead so you can follow it yourself if you want.

    I'm still in the planning stages for the bot I'm working on, but I've got a few questions to help prepare myself for the process. The amount of hours I've put in to color detection scripts on Scar Divi... whew, so I'm mostly looking for a little guidance to help me get settled with Simba as it seems a hell of a lot more active.

    1. What are the, if they exist, core functionality libraries that would be useful for games outside of RS? For instance, the group detection functions found [LINK EXPUNGED, ?p=1391764] will be incredibly useful for my applications, especially ClusterTPA to find a specific group of similar pixels. However, a library that does inventory detection/map navigation/OCR for chatbox in rs wouldn't be useful to me because it's specific to RS. OCR is definitely a functionality that would be really helpful in general though, reading text is crucial. I see functions like rs_GetUpText, etc that probably aren't useful to me, but LoadSystemFont makes me think I could load another font to detect? Any suggestions here would be lovely.

    2. A little specific, but does anyone know a way to efficiently track HUD elements? Specifically, for a game where HUD elements jostle around a bit because they're a part of the world rather than a fixed thing like the inventory + map in RS. A HUD element that doesn't have fixed X/Y coordinates could make life more difficult because I'd have to scan a larger all-encompassing box that guarantees the radar is inside of it, decreasing the performance of the bot. Or, the alternative, find an efficient way to track the elements I need so I can scan a smaller box for the relevant information.

    On that same note, how CPU intensive is simba? Is there something of a "tickrate" in how often the screen can be captured and analyzed for your next action? I was thinking of building my bot with this [LINK EXPUNGED t=113549] method of analyzing the screen along with a littany of inputs to determine what to do next. For instance, to compare it to rs, if some function I write isTraveling() returns true whenever I'm in the process of walking from point A to point B, I wouldn't want to interrupt the bot by clicking somewhere else on the map until that function returns false once I've reached my destination. However, the ability to do this scan+react thing depends entirely on how often I can analyze the screen for such input. In RS, scanning once every second or so would be fine, but for a bot for something like CSGO you need split second decisions so the bot would need to be able to analyze the full screen multiple times a second. I don't plan to be that extreme, but it would help to know just how intensive simba is, what "tickrate" I can update my calculations, and how well I can optimize it to maximize my ability to react as quickly as possible. That's why being able to track the HUD elements would be better than scanning a larger area, assuming the tracking doesn't consume more resources than scanning the larger area in the first place.


    3. Is there a way to detect a certain bitmap with transparency? For instance, finding an X that moves around on the screen. I want to find just the X, but that X can be placed on top of all sorts of other things. So if I were to capture a bitmap of the X, it would include all the extra bits I'd rather cut out. There's probably just something I'm missing about the basic functionality, surely this isn't actually a problem, but I haven't figured it out yet.

    Any help is greatly appreciated, thanks

    has anybody made multithreaded scripts?

    has anyone ever made something to detect groups of pixels in certain patterns? Like a group of pixels that resembles a filled circle, another group resembles a line or curved line, a hollow circle, a box, etc. Detecting shapes and things of that sort would be interesting and potentially useful. Would definitely be paired with the ClusterTPA functions of SRL.

    Is there any kind of live-debugging library for things? Like a script that has a live interpreter and lets me put in various commands, like trying to detect a specific color and then have it draw on top of my client all the detected pixels. Like, for every pixel that gets detected, have it highlight it in white to get a little feedback and help me debug things live. Right now I'm taking a lot of screenshots of various scenarios and testing for consistency of detection with that before building it into a live system.

    does simba have a way to force close a program? Like if I have a status detector that errors out and doesn't know what's going on, or detects that something bad is happening, have it force close the game.
    Last edited by DefinitelyNotMaz; 06-07-2018 at 12:17 AM.

  2. #2
    Join Date
    May 2012
    Location
    Glorious Nippon
    Posts
    1,011
    Mentioned
    50 Post(s)
    Quoted
    505 Post(s)

    Default

    Quote Originally Posted by DefinitelyNotMaz View Post
    There doesn't seem to be a lot of people using Simba for non-RS stuff, would this be the right place to post questions for that? In the giant essay below I had to remove some links to threads on here, and just put the thread/post ID instead so you can follow it yourself if you want.

    I'm still in the planning stages for the bot I'm working on, but I've got a few questions to help prepare myself for the process. The amount of hours I've put in to color detection scripts on Scar Divi... whew, so I'm mostly looking for a little guidance to help me get settled with Simba as it seems a hell of a lot more active.
    I've written maybe a couple dozen scripts for non-RS games, so I'll try to answer what I can. I think most scripters just write for themselves and keep their stuff private, so things might not be quite so dead as they look. A lot of activity has shifted over to the Discord as well: https://discord.gg/RSXyB8E

    1. What are the, if they exist, core functionality libraries that would be useful for games outside of RS? For instance, the group detection functions found [LINK EXPUNGED, ?p=1391764] will be incredibly useful for my applications, especially ClusterTPA to find a specific group of similar pixels. However, a library that does inventory detection/map navigation/OCR for chatbox in rs wouldn't be useful to me because it's specific to RS. OCR is definitely a functionality that would be really helpful in general though, reading text is crucial. I see functions like rs_GetUpText, etc that probably aren't useful to me, but LoadSystemFont makes me think I could load another font to detect? Any suggestions here would be lovely.
    What you're asking for is the basic functionality of Simba itself: http://docs.villavu.com/simba/referencescript.html
    Anything specific to your game would need to be written by you.
    As for text, I've had good results with Tesseract (give this a look), although it's relatively slow, and takes some fine-tuning in most cases.

    2. A little specific, but does anyone know a way to efficiently track HUD elements? Specifically, for a game where HUD elements jostle around a bit because they're a part of the world rather than a fixed thing like the inventory + map in RS. A HUD element that doesn't have fixed X/Y coordinates could make life more difficult because I'd have to scan a larger all-encompassing box that guarantees the radar is inside of it, decreasing the performance of the bot. Or, the alternative, find an efficient way to track the elements I need so I can scan a smaller box for the relevant information.
    Sounds like you just need to search for them each loop instead of using static coordinates.

    On that same note, how CPU intensive is simba? Is there something of a "tickrate" in how often the screen can be captured and analyzed for your next action? I was thinking of building my bot with this [LINK EXPUNGED t=113549] method of analyzing the screen along with a littany of inputs to determine what to do next. For instance, to compare it to rs, if some function I write isTraveling() returns true whenever I'm in the process of walking from point A to point B, I wouldn't want to interrupt the bot by clicking somewhere else on the map until that function returns false once I've reached my destination. However, the ability to do this scan+react thing depends entirely on how often I can analyze the screen for such input. In RS, scanning once every second or so would be fine, but for a bot for something like CSGO you need split second decisions so the bot would need to be able to analyze the full screen multiple times a second. I don't plan to be that extreme, but it would help to know just how intensive simba is, what "tickrate" I can update my calculations, and how well I can optimize it to maximize my ability to react as quickly as possible. That's why being able to track the HUD elements would be better than scanning a larger area, assuming the tracking doesn't consume more resources than scanning the larger area in the first place.
    That needs to be implemented by the scripter with Wait(); It's typical to have a short wait every loop to keep CPU usage down (~200 ms, but it could vary a lot). With your example it would be something like while IsTraveling() do Wait(200);

    3. Is there a way to detect a certain bitmap with transparency? For instance, finding an X that moves around on the screen. I want to find just the X, but that X can be placed on top of all sorts of other things. So if I were to capture a bitmap of the X, it would include all the extra bits I'd rather cut out. There's probably just something I'm missing about the basic functionality, surely this isn't actually a problem, but I haven't figured it out yet.
    Simba's bitmap finding procedures will ignore black (color = 0) pixels, so you can just edit the bitmap yourself. But it sounds like basic color finding with tolerance would suit your needs as well.

    oh, and has anybody made multithreaded scripts? That could be beneficial for my purposes as well, I understand the difficulties of multithreading.
    Multithreading isn't built into Simba, but I think there are some hacky ways to get something working.

    another little thing, has anyone ever made something to detect groups of pixels in certain patterns? Like a group of pixels that resembles a filled circle, another group resembles a line or curved line, a hollow circle, a box, etc. Detecting shapes and things of that sort would be interesting and potentially useful. Would definitely be paired with the ClusterTPA functions of SRL.
    This thread might be useful: https://villavu.com/forum/showthread.php?t=114574
    I've used things like TPA density, aspect ratio, circularity, perimeter, etc. in scripts before, but it's rarely needed IME.

    yet another thought: Is there any kind of live-debugging library for things? Like a script that has a live interpreter and lets me put in various commands, like trying to detect a specific color and then have it draw on top of my client all the detected pixels. Like, for every pixel that gets detected, have it highlight it in white to get a little feedback and help me debug things live. Right now I'm taking a lot of screenshots of various scenarios and testing for consistency of detection with that before building it into a live system.
    Simba has a built-in debug window, or you can use Olly's cool thing: WindowOverlay for Simba 1.2+ and MufasaLayer for Simba 1.1

    Hope some of this is helpful
    Lots of good questions here, so don't be afraid to ask more when you have them.

  3. #3
    Join Date
    Jun 2018
    Posts
    3
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    Some good stuff there, especially the thread about detecting shapes! Very interesting, I'll definitely be able to use that as I need to be able to differentiate between HUD elements that all have the same pixel color but different shape.

    How would I go about killing a process (the client) in case something bad happens. Status detector errors out and doesn't know what's going on, or detects that something went wrong, and I need to kill everything. I could exit gracefully through the game menu but there's a timer and I'd rather just kill the process. I see a really hacky way to do it with sockets, open up a netcat listener waiting and have it kill the game when simba connects. Or, if I can run executables from simba, have a program that will do that. But that's all kinda janky, would there be another way to directly terminate a process with simba?

    This last one is a stretch, but is there any way to use audio queues to do things? If a particular sound is detected, doSomething(). Language processing would be great as a lot of the audio queues are verbal and easily understandable. I'm probably on my own for that one if I want to do it, but I can get around it with other little tricks otherwise.

    Better yet, an answer to all my questions, what is the scope of what I can do with simba? Anything I can do in Lape I can do in Simba? What about plugins, I think I remember reading about making your own plugins for simba on the comprehensive guide thread.
    Last edited by DefinitelyNotMaz; 06-07-2018 at 03:03 AM.

  4. #4
    Join Date
    May 2012
    Location
    Glorious Nippon
    Posts
    1,011
    Mentioned
    50 Post(s)
    Quoted
    505 Post(s)

    Default

    Quote Originally Posted by DefinitelyNotMaz View Post
    How would I go about killing a process (the client) in case something bad happens. Status detector errors out and doesn't know what's going on, or detects that something went wrong, and I need to kill everything. I could exit gracefully through the game menu but there's a timer and I'd rather just kill the process. I see a really hacky way to do it with sockets, open up a netcat listener waiting and have it kill the game when simba connects. Or, if I can run executables from simba, have a program that will do that. But that's all kinda janky, would there be another way to directly terminate a process with simba?
    TProcess is the the first thing that comes to mind: http://wiki.freepascal.org/Executing...grams#TProcess and https://villavu.com/forum/showthread.php?t=112767
    There could be other/easier/simpler methods, but none that I'm familiar with.

    This last one is a stretch, but is there any way to use audio queues to do things? If a particular sound is detected, doSomething(). Language processing would be great as a lot of the audio queues are verbal and easily understandable. I'm probably on my own for that one if I want to do it, but I can get around it with other little tricks otherwise.
    Vanilla Simba is definitely not going to process spoken human language, but maybe you can work something out on your own.

    Better yet, an answer to all my questions, what is the scope of what I can do with simba? Anything I can do in Lape I can do in Simba?
    Yes? Not really sure how to answer that lol. If Simba can't do it, then it's usually not too hard to make your own plugin.

    What about plugins, I think I remember reading about making your own plugins for simba on the comprehensive guide thread.
    Docs are here: http://docs.villavu.com/simba/simbaref/plugins.html
    I believe Brandon has a C/C++ template somewhere as well.

  5. #5
    Join Date
    Jun 2018
    Posts
    3
    Mentioned
    0 Post(s)
    Quoted
    3 Post(s)

    Default

    I can't seem to get simba to actually press anything in the game. KeyDown(vk_up) doesn't seem to press the key, with a wait(1000) and KeyUp(vk_up) after that. Search doesn't seem to have a lot of cases of KeyDown/KeyUp not working for people, am I missing something? Obviously this isn't any runescape client, but I'm targeting the right window and putting focus after starting the script, but it doesn't seem to press any keys.

    tried 37/38/etc for arrow keys to no success. Tried KeyDown(GetKeyCode('z')); and other such examples, nothing. Simba running in admin mode, game focused when script is going, have wait(5000) at the start to make sure, not sure what's going on.
    Last edited by DefinitelyNotMaz; 06-08-2018 at 07:43 AM.

  6. #6
    Join Date
    May 2012
    Location
    Glorious Nippon
    Posts
    1,011
    Mentioned
    50 Post(s)
    Quoted
    505 Post(s)

    Default

    Quote Originally Posted by DefinitelyNotMaz View Post
    I can't seem to get simba to actually press anything in the game. KeyDown(vk_up) doesn't seem to press the key, with a wait(1000) and KeyUp(vk_up) after that. Search doesn't seem to have a lot of cases of KeyDown/KeyUp not working for people, am I missing something? Obviously this isn't any runescape client, but I'm targeting the right window and putting focus after starting the script, but it doesn't seem to press any keys.

    tried 37/38/etc for arrow keys to no success. Tried KeyDown(GetKeyCode('z')); and other such examples, nothing. Simba running in admin mode, game focused when script is going, have wait(5000) at the start to make sure, not sure what's going on.
    What game? Hard to help if nobody can test for themselves.
    Posting your code also helps.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •