Problem with bot movement

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
Andreas_B
Posts: 40
Joined: Fri Oct 22, 2010 6:46 pm

Problem with bot movement

#1 Post by Andreas_B » Sat Feb 05, 2011 5:57 pm

From time to time the bot "stucks" without any near obstacle. He alternates the direction left and right but don't move until the time for stuck recognition is over.

After a look in the player.lua I got the reason:

Code: Select all

if( angleDif > math.rad(15) ) then
However the bot turns, the difference of his direction to the direction to the next waypoint was ever greater then 15 degrees. After increasing this value to 25 this problem don't occur anymore.

Are there any other user with the same problem?

checkii
Posts: 50
Joined: Sat Oct 09, 2010 8:50 pm

Re: Problem with bot movement

#2 Post by checkii » Sat Feb 05, 2011 6:40 pm

yeah this problem happens a lot. Especially when you have quick turn on and traveling.

Would this interfere with getting stuck though?

User avatar
Administrator
Site Admin
Posts: 5307
Joined: Sat Jan 05, 2008 4:21 pm

Re: Problem with bot movement

#3 Post by Administrator » Sat Feb 05, 2011 11:04 pm

Can you do some more testing with this and ensure that the problem is the angle difference?

Andreas_B
Posts: 40
Joined: Fri Oct 22, 2010 6:46 pm

Re: Problem with bot movement

#4 Post by Andreas_B » Sun Feb 06, 2011 11:33 am

I have made a debug print at this position. I will provide a screenshot next time if the problem occurs again. How checkii wrotes, it happens with quick turn on.

/edit:
the code:

Code: Select all

		if( angleDif > math.rad(15) ) then
			--keyboardRelease( settings.hotkeys.MOVE_FORWARD.key );
			--keyboardRelease( settings.hotkeys.MOVE_BACKWARD.key );

			if( angleDifference(angle, self.Direction + 0.3) < angleDif ) then
					keyboardRelease( settings.hotkeys.ROTATE_RIGHT.key );
					keyboardHold( settings.hotkeys.ROTATE_LEFT.key );
					cprintf(cli.yellow, "Moving left, angelDif:"..angleDif.." / "..math.floor((angleDif*180)/math.pi).." degrees\n");
					yrest(100);
			else
					keyboardRelease( settings.hotkeys.ROTATE_LEFT.key );
					keyboardHold( settings.hotkeys.ROTATE_RIGHT.key );
					cprintf(cli.yellow, "Moving right, angelDif:"..angleDif.." / "..math.floor((angleDif*180)/math.pi).." degrees\n");
					yrest(100);
			end
		elseif( angleDif > math.rad(1) ) then
the output:
Lösche Ziel.
Wir gehen zum Wegpunkt #6, (-14260, -479)
Wir gehen zum Wegpunkt #7, (-13945, -904)
Moving right, angelDif:0.32072977039554 / 18 degrees
Moving left, angelDif:0.30279976252999 / 17 degrees
Moving right, angelDif:0.31762521071371 / 18 degrees
Moving left, angelDif:0.31491158483457 / 18 degrees
Moving right, angelDif:0.32397523455814 / 18 degrees
Moving left, angelDif:0.3463149262447 / 19 degrees
Moving right, angelDif:0.30325128194188 / 17 degrees
Moving left, angelDif:0.31586149090134 / 18 degrees
Moving right, angelDif:0.27353200166943 / 15 degrees
Moving left, angelDif:0.29712931499088 / 17 degrees
Moving right, angelDif:0.2976335897819 / 17 degrees
Moving left, angelDif:0.28606901598812 / 16 degrees
Moving right, angelDif:0.29058416892541 / 16 degrees
Moving left, angelDif:0.31036290680322 / 17 degrees
Moving right, angelDif:0.31364902847037 / 17 degrees
Moving left, angelDif:0.27115473060554 / 15 degrees
Moving right, angelDif:0.29245466304164 / 16 degrees
Moving left, angelDif:0.2690243243768 / 15 degrees
Moving right, angelDif:0.31361860830007 / 17 degrees
Moving left, angelDif:0.31711860746319 / 18 degrees
Moving right, angelDif:0.31209149848397 / 17 degrees
Moving left, angelDif:0.29628862151984 / 16 degrees
Moving right, angelDif:0.33348880800069 / 19 degrees
Moving left, angelDif:0.31691345198322 / 18 degrees
Moving right, angelDif:0.31356054979771 / 17 degrees
Moving left, angelDif:0.32066700709174 / 18 degrees
Moving right, angelDif:0.29759241134507 / 17 degrees
Moving left, angelDif:0.29895023971324 / 17 degrees
Moving right, angelDif:0.31257836472156 / 17 degrees
Moving left, angelDif:0.32063148976502 / 18 degrees
Moving right, angelDif:0.26686831293704 / 15 degrees
Lösche Ziel.
Versuche Spieler frei zu bekommen ... an Position -14270,-473. Versuch #1 von ma
ximal 10 Versuchen.
If you want I can deliver a screenshot also ...

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Problem with bot movement

#5 Post by rock5 » Mon Feb 07, 2011 11:13 pm

I posted my thoughts on why I think this might be happening in this post
http://www.solarstrike.net/phpBB3/viewt ... 559#p18559

Basically I think it sometimes fails to press the forward key and maybe if you are too close to the waypoint it gets stuck trying to adjust the angle and never tries to move forward again. The fix I suggested hasn't been tested yet though.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

Andreas_B
Posts: 40
Joined: Fri Oct 22, 2010 6:46 pm

Re: Problem with bot movement

#6 Post by Andreas_B » Mon Feb 07, 2011 11:30 pm

Sorry, but a simple raise from 15 to 20 degrees for direction checking solves the problem for me. You can see the problem in my debug output. After a direction change the new direction has ever a higher value then 15 degrees and therefore the bot will turn left and right until stuck.

This occurs ever an the same positions at a waypointfile. It don't depend on the distance to the next waypoint. But it depends on the angle of necessary direction change. If this angle has a value a little bit more then 15, then the bot will stuck, because he can't correct the direction successful.

If the distance to the next waypoint is relative high a short movement forward will not solve the problem, because the direction problem will persist. Only for short distances it can solve it, because it changes the angle to the next waypoint.

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Problem with bot movement

#7 Post by rock5 » Tue Feb 08, 2011 2:04 am

The reason it works for you is because if the angle is less than 20 then it goes to the other sections of that 'if' statement which starts it moving forward again. If you get in a situation where 20 is not enough, it will get stuck again. Others have reported setting it to 30 and still getting stuck. If you have it move forward then things will change so it wont get stuck. I'm pretty sure that at that point in the code it's supposed to be adjusting it's direction while moving forward. Maybe Administrator can comment on that.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

Andreas_B
Posts: 40
Joined: Fri Oct 22, 2010 6:46 pm

Re: Problem with bot movement

#8 Post by Andreas_B » Tue Feb 08, 2011 2:45 am

rock5 wrote:The reason it works for you is because if the angle is less than 20 then it goes to the other sections of that 'if' statement which starts it moving forward again. If you get in a situation where 20 is not enough, it will get stuck again.
The value depends on the bot turning. How u can see in the debug prints which i have posted the bot turns about 35 degrees with one turn. The bot cann't correct values below half of this value (therefore a value of 18 instead of 15 will correct the problem also) because the new difference will be greater than the old difference. For what reason the bot turning can get higher values as 35 degrees per turn?

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Problem with bot movement

#9 Post by rock5 » Tue Feb 08, 2011 3:30 am

Andreas_B wrote:The value depends on the bot turning. How u can see in the debug prints which i have posted the bot turns about 35 degrees with one turn. The bot cann't correct values below half of this value (therefore a value of 18 instead of 15 will correct the problem also) because the new difference will be greater than the old difference. For what reason the bot turning can get higher values as 35 degrees per turn?
That sounds about right. I'd like to test if I get the same 35 angle swing but I'm moving a partition at the moment so it will have to wait.

Between the turning starting and stopping there isn't any code that could slow it down. Maybe just slow computers or if the user is using the computer for something else, might slow it down.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

Andreas_B
Posts: 40
Joined: Fri Oct 22, 2010 6:46 pm

Re: Problem with bot movement

#10 Post by Andreas_B » Tue Feb 08, 2011 3:57 am

Another way to solve the problem:
When after a left turn at the same location a right turn should be performed - cancel angle correction. Turning in different directions is a sure sign that bot turning can't get a better direction. This will work with every given angle and should not depend on computer speed.

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 1 guest