CPU freq.

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Message
Author
User avatar
Administrator
Site Admin
Posts: 5306
Joined: Sat Jan 05, 2008 4:21 pm

Re: CPU freq.

#41 Post by Administrator » Thu Sep 03, 2015 2:53 pm

Those changes are not causing additional problems, it is just that they aren't causing any errors in themselves.

The issue here is just that your computer is having issues handling so much going on at once. If anything causes even the slightest hiccup, that causes the memory reads to be delayed, which then result in the RoMbot erroring out as it cannot access the game's memory. The only way to get around that is to patch every memory read so it continues to retry until it goes through.

User avatar
beanybabe
Posts: 647
Joined: Wed Mar 06, 2013 1:27 am

Re: CPU freq.

#42 Post by beanybabe » Thu Sep 03, 2015 4:18 pm

I put in code to test for the memory read problem even if i loop it 15 times checking I get the exact same results.

I was thinking about it this am and I am running my machines in energy saver mode much like the way a laptop runs. These cpu's will vary from 1 to 8 cores and may vary speeds also to keep heat down and save energy. I think they change frequency also to achieve this.
local tmp -- just does not work I had to remove it.

I tried to create a test program but the bot does not seem to be able to click leave in drill ground.
The bot is unable to select the leave option on these path.
needle drill
rescue trial
first aid training
mass barrage

I create a test wp with some that worked. This only fails now and then.
Attachments
find the bug test.xml
(3.78 KiB) Downloaded 247 times
Last edited by beanybabe on Thu Sep 03, 2015 6:10 pm, edited 1 time in total.

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

Re: CPU freq.

#43 Post by Administrator » Thu Sep 03, 2015 4:40 pm

I haven't even had a copy of the game in years. I'm sure someone else would be able to help you out though.

User avatar
beanybabe
Posts: 647
Joined: Wed Mar 06, 2013 1:27 am

Re: CPU freq.

#44 Post by beanybabe » Thu Sep 03, 2015 6:13 pm

the following changes let it work for hour or more usualy before a problem. running a regular loop waypoint killing mobs is not affected by this.

i think it can be made to work if there is way to get a adjustment number for the cpu speed. untill a better way is found/
These are the code changes I am using beside the skills with I did not list.

player.lua
887 skill.LastCastTime = skill.LastCastTime + (remaining*1000 * bot.GetTimeFrequency)

memorytable.lua
213 return name .. memoryReadRepeat("string", proc, nameaddress)

bot.lua
326 local freqadj = 1234 --need way to get this number based on cpu speed somewhere i listed how to get the number i use.
--local freqadj = 1000 --origianl number
if( getTimerFrequency ) then
-- Grab the real frequency instead of calculating it, if available
bot.GetTimeFrequency = getTimerFrequency().low / freqadj;
else
-- calculate the CPU Frequency / used for manipulation the GetTime() values
local calc_start = getTime();
yrest(freqadj);
local calc_end = getTime();
bot.GetTimeFrequency = (calc_end.low - calc_start.low) / freqadj;
end

User avatar
beanybabe
Posts: 647
Joined: Wed Mar 06, 2013 1:27 am

Re: CPU freq.

#45 Post by beanybabe » Thu Sep 03, 2015 7:45 pm

this return the cpu speed if there is a way to put it in the batch file and send variable to bot.lua that can be a temp fix.
wmic cpu get MaxClockSpeed


I found this to try setting affinity to only 1 cpu for the bot im going to try that next.
START /affinity 1 ../../micromacro.exe "%~dp0/bot.lua"

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

Re: CPU freq.

#46 Post by Administrator » Thu Sep 03, 2015 10:37 pm

No need for a batch script.

Code: Select all

	local szMaxClockSpeed = system("wmic cpu get MaxClockSpeed");
	local parts = explode(szMaxClockSpeed, "\n");
	maxClockSpeed = tonumber(parts[2]);
	print("Clock speed:", maxClockSpeed);
After running that code, maxClockSpeed will contain the number returned by that system command.

User avatar
beanybabe
Posts: 647
Joined: Wed Mar 06, 2013 1:27 am

Re: CPU freq.

#47 Post by beanybabe » Fri Sep 04, 2015 2:04 am

I got mixed up trying to figure a formula and just went with the following and replaced all other timing code to test it.
Ran it for few hours it seems best way i tried so far. Need others to test it with dual core and quad core cpus and amd

Code: Select all

 if( getTimerFrequency ) then
      local szMaxClockSpeed = system("wmic cpu get MaxClockSpeed");
      local parts = explode(szMaxClockSpeed, "\n");
      maxClockSpeed = tonumber(parts[2]);
      print("Clock speed:", maxClockSpeed);
      bot.GetTimeFrequency  = maxClockSpeed
 else
      -- calculate the CPU Frequency / used for manipulation the GetTime() values
      local calc_start = getTime();
      yrest(1000);
      local calc_end = getTime();
      bot.GetTimeFrequency = (calc_end.low - calc_start.low) / 1000;
end

User avatar
beanybabe
Posts: 647
Joined: Wed Mar 06, 2013 1:27 am

Re: CPU freq.

#48 Post by beanybabe » Sun Sep 06, 2015 4:35 am

What does this cpu fequency thing do actually when it worked sort of Thursday and Friday but Saturday it just fails.

Then I thought what if number is double the cpu frequency. That makes it fail more.

So I thought what if i set the frequency to 1, it still works with it at 1. Could there be some thing wrong later in the code or does this just not do what is supposed to do?

maxClockSpeed=1
or original bot code bot.GetTimeFrequency =1

Code: Select all

--- bot.lua
	bot.GetTimeFrequency  = maxClockSpeed 
	printf("[DEBUG] CPU Frequency %s\n", bot.GetTimeFrequency);
--- player.lua	
	--skill.LastCastTime.low = skill.LastCastTime.low + casttime*1000 * bot.GetTimeFrequency;
	skill.LastCastTime = skill.LastCastTime + (casttime*1000 * bot.GetTimeFrequency);
	--skill.LastCastTime.low = skill.LastCastTime.low +remaining*1000 * bot.GetTimeFrequency
	--skill.LastCastTime = skill.LastCastTime + (casttime*1000 * bot.GetTimeFrequency);
	skill.LastCastTime = skill.LastCastTime + (remaining*1000 * bot.GetTimeFrequency)
-- skill.lua
	--self.LastCastTime.low = self.LastCastTime.low + self.CastTime*1000 * bot.GetTimeFrequency;

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

Re: CPU freq.

#49 Post by Administrator » Sun Sep 06, 2015 6:41 pm

beanybabe wrote:What does this cpu fequency thing do
It looks like it should wait a little bit longer on the skill cast times for slower computers. That's all. That's why I had repeatedly stated that changing the frequency variable won't cause nor fix the errors you're experiencing but could only change the timing when they occur (in those random specific cases when there's a memory read error related to those skills; it wouldn't affect anything else).

User avatar
beanybabe
Posts: 647
Joined: Wed Mar 06, 2013 1:27 am

Re: CPU freq.

#50 Post by beanybabe » Sun Sep 06, 2015 7:58 pm

I have used some loot ad ons one named lootit it seems to have some kind of timing that is tied back to the server some how. when rom patches the server it affects that timing. some months it works like a dream and others it hesitates a minute or more before doing its thing. I wonder if this also affects the boss in some way. reading the code it seems timinig affects spell casting and some movements. I just puzzles me how it works so good for hours then just starts having random problems. I have been trying to locate some common varable that affects it. im starting to agree with what you say that timing does not seem to be the main cause of what is happening.

I was reading thru the code and came across this line that is not making sense. this is in player.lua line 886 or so.
local left,casttime = self:getRemainingCastTime()

what is with the left and comma before casttime is some way to link the word left to casttime for a left movement


the older machine with older windows seems to have the most problem.

User avatar
beanybabe
Posts: 647
Joined: Wed Mar 06, 2013 1:27 am

Re: CPU freq.

#51 Post by beanybabe » Sun Sep 06, 2015 8:16 pm

Im done chasing down this timing for now.
This seems to be very complicated from all I have read . Each cpu has its own way of doing timing and even revisions of similar cpus can vary. There would almost have to be some function that constantly monitored the cpu speed every few seconds and kept updating the variable. As the energy features and cpu speed throttling and core switching all affect it and are changing dynamically. the original code you had seems to work ok but for the newest cpus there needs to be some kind of change. i hope in bot 2 you can solve this.

User avatar
beanybabe
Posts: 647
Joined: Wed Mar 06, 2013 1:27 am

Re: CPU freq.

#52 Post by beanybabe » Wed Sep 09, 2015 2:04 am

Windows Problem Reporting

I keep noticing the bot will come up with a list of invalid id's when started now and then. It seems to happen with the windows focus.
I noticed the machine I have the most problems with is also showing repeating error on some device. Could the program focus be changing now and then and causing these seemingly random nil errors.

here is a ms forum article on it http://answers.microsoft.com/en-us/wind ... 798?page=1

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

Re: CPU freq.

#53 Post by rock5 » Wed Sep 09, 2015 7:20 am

beanybabe wrote: I was reading thru the code and came across this line that is not making sense. this is in player.lua line 886 or so.
local left,casttime = self:getRemainingCastTime()

what is with the left and comma before casttime is some way to link the word left to casttime for a left movement
Functions can return 1 or more values. "left,castime" means that it expects 2 values to be returned from the function. The first value will be put in the first variable "left" and the second value will be put in the second variable "casttime".

You may have noticed that self:getRemainingCastTime() is used on it's own in evaluations elsewhere in the file, eg

Code: Select all

if self:getRemainingCastTime() <= prior/1000 then
In this case it only uses the first value returned by the function, which is the casting time remaining. The function, though, also returns the full casttime as a second value. So if you need the full casttime then you would need to assign both values to variables first eg.

Code: Select all

local left,casttime = self:getRemainingCastTime()
In this case "left" is the time remaining, ie. the time left, and casttime is the total time.
  • 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

User avatar
beanybabe
Posts: 647
Joined: Wed Mar 06, 2013 1:27 am

Re: CPU freq.

#54 Post by beanybabe » Sun Aug 13, 2017 11:54 am

I still suspecting a timing problem but this one is just a slight difference that happens over time. I run a ping test for 5000 tries and totaled up the count of each ping into an array.

You would think I would get lots of different pings, most of the ping landed on 2 numbers they are 16 apart which is why I suspect a problem.

ping = 77 total= 0
ping = 78 total= 2253
ping = 79 total= 0
...
ping = 93 total= 0
ping = 94 total= 2747
ping = 95 total= 0

getPing seems to be calling macro.cpp in micromacro I just do not see what would cause half the numbers to be 16 different.

User avatar
beanybabe
Posts: 647
Joined: Wed Mar 06, 2013 1:27 am

Re: CPU freq.

#55 Post by beanybabe » Sun Aug 13, 2017 4:12 pm

sometimes it gives pings in groups like this.
ping = 78 total= 1890
ping = 79 total= 602
ping = 80 total= 0

ping = 92 total= 0
ping = 93 total= 945
ping = 94 total= 1563

I will attach the latest ping it takes like 1 minutes to run.
Attachments
ping test b.xml
(480 Bytes) Downloaded 236 times

User avatar
beanybabe
Posts: 647
Joined: Wed Mar 06, 2013 1:27 am

Re: CPU freq.

#56 Post by beanybabe » Sun Aug 13, 2017 5:05 pm

here is a graph of the pings it looks very suspect.

[img]
pingtest 1000.png
[/img]

User avatar
beanybabe
Posts: 647
Joined: Wed Mar 06, 2013 1:27 am

Re: CPU freq.

#57 Post by beanybabe » Fri Aug 25, 2017 3:14 pm

ok after looking at it that graph is normal. I just have a feeling something is off ill keep looking.

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

Re: CPU freq.

#58 Post by Administrator » Fri Aug 25, 2017 8:31 pm

Took a look at the code you provided. What you've described is strange. I would first try to confirm that the data being read is accurate. That is, ensure that the result of getPing() is actually returning your ping rather than some junk data. Since it is just doing a memory read to get this data, it's certainly possible that the memory location is just wrong.

User avatar
beanybabe
Posts: 647
Joined: Wed Mar 06, 2013 1:27 am

Re: CPU freq.

#59 Post by beanybabe » Mon Aug 28, 2017 4:05 pm

I did get ping in the bot and I did a call to the games function that does the same thing it was strange the numbers were different. I have not got back to figuring why yet. what is really strange is if you capture the ping for 5 minutes then graph it. its like a mountain range.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 34 guests