Sign in to follow this  
Followers 0
TK_Incorperate

Help with a game.

16 posts in this topic

Ok i'm creating something for this game, trying to find the fastest way from Dot 1 to Dot 2, and i need to know if there's anyway you can detect the fastest way throu exact colors using auto-it.

Example:

Posted Image

See i want it to do like this, automaticaly detect the fastest way to it, is there any possible way? If so i'd REALLY appreceate it if you could let me know.

~TK

Share this post


Link to post
Share on other sites



Ok i'm creating something for this game, trying to find the fastest way from Dot 1 to Dot 2, and i need to know if there's anyway you can detect the fastest way throu exact colors using auto-it.

Example:

Posted Image

See i want it to do like this, automaticaly detect the fastest way to it, is there any possible way? If so i'd REALLY appreceate it if you could let me know.

~TK

What's preventing you from doing this?

---"Educate the Mind, Make Savage the Body" -Mao Tse Tung

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Or even this :P

Eh close enough to the dots but yea...

Edited by Rad

Share this post


Link to post
Share on other sites

Because the dots represent something, they have to be within certain close range of one another, you cant just jump half the area lol. Even if i could do what you guys say, i dont know how to get the thing to automaticaly detect that way to be the fastest.

Share this post


Link to post
Share on other sites

Because the dots represent something, they have to be within certain close range of one another, you cant just jump half the area lol. Even if i could do what you guys say, i dont know how to get the thing to automaticaly detect that way to be the fastest.

the point is you will have to be more detailed in your explanation of the game.

maybe if you told us which game..

more details.

less bitmaps.


---"Educate the Mind, Make Savage the Body" -Mao Tse Tung

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

TK_Incorperate, this type of problem is called as "Traveling Salesman Problem" and "Travelling Salesman Problem" Internet is full of information about it. There are also example programs to solve this. I’m new to AutoIt, but I’m guessing you can covert these examples by hand to fit in AutoIt. However, maybe you just take readily make optimizer and use it by using AutoIt (sounds not too difficult).

Edit:

Well I got it a bit wrong here. This is not Travelling Salesman Problem, however I pretty sure this problem and tools provided to solve it are also usable in your problem too.

Edited by BraveSlice

Share this post


Link to post
Share on other sites

Some games make the pathing of the monsters so badly the monsters become easy to defeat. The answer really depends on your coordinate system. If you are working with a numerical coordinates then the traveling salesman solution is how you want to go. I get the feeling that you are working with pixel data though. So what we really need to know to help what kind of information you have to work with. If it is pixel data can you retrieve coordinate data or use coordinates as determined by the mouse position etc....

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

It's pixel data, see what i'm doing is trying to get the mouse to click on the pixels of the certain color, but i want it to take the FASTEST paticular trail straight to the second point.

Example: You're in a city and every single innersection has red in the middle, you want to get from your house to mc donalds, instead of going to random inner sections until you find mc donalds, you have a map show you where to go.

My house would be point one, Mc Donalds point 2, and the inner sections are the dots, AutoIt would be the map, i dont want it to randomly click until it gets to the red dot, i want it to click the fastest trail possible to get there. After that i already know what i need to do once i get to the red dot so this is the only problem i'm having.

Oh and the first thing isnt the same color as the destination is, because i'm editing game files, so there's no need to try to get it to not go to the first dot, there is no first dot with the editing im doing.

Edit: oh, and to the retreiving coordinate data, nope, thats why i'm creating this bot because nobody has been able to before, however i'm confident that there is some way to detect the fastest way to the second area. With diablo 2 they said this couldnt be done when someone tried making a mephisto bot, but it's been done, so i'm confident i can do it with this, i just dont know how lol.

Edited by TK_Incorperate

Share this post


Link to post
Share on other sites

See if this logic works for you.. The game may not provide coordinate data for you but the mouse or found pixel data provides a coordinate relative to your screen or active application. The screen limits you on how far ahead you can see or click but you know the direction of the target such that you know the slop you must take from a x,y direction. Simply find the nearest matching pixel that falls on or nearest that slop. Once you reach that location then you know the location of self and how far you deviated from the ideal slop. Now you can do a coordinate transforms to determine the best new slop to continue. Using this method once you have determined your coordinates relative to a reference point and the destination coordintes relative to that reference point you can navigate to anywhere from anywhere via bot. You only need to variables, your coordinates and destination coordinates. It would be even more efficient if you tracked your coordinates in real time rather that waiting on reaching a click destination to reset and recalc your own coordinates. That way your bot could search for and click new best paths before reaching the first click destination.

Share this post


Link to post
Share on other sites

I agree with John. What I would do is:

1. Scan the entire screen for all the dots using either PixelSearch or PixelGetColor.

2. Generate the array of coordinates for the dots.

3. From the start coordinate scan the remaining points for any points within range in the correct direction. Some math involved here! For each of the points, move to that imaginary position and repeat this step until the end is found.

I know that there is information on how to do this kind of stuff, because most games will use something similar. Search the internet for game design and see what you find. Some games use a tree structure to keep track of all the possible paths and then calculate the shortest.

Your problem sounds like a space trader kind of game where you want to goto planet x from planet y using the least fuel, with only a certain amount of fuel.

I would be interested in seeing you results posted.


“Give a man a script; you have helped him for today. Teach a man to script; and you will not have to hear him whine for help.”AutoIt4UE - Custom AutoIt toolbar and wordfile for UltraEdit/UEStudio users.AutoIt Graphical Debugger - A graphical debugger for AutoIt.SimMetrics COM Wrapper - Calculate string similarity.

Share this post


Link to post
Share on other sites

Once you know your location and the destination coordinates there would be no need to PixelSearch() the entire screen. Just start the search in the farthest accesible most optimized direction. If you are at coordinate x=0,y=0 and the target location was x=157,y=-283 then searching quadrants

x,y

-x,y

and

-x,-y

would be pointless. the math involved is high school algebra 1 level stuff.

You could also create two PixelSearch(). One the track your progress to a click destination and the other to search for a better destination to click to. The first simply tracks the pixel that you clicked last so that as you move you can use the change in the screen position of that pixel to triangulate your own position in real time or close to it. For network games you would want to stop walking for a second before selecting a new destination due to lag. Because of lag you can only be sure of your actual position if you do the coordinate transforms after you are sure your computer and the server are in sync. However if the bot has prerecorded the coordinates of known pixel locations then the lag will self correct.

Share this post


Link to post
Share on other sites

I dont know witch direction the destination is... it's random, it could be right next to me, i could be in the top left and it be bottom right, or visa versa.

Share this post


Link to post
Share on other sites

You don't know what direction the destination is? That is not at ALL what you indicate in your first post. So you have to search the whole map even when playing without the bot? You seem to be intentionally limiting our knowledge to help you... If your last post is what it seems then there is no "fastest way" to an unknown location. You can only design routines to avoid searching the same place twice and editing the pixels of the game map is pointless for that. Ok ok.. If your playing the game without the bot and you can see the dots to click on, do YOU know which ones to click to get there the fastest? If so how? If not the only bot logic that works is a systematic search avoiding searching the same map region twice.

Share this post


Link to post
Share on other sites

you want to look up a* (a star) algorithms for solving this problem.

Share this post


Link to post
Share on other sites

you want to look up a* (a star) algorithms for solving this problem.

lol ok thanks, but i need to know "how" to do this...

Share this post


Link to post
Share on other sites

We need to know something your not saying to help you.....

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0