Bug produced by trunk + Randomhits

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: winston, another_commander

User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Re: Bug produced by trunk + Randomhits

Post 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.
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Re: Bug produced by trunk + Randomhits

Post 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.
m4r35n357
---- E L I T E ----
---- E L I T E ----
Posts: 296
Joined: Wed Jan 19, 2011 4:00 pm

Re: Bug produced by trunk + Randomhits

Post by m4r35n357 »

OK guys thanks, about to try new code . . . Ian.
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Re: Bug produced by trunk + Randomhits

Post 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.
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Re: Bug produced by trunk + Randomhits

Post 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.
m4r35n357
---- E L I T E ----
---- E L I T E ----
Posts: 296
Joined: Wed Jan 19, 2011 4:00 pm

Re: Bug produced by trunk + Randomhits

Post 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.
User avatar
Fatleaf
Intergalactic Spam Assassin
Intergalactic Spam Assassin
Posts: 1988
Joined: Tue Jun 08, 2010 5:11 am
Location: In analysis mode on Phaelon
Contact:

Re: Bug produced by trunk + Randomhits

Post 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:
Find out about the early influences of Fatleaf here. Also his OXP's!
Holds the Ooniversal record for "Thread Necromancy"
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Re: Bug produced by trunk + Randomhits

Post 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. :)
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2411
Joined: Mon May 31, 2010 11:11 pm

Re: Bug produced by trunk + Randomhits

Post 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? :?
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Re: Bug produced by trunk + Randomhits

Post 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.
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Re: Bug produced by trunk + Randomhits

Post 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
Switeck
---- E L I T E ----
---- E L I T E ----
Posts: 2411
Joined: Mon May 31, 2010 11:11 pm

Re: Bug produced by trunk + Randomhits

Post 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?
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Re: Bug produced by trunk + Randomhits

Post 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.
UK_Eliter
---- E L I T E ----
---- E L I T E ----
Posts: 1248
Joined: Sat Sep 12, 2009 11:58 pm
Location: Essex (mainly industrial and occasionally anarchic)

Re: Bug produced by trunk + Randomhits

Post 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.
User avatar
maik
Wiki Wizard
Wiki Wizard
Posts: 2028
Joined: Wed Mar 10, 2010 12:30 pm
Location: Ljubljana, Slovenia (mainly industrial, feudal, TL12)

Re: Bug produced by trunk + Randomhits

Post 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)
Post Reply