Page 2 of 3

Re: Bug produced by trunk + Randomhits

Posted: Sat Mar 19, 2011 10:56 am
by Eric Walch
Ian, I now uploaded the changed files here. This code should run a bit faster and probably avoid the "slow-computer" message on those systems that suffer from it. It contains all files I changed since RH 1.4.8. Let me hear if this improves things.

When you have the console installed, I like to know how this code profiles on your computer. Start Oolite and choose the Jameson. Than open the console window. For Oolite 1.75.0 or trunk, just type:

Code: Select all

:time worldScripts["Random_Hits"].setupHitpages()
When using 1.75.1, the 'time' macro is not working and you have to type:

Code: Select all

console.profile(eval("(function codeToBeProfiled() { (" + "worldScripts[\"Random_Hits\"].setupHitpages()" + ") })"), this)
It would be interesting how the first few dumped lines are for you.

Re: Bug produced by trunk + Randomhits

Posted: Sat Mar 19, 2011 11:19 am
by JensAyton
Eric Walch wrote:
When using 1.75.1, the 'time' macro is not working
You can work around that by dropping this file into your AddOns directory. Don’t forget to remove it when 1.75.2 drops.

Re: Bug produced by trunk + Randomhits

Posted: Sat Mar 19, 2011 12:19 pm
by m4r35n357
OK guys thanks, about to try new code . . . Ian.

Re: Bug produced by trunk + Randomhits

Posted: Sat Mar 19, 2011 2:06 pm
by JensAyton
Ahruman wrote:
Eric Walch wrote:
When using 1.75.1, the 'time' macro is not working
You can work around that by dropping this file into your AddOns directory. Don’t forget to remove it when 1.75.2 drops.
On further consideration this doesn’t make sense, since we don’t normally post a new debug OXP for minor version bumps. I’ve posted a fixed version on the wiki.

Re: Bug produced by trunk + Randomhits

Posted: Sat Mar 19, 2011 8:34 pm
by Eric Walch
m4r35n357 wrote:
OK guys thanks, about to try new code . . . Ian.
Got your profile, thanks:

Code: Select all

Opened connection with Oolite version 1.75
> console.profile(eval("(function codeToBeProfiled() { (" + "worldScripts[\"Random_Hits\"].setupHitpages()" + ") })"), this)
Total time: 862.36 ms
JavaScript: 50.552 ms, native: 811.727 ms
Counted towards limit: 758.356 ms, excluded: 104.004 ms
Profiler overhead: 45.141 ms
But it makes me more puzzled. The ratio JS vs. native time is comparable with my system, but somehow is seems it does not look at the JS time itself for the limiter.

Re: Bug produced by trunk + Randomhits

Posted: Mon Mar 21, 2011 10:13 am
by m4r35n357
Eric Walch wrote:
Got your profile, thanks:
Trying your 1.4.10 version ATM, haven't noticed any problems so far, looks good, thanks!

Ian.

Re: Bug produced by trunk + Randomhits

Posted: Tue Mar 29, 2011 3:42 pm
by Fatleaf
Eric Walch wrote:
Ian, I now uploaded the changed files here. This code should run a bit faster and probably avoid the "slow-computer" message on those systems that suffer from it. It contains all files I changed since RH 1.4.8. Let me hear if this improves things
I have changed the files as suggested. But I am still getting the "Too Slow" problem I have to launch and re-dock a number of times before I get offered missions. But at least I can still get them. :wink:

Re: Bug produced by trunk + Randomhits

Posted: Wed Mar 30, 2011 7:42 am
by Eric Walch
Fatleaf wrote:
I have changed the files as suggested. But I am still getting the "Too Slow" problem I have to launch and re-dock a number of times before I get offered missions. But at least I can still get them. :wink:
Good to hear that it at least partially works. Apparently your computer has still to many background tasks sometimes that slow down Oolite. e.g. when I run two versions of Oolite simultaneously, my fps drops significantly. The same will be true for other open applications that stay busy in the background. Killing those when playing will also improve Oolites overall performance.

Anyhow, I noticed that Ahruman raised the limit during the docking handler from 1 to 5 seconds. That should help all long code running during docking. It is already in trunk, so you might download a nighty when you don't want to wait on a next release. Normally trunk is not for playing because it could be full of bugs. But, as we are in a feature lock phase, no new functions are added to trunk, so it is less likely that new bugs are introduced and only fixes are added. :)

Re: Bug produced by trunk + Randomhits

Posted: Thu Mar 31, 2011 2:18 pm
by Switeck
I found this line in RH v1.4.10:
missionVariables.random_hits_planetnumber = System.systemIDForName(missionVariables.random_hits_mark_system);

Is System. supposed to be capitalized? :?

Re: Bug produced by trunk + Randomhits

Posted: Thu Mar 31, 2011 3:05 pm
by Commander McLane
Switeck wrote:
I found this line in RH v1.4.10:
missionVariables.random_hits_planetnumber = System.systemIDForName(missionVariables.random_hits_mark_system);

Is System. supposed to be capitalized? :?
Yes.

Re: Bug produced by trunk + Randomhits

Posted: Thu Mar 31, 2011 7:00 pm
by Eric Walch
Switeck wrote:
Is System. supposed to be capitalized? :?
When used as a constructor it must be capitalised. You use it as constructor in the static methods. There also exists an instance of this constructor. That is 'system' in lowercase. That casing is to be used with properties and methods. See System

Re: Bug produced by trunk + Randomhits

Posted: Sat Apr 09, 2011 9:38 pm
by Switeck
In oolite-random-hits-mark.js file, I see a few lines I'd expect would have ;'s on the end...yet they don't:

missionVariables.random_hits_status = "PODEDOUT" // Victim made it to his Pod! Set the variable to reflect that the player still needs to kill or scoop the Pod!
missionVariables.random_hits_status = "COMPLETE" // Record the fact that the Victim's ship has been destroyed.
missionVariables.random_hits_status = "NPCKILL" // Record the fact that the Victim's ship has been destroyed.
missionVariables.random_hits_status = "JUMPED"

I doubt semicolons are completely optional, as I've hard a few bugs when I've missed one myself.
But is there something special about these lines which makes ;'s optional?

Re: Bug produced by trunk + Randomhits

Posted: Sat Apr 09, 2011 10:47 pm
by JensAyton
Semicolons are generally optional, as long as you put each statement on a separate line. (There’s a formally specified process called “automatic semicolon insertion” that handles this.) However, there are nasty edge cases and it’s widely considered good practice to use explicit semicolons. The only time I omit them these days is using the console.

Re: Bug produced by trunk + Randomhits

Posted: Mon May 16, 2011 12:57 am
by UK_Eliter
I've still got the 'too slow' problem (on my fast computer). I'm on trunk 1.75.2.4544-dev.win32 - and had the problem on 1.75.1 as well. I've got Anarchies 2.5.

Re: Bug produced by trunk + Randomhits

Posted: Sun May 22, 2011 9:42 pm
by maik
UK_Eliter wrote:
I've still got the 'too slow' problem (on my fast computer). I'm on trunk 1.75.2.4544-dev.win32 - and had the problem on 1.75.1 as well. I've got Anarchies 2.5.
I just ran into this as well (on a certainly fast enough computer). Relevant log excerpt:

Code: Select all

23:32:25.930 [oolite-random-hits-hopper]: The miningHopper: GalMine Hopper IS6-S30 was killed by [Ship "GalMine AutoMiner" position: (846.509, -8806.35, 619754) scanClass: CLASS_ROCK status: STATUS_DEAD] because of scrape damage
23:35:19.995 [station.launchShip.failed]: Cancelled launch for a Imperial Courier with role defense_ship, as it is too large for the docking port of the Rock Hermit.
23:36:06.306 [script.javaScript.exception.unexpectedType]: ***** JavaScript exception (Random_Hits 1.4.10): TypeError: System.infoForSystem(galaxyNumber, targetSystem.systemID).routeToSystem(thisSystem) is null
23:36:06.306 [script.javaScript.exception.unexpectedType]:       /Users/maik/Games/Oolite beta 1.75.2/AddOns/RandomHits1.4.10.oxp/Scripts/oolite-randomHits.js, line 960.
23:36:12.602 [Random_Hits]: Succeeded in generating 0 hitpages. You should only see this message with Oolite debug builds or in release builds at slow computers.
23:36:52.745 [Random_Hits]: (Hatred : 0. Events Timer : 1. Dockings : 1. Events Number : 0. Special Mission Timer : 1. Revenge Status : KILLED. Time to Strike : mission_random_hits_striketime. Revenge Jumps Made : mission_random_hits_timer. Special Mission : WAITING. Master Timer : 1. Dice Roll : 63)