Creating a Pixel Bot in C# from zero  - "kinda" tutorial menu

User Tag List

Page 3 of 9 FirstFirst 1234567 ... LastLast
Results 31 to 45 of 122
  1. #31
    geekyhuff's Avatar Member
    Reputation
    1
    Join Date
    Feb 2018
    Posts
    1
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Are you planning on ever adding this to github?

    Creating a Pixel Bot in C# from zero  - "kinda" tutorial
  2. #32
    Humbleguy's Avatar Active Member
    Reputation
    24
    Join Date
    Dec 2019
    Posts
    27
    Thanks G/R
    6/5
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by geekyhuff View Post
    Are you planning on ever adding this to github?
    Probably not, as once full code gets public domain, that might be a way to stuff being detected. I think It would be better to share methods and knowledge, so that everyone can make their own... Yet my code as it is, is not much portable (it needs tu run the game at my PC exact resolution to work, code is not commented in english, nor optimized, has no try/catch error checks for example).

    I have made a better quality and bigger video to show the bot in action, as it is now.


  3. #33
    ggnidalee's Avatar Member
    Reputation
    1
    Join Date
    Dec 2019
    Posts
    2
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Humbleguy View Post
    Probably not, as once full code gets public domain, that might be a way to stuff being detected. I think It would be better to share methods and knowledge, so that everyone can make their own... Yet my code as it is, is not much portable (it needs tu run the game at my PC exact resolution to work, code is not commented in english, nor optimized, has no try/catch error checks for example).

    I have made a better quality and bigger video to show the bot in action, as it is now.

    Hey man, can you reply my private message to you? I would love to share some knowledge between us. Also portuguese here

  4. #34
    MrNotSoBright's Avatar Member
    Reputation
    1
    Join Date
    Jul 2019
    Posts
    10
    Thanks G/R
    1/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nice work!

    I've made a fishing bot which works fine, although no ressing etc just fishing, and I'm in the progress of making a grinding bot (minimal combat atm). I saw your planned future extensions of this bot of your, regarding herb/mining, and I've had the same thoughts. My approach was going to be scanning the minimap, to get approximate location, and use hover and the tooltipbox to see if I've found it. I've not tested this, but this approach seems not really foul proof, especially without navmesh.

    Does anyone have any input regarding the tactics with pixelbots and herb/mining?

  5. #35
    Humbleguy's Avatar Active Member
    Reputation
    24
    Join Date
    Dec 2019
    Posts
    27
    Thanks G/R
    6/5
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by MrNotSoBright View Post
    Nice work!

    Does anyone have any input regarding the tactics with pixelbots and herb/mining?
    From my perspective, a bot is considered a "slave", to grind stuff (money) for me while I sleep or work, so that I can use my (short) available time to have fun, doing dungeons or raiding. Farming gold in classic is very annoying and I simply have no time nowadays to spend 2 hours at Uldun mining Thorium as I had years ago. Thats the objective of botting. I do not want to sell gold or anything like that, just maxmize my fun. That being said, I can get money farming stuff grindind (e.g Rugged leather, Crusader Recipe, or even gray trash at basilisks), fishing, and farming ore/herbs. I think its a bit "bannable" grind mobs for hours... and leather prices are a bit low (as make a grind bot is somehow doable by average programmer). Making a herb/ore farm bot in classic is another story. You can't simply target ore/herps with tab-targeting, and finding them would need some kind of "computer vision", wich is a deeper proccess. I have not started yet this project, but I have some very promising ideas:

    My first idea (not even tested) would be keep the camera at 90 degrees (perpendicular from the player), just like a 2D game, to make navigation easier, and scan the minimap for yellow spots (ore/herps). scanning the minimap can be done with fixed spots or even "for" loops. One single yellow pixel might be enough to detect a node. Once you have detected the node, you turn the player (A and D keys) until its facing the correct direction (north), using do/while loops until you reach the point.

    Once you reach the exact spot (yellow at center), just click the area in the center of your game screen, to interact with target. Scanning for mouse cursor change would show the spot is right.

    Avoiding obstacles (trees, rocks) is an issue to be dealed, as ore usually is at cliffs, and herbs are near trees, One way to deal with that would be 1) creating a navmesh (more difficult but more efficient), and using navigation algorithims like Dijkstra's to plan the best route from current position to node, or 2) Trial-and error approach, jumping/and/or moving around when you find an object (speed==0). or even a mixed approach 3) Using Gathermate2 database to know ore/herbs spots and create a "database" of waypoints to each node (trails), with a recorded xy startpoint, then using a "foreach" iteration associated to a coorinate distance formula (distance from x1y1 to x2y2) to find the nearer "trail" start to that node (less complex).

    On the issue to create a navmesh, I think that proccess can be automated, creating a "mapping" tool, where your player will walk around every possible place at the map and store the accessible coordinates in a bidimensional array. (e.g. int lochmoldan[999][999]), where each array position would save info from that spot (e.g acessible? inaccessible? Nearest accessible spots?). That would not be so difficult to do. Thinking about it now(fast initial idea), a zone map could be an array of Boolean struct; 999x999 each position representing one location of the map with decimal precision. Array size would be an issue, so I would create a struct made of 9 booleans:

    Code:
    Struct spot
    {
    bool self; // current spot
    bool N; // flags below, e.g "is it possible to walk from spot.self to spot.N" ? 
    bool S;
    bool E;
    bool W;
    bool NE;
    bool NW;
    bool SE;
    bool Sw;
    }
    spot[] lochmoldan[999][999]; // array with region map, from 0.0 to 99.9 xy
    To make things clearer, map coordinates would be stored at array position, for example: map position x=12.3 y=45,5 in loch moldan would be stored in the variable "(spot) lochmoldan[123][455]".
    The “self” means: is acessible; the rest mean “can I walk from “self” to the this spot?”
    Each spot would be only 9 bits in size, so the whole zone map would have 1 million bits, or 125k... very lightweight and enough to create routes to any spot in the game. The "mapping tool" would be a loop where the player (bot) should visit every single spot in the map, and from there trying to reach the 8 adjascent spots; setting flags. This array would be saved to files, and presto, we have a navmesh. I would add a 9th entry, "tested", as a control flag whether the spot has been tested or is "undiscovered" zone.

    The same approach (minimap scanning for yellow dots) could be use to create a pool-fishing bot. Whenever you find a dot, you get closer, turn and cast the fisihing skill. That would definetely be easier to code, and Stonescale Eels are very profitable this way at tanaris coast.

    What do you guys think of those ideas? None are implemented, but everything above is doable. At the long-run, i think creating zone navmeshs is best thing to do.... so that we can have a bot "similar" to what honorbuddy was in functionality. That might be a project to be done in a group of coders.
    Last edited by Humbleguy; 12-20-2019 at 12:37 PM.

  6. #36
    MrNotSoBright's Avatar Member
    Reputation
    1
    Join Date
    Jul 2019
    Posts
    10
    Thanks G/R
    1/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Humbleguy View Post
    Text
    Then we kinda had the same idea, with a slightly diffrent execution. Regarding clicking in the middle of the screen, I think you'll need atleast some area to scan and verify that the mouse is atleast hovering a node. Some nodes (like Briathorn) are almost always around trees, and just with minimap scanning it can be hard to find the exact location. I havn't verified this, but I'm sure there must exist some shared profile for GatherLite, which probably could be used if your addon checks for nearby nodes and writes the coordinates via pixels. By this you also avoid a majority of nodes which can't be reached.

    However regarding saving node positions, I've seen other bots do the opposite, that is blacklisting nodes or areas.

    I've taken a little look at navmash with R&D, and one problem I haven't "solved" or understood is how to use the Z-coordinates from navmesh.
    Since you can't get the Z-position from WoW API, how do you know exactly were you are? Are you in a tunnel, or need to run up a path in the tunnel?

  7. #37
    Humbleguy's Avatar Active Member
    Reputation
    24
    Join Date
    Dec 2019
    Posts
    27
    Thanks G/R
    6/5
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Checking if the mouse is over a node is not difficult at all, that can be done for example checking for tooltip, or checking mouse cursor change. Both methods are currently used by people to check if a dead body is skinnable, for example. I have used the second approach (check for mouse cursor change). That can be used to create a fishig bot, either. When we had the system option "turn on/off hardware cursor", I used to just check for raw mouse cursor color check (e.g check color at currentmousepos+1 would land onto the cursor itself...) . As this option does not exist anymore, we can check for mouse cursor "handle" change, to see if cursor has changed, like this. If handle changed, then cursor changed.



    About Z coordinates:
    Game does not show Z coordinate, so thats information we do not have. Navigation thru two-storey buildings will be an issue for sure, and I think the best way to handle that is just avoiding such places. If you think about programming only, it would be possible to discover moving angle comparing X,Y speed with game reported speed (e.g. if game reports moving at speed 100, and coordinates show you are moving at speed 50, then you are at a 45 degree angle movement, and you could be able to update your Z position, just like North Koran rockets do to navigate (inertial localization). But i think that would be too much work and too litle benefit, so ignoring Z coordinate might be a better way, and recording possible paths seems to be an easier approach.
    Just like we can convert X,Y,Z to X,Y, you can "reverse engineer" that (with limitations).

    NAVIGATION MESH MAPPER UPDATES
    -----------------------------------------------------------------

    From yesterday to today, I started some tests with zone mapper tool (will capture zone maps and create a navigation mesh, so that the bot is not "blind" to navigate).

    I used an array of binaries (matrix) quadri dimensional (x,y,z,w), with x=999 y=999 z=10 w=2 elements:
    as follows:

    x and Y: 999x999 = map position with decimal precision (0.0 to 99.9)
    Z (0-9) = flags wether N, S, W, E, SW, WE, NE, NW are acessible from current position. The 10th position
    is a flag to say that (is zone acessible? e.g. not inside a tree)
    the last dimension (W) says if spot has been visited, or is unknown zone.

    Whenever I move around the map, the map capture tool will read my current position, and store its data at the array. After program closes, map will be updated and saved to a file.

    It looks like "snake game" when moving freely, but now I must to do a routine that will make the bot move by itself, in a coordinated way, visiting every single spot in the map to capture the zone terrain.

    A demo of the above, so far:
    Last edited by Humbleguy; 12-21-2019 at 10:58 AM.

  8. #38
    MrNotSoBright's Avatar Member
    Reputation
    1
    Join Date
    Jul 2019
    Posts
    10
    Thanks G/R
    1/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Humbleguy View Post
    Checking if the mouse is over a node is not difficult at all, that can be done for example checking for tooltip, or checking mouse cursor change. Both methods are currently used by people to check if a dead body is skinnable, for example. I have used the second approach (check for mouse cursor change). That can be used to create a fishig bot, either. When we had the system option "turn on/off hardware cursor", I used to just check for raw mouse cursor color check (e.g check color at currentmousepos+1 would land onto the cursor itself...) . As this option does not exist anymore, we can check for mouse cursor "handle" change, to see if cursor has changed, like this. If handle changed, then cursor changed. ]
    Yea I know, that's why I said you probably will need to scan for it when u hover when nodes can be in weird places.


    Originally Posted by Humbleguy View Post
    ...NAVIGATION MESH MAPPER UPDATES...
    ]
    Are you planing on creating your own navigation mesh for each playable zone by visiting all the places?
    You do know there exist libraries for this, like Recast & Detour ? That is what I was talking about.

  9. #39
    fedelis's Avatar Active Member
    Reputation
    58
    Join Date
    Jul 2008
    Posts
    54
    Thanks G/R
    7/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    +rep for the nice tutorial. I've been using weakauras+a mouse&keyboard macro recorder to run a pixel based combat rotation bot. Still do all the driving and pulling myself, but once in combat the recorder takes over.

  10. Thanks Humbleguy (1 members gave Thanks to fedelis for this useful post)
  11. #40
    Humbleguy's Avatar Active Member
    Reputation
    24
    Join Date
    Dec 2019
    Posts
    27
    Thanks G/R
    6/5
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by fedelis View Post
    +rep for the nice tutorial. I've been using weakauras+a mouse&keyboard macro recorder to run a pixel based combat rotation bot. Still do all the driving and pulling myself, but once in combat the recorder takes over.
    Thank you man for the rep. All you need to turn a rotation bot to a full grind bot is a navigation system, which in fact is not much difficult to do. Keep a list of coordinates (waypoints) as "profiles", read each coordinate, turn to the right direction, and press "w" key until you get there... if you get into combat meanwhile, start combat rotation.
    Last edited by Humbleguy; 12-25-2019 at 06:53 AM.

  12. Thanks madfotter (1 members gave Thanks to Humbleguy for this useful post)
  13. #41
    kaysonv's Avatar Member
    Reputation
    1
    Join Date
    Dec 2019
    Posts
    1
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey Humbleguy, I have a dumb question here: Do you know how to extract coordinates in battlegrounds? The

    C_Map.GetPlayerMapPosition

    isn't quite working in battlegrounds. Many thanks for any help!

  14. #42
    Angler23's Avatar Member Authenticator enabled
    Reputation
    13
    Join Date
    Jan 2019
    Posts
    30
    Thanks G/R
    10/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    1st, +rep and thanks for the weakaura strings. And this whole tutorial. You put a lot of effort into it, looks great.

    1 concern I have is blizzard seeing everyone using the same weakaura strings, not sure if they are able to detect something like that?

    Would be curious to hear everybody's thoughts.

    Thanks again for the solid tutorial

  15. #43
    Ganndos's Avatar Member
    Reputation
    1
    Join Date
    Dec 2019
    Posts
    2
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Humbleguy View Post

    DISCOVER THE ANGLE NECESSARY TO TURN FROM CURRENT(X,Y) to TARGET(X,Y)
    ----------------------------------------------------------------------------------------------------------------------------------------
    This is tricky. The only way to do this is using the trigonometric function atan2. This is not much friendly. The most important thing you need to know is that this function uses Y before X at the arguments. I am very sorry for you, but there is no easy way to do that without using trigonometry functions. It will be something like this:
    Code:
            double getangle(double y1, double y2, double x1, double x2)
                {
                double ang =    Math.Atan2(x1 - x2, y1 - y2)/Math.PI;
                if (ang < 0) ang += 2; // this is used to avoind negative numbers. 
                return Math.Round(ang*1000);
                }
    if you are REALLY not into trigonometry and angles, you can try a trial-and-error approach (its more difficult to implement):
    - Check distance between position and target
    - Start walking.
    - If distance increased, turn right or left.
    - Repeat until distance starts decreasing.
    - Check how much distance decreased per second.
    - Stop turning when distance decrease per second is at max. (90 degree to your direction).

    I do not recommend the above, tho.
    First of all thank you very much for creating this tutorial. I used this as entry point for creating an own bot and it helped me very much so far.

    Currently I have one problem where I can not achieve the same as you did. You mentioned here you used the target coordinates to calculate the distance and the angle to the target. My problem is I can not get the target position for enemies. I get only the position for group and raid members.

    To get the position I tried the following lua methods:
    Code:
    local map = C_Map.GetBestMapForUnit("player")
    local position = C_Map.GetPlayerMapPosition(map, "player")
    and
    Code:
    posY, posX, posZ, instanceID = UnitPosition("unit");
    For both methods I found in a description that they are only working for group or raid members. I could find anything else that gives me the position of an enemy.

    Is there a way to get directly the position of an enemy? Or what do you use to move and aim to an enemy?

  16. #44
    stonebent's Avatar Member
    Reputation
    9
    Join Date
    Sep 2008
    Posts
    36
    Thanks G/R
    3/8
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Ganndos View Post
    Is there a way to get directly the position of an enemy? Or what do you use to move and aim to an enemy?
    Once you have targeted your enemy, simply press the "interact with target" button. This will make your character face the target and walk towards it. You can then check the distance to your target and decide wether you want to stop moving or not.

    Note: you need to have CTM enabled.

  17. #45
    Ganndos's Avatar Member
    Reputation
    1
    Join Date
    Dec 2019
    Posts
    2
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by stonebent View Post
    Once you have targeted your enemy, simply press the "interact with target" button. This will make your character face the target and walk towards it. You can then check the distance to your target and decide wether you want to stop moving or not.

    Note: you need to have CTM enabled.
    Thank you very much, works very well!

    For all who wants to try it out too, here some additional info:

    The "interact with target" button is not set by default, you need to bind it in the game (Key Bindings/Targeting). CTM - Click to move can easily be activated in the interface (Interface Options/Mouse).

    If you use "interact with target" it has a very nice behavior. On friendly NPC (if you can talk with them) it will move you to them and open the interaction with them (quests, shop or chat). On enemy target it will bring you so far that the char can start with auto attacks and then activates the auto attack (for my hunter it was the range of his bow).

Page 3 of 9 FirstFirst 1234567 ... LastLast

Similar Threads

  1. [Question] Has anyone ever made an entire farming-bot with much much pixel-reading in AutoIt?
    By crunk001 in forum WoW Bots Questions & Requests
    Replies: 18
    Last Post: 02-05-2017, 06:34 AM
  2. Gold from botting in MOP
    By 403Forbidden in forum WoW Bots Questions & Requests
    Replies: 3
    Last Post: 01-16-2013, 06:49 AM
  3. Replies: 0
    Last Post: 09-09-2012, 06:38 AM
  4. Replies: 4
    Last Post: 04-18-2010, 12:47 PM
  5. Botting in Barrens 12-20
    By karokekid in forum World of Warcraft Bots and Programs
    Replies: 20
    Last Post: 12-02-2006, 07:21 PM
All times are GMT -5. The time now is 07:38 AM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search