Best algorithm for finding HP bar in pixel based bot

04/30/2015 13:28 matt69#1
hi guys,

So i have made a few pixel based bots but can never seem to get the bot to hit mobs the way i would like it to.

The current method i am using involves checking if mobs are in the rectangle where i can hit without moving and if not then scan for nearest mob. However, it always seems to go to the left, so if there is a large group of mobs it would run out of the group and attack 1 mob on the left.

Has anyone got a better algorithm for identifying which mob to attack.
04/30/2015 15:52 abdaboda#2
can you share it ?
04/30/2015 16:44 pro4never#3
The issue you're having is because you're looping through possible coords

for x = 0; x < maxX; x++
for y = 0; y < maxY; y++


You have two options.

#1: Randomize the direction you start searching from (top left, bottom left, top right, bottom right)
#2: Search from the center outwards in a spiral formation (will solve the need for your duplicated code)

Here's some discussions on spiral searching
[Only registered and activated users can see links. Click Here To Register...]