Oolite Bulletins

For information and discussion about Oolite.
It is currently Fri Nov 17, 2017 9:14 pm

All times are UTC




Post new topic  Reply to topic  [ 71 posts ]  Go to page Previous 1 2 3 4 5 Next
Author Message
PostPosted: Sun Jul 09, 2017 4:31 pm 
Offline
---- E L I T E ----
---- E L I T E ----
User avatar

Joined: Sun Jul 19, 2015 1:09 pm
Posts: 412
Quote:
Then maybe if on screen but use 0 or 1 width and height, or full transparent alpha?
@Norby I tried both solutions but nothing changed :(


Top
   
PostPosted: Sun Jul 09, 2017 6:18 pm 
Online
---- E L I T E ----
---- E L I T E ----
User avatar

Joined: Mon May 20, 2013 9:53 pm
Posts: 2424
Location: Budapest, Hungary (Mainly Agricultural Democracy, TL10)
Quote:
I tried both solutions but nothing changed :(
There is an other way to show and hide images: replace the equipment_required parts to drawCustomImage.
So put something like this into your hud.plist:
Code:
{       
                data_source = "DangerousHUD_scanner_circles_background";
                selector = "drawCustomImage:";
                height = 150.0;
                width = 306.0;
                x = 0;
                y = 66.0;
                y_origin = -1;
                x_origin = 0;
                alpha = 1.0;
},
Then call this in your js:
Code:
player.ship.setCustomHUDDial("DangerousHUD_scanner_circles_background",
                             "DangerousHUD_scanner_circles_background_red.png");
I am not sure that this will help, just I have no more idea at OXP level.

_________________
OXPs by Norby


Top
   
PostPosted: Sun Jul 09, 2017 8:49 pm 
Offline
---- E L I T E ----
---- E L I T E ----
User avatar

Joined: Sun Jul 19, 2015 1:09 pm
Posts: 412
@Norby many thanks for all your tips, I really appreciate it.
Quote:
There is an other way to show and hide images: replace the equipment_required parts to drawCustomImage.
I made a test and I have converted all my code to use drawCustomImage instead of awarding/removing equipments, but the performance is pretty much identical as far as I can tell, perhaps even a bit worse than use equipments :(

I have also tested this OXP with vanilla 1.85, and then those lags are not present at all. It is when I have my huge list of OXPs installed that I start seeing issues. The thing is no other HUD shows these problems, but I guess that this work here is a bit heavier on the computer. Funny enough, my frame rate always stay around 50-60 fps, and the lags occur only on two moments: when the alert change between yellow and red (or vice-versa) and when the mass lock indicator changes its status. But if the alert condition or mass lock condition changes soon after a previous change, then no lag is present which is why I have been suspecting this is an issue with how images are cached.

I honestly ran out of ideas on how to try to optimize this...


Top
   
PostPosted: Mon Jul 10, 2017 7:40 pm 
Offline
---- E L I T E ----
---- E L I T E ----
User avatar

Joined: Sun Jul 19, 2015 1:09 pm
Posts: 412
Hi all,

I have made some more progress with this HUD and I am now releasing the version 1.1. Here are the new features:

- added new sound for missile warning.
- text on the message display is now also orange.
- fixed small bug with ECM noise sound being heard while docked.
- shipyard screen now also uses the same colour scheme as the other screens.
- new mass lock indicator.
- new green and blue variants.

I will be happy to hear your feedback!

Screenshots
===========

Image

Image

Image

And here is a screenshot of the new mass lock indicator:

Image

Download Links
==============

gsagostinho.DangerousHUD.BlueVariant.v1.1.zip
gsagostinho.DangerousHUD.GreenVariant.v1.1.zip
gsagostinho.DangerousHUD.OrangeVariant.v1.1.zip


Top
   
PostPosted: Mon Jul 10, 2017 9:31 pm 
Online
Sharp Shooter Spam Assassin
Sharp Shooter Spam Assassin
User avatar

Joined: Sat Jul 04, 2009 9:31 pm
Posts: 12915
Location: Corke's Drift
Quote:
Sweet - the Hooloovoo is well-pleased!

_________________
The only good fnord is a dead fnord!


Top
   
PostPosted: Mon Jul 10, 2017 10:08 pm 
Offline
---- E L I T E ----
---- E L I T E ----
User avatar

Joined: Sun Jul 19, 2015 1:09 pm
Posts: 412
Glad to hear that, Cody :D


Top
   
PostPosted: Mon Jul 17, 2017 3:33 pm 
Offline
---- E L I T E ----
---- E L I T E ----
User avatar

Joined: Sun Jul 19, 2015 1:09 pm
Posts: 412
Hi all, I just released a new version of this HUD, link updated in the first post. Here is the changelog for version 1.2:

- new pink variant.
- slight modification to the green variation's hue.
- darker scanner's background.
- added glass only mode (i.e. no cockpit).
- fixed wrong dates in version history.
- target reticle now has the same colours as the HUD.

I also made some modifications of Dangerous Keyconfig OXP, so version 1.1 now does the following:

- TAB key now activates fuel injectors.
- Shift + numbers for fast activation of equipments ('!' and '@').
- fixed wrong dates in version history.

Link is updated in the first post (soon I will add all my OXP to the in-game manager, but for now please use that link).

I also added a link for the glass texture I use, in case someone wants to add that effect to the HUD of their preference (instructions included).


Top
   
PostPosted: Tue Jul 18, 2017 11:12 am 
Offline
Commodore
Commodore
User avatar

Joined: Tue Jan 21, 2014 10:37 pm
Posts: 1801
Location: [p]laying [h]ard and [k]icking [b]utt somewhere in G7...
Thought I'd give your HUD a spin! Very sweet it is too.

One issue for the next release, though:
Code:
21:01:37.817 [script.javaScript.exception.notDefined]: ***** JavaScript exception (DangerousHUD 1.2): ReferenceError: h is not defined
21:01:37.817 [script.javaScript.exception.notDefined]:       ../AddOns/HUDs.oxp/gsagostinho.DangerousHUD.OrangeVariant.oxp/Config/script.js, line 232.

_________________
My OXP's


Top
   
PostPosted: Tue Jul 18, 2017 11:53 am 
Offline
---- E L I T E ----
---- E L I T E ----
User avatar

Joined: Sun Jul 19, 2015 1:09 pm
Posts: 412
@phkb thanks catching this. I had removed all variables such as w, p, h and used the full "worldScripts.hudselector", "player.ship", etc. in an attempt to optimize a bit the code, but apparently I had skipped one reference to w. This is fixed, I will release a new version today. Thanks for all the bug spotting with my OXPs! :D


Top
   
PostPosted: Tue Jul 18, 2017 12:14 pm 
Offline
Commodore
Commodore
User avatar

Joined: Tue Jan 21, 2014 10:37 pm
Posts: 1801
Location: [p]laying [h]ard and [k]icking [b]utt somewhere in G7...
No problem! BTW, it's actually faster to create a local variable and access that, than to use the fully described element.

_________________
My OXP's


Top
   
PostPosted: Tue Jul 18, 2017 12:21 pm 
Offline
---- E L I T E ----
---- E L I T E ----
User avatar

Joined: Sun Jul 19, 2015 1:09 pm
Posts: 412
Quote:
BTW, it's actually faster to create a local variable and access that, than to use the fully described element.
Really?! :shock: I would never have thought that would be the case, it seemed to me the case with the extra statement in which the local variable is assigned its value would be slower, since it has one more operation to do. Do you know why that is faster?


Top
   
PostPosted: Tue Jul 18, 2017 1:01 pm 
Online
---- E L I T E ----
---- E L I T E ----
User avatar

Joined: Mon May 20, 2013 9:53 pm
Posts: 2424
Location: Budapest, Hungary (Mainly Agricultural Democracy, TL10)
The time depends on that how many objects are in the used scope what must search through for the wanted data. Local variables are the fastest so if you use something at least two times then faster if you save the pointer into a local variable first. Here is a speed test:
Code:
var a=console.getProfile(function(){for(var i=0;i<10000;i++){player.ship;}});
log("A",a.javaScriptTime+" : "+a.totalTime);

14:46:04.661 [A] GlobalLog (OOJSGlobal.m:256): 0.004737 : 0.004761

var p=player.ship,a=console.getProfile(function(){for(var i=0;i<10000;i++){p;}});
log("A",a.javaScriptTime+" : "+a.totalTime);

14:46:27.965 [A] GlobalLog (OOJSGlobal.m:256): 0.000196 : 0.000198


var a=console.getProfile(function(){for(var i=0;i<10000;i++){worldScripts.telescope;}});
log("A",a.javaScriptTime+" : "+a.totalTime);

14:37:59.036 [A] GlobalLog (OOJSGlobal.m:256): 0.01512 : 0.615031

var w=worldScripts.telescope,a=console.getProfile(function(){for(var i=0;i<10000;i++){w;}});
log("A",a.javaScriptTime+" : "+a.totalTime);

14:37:53.048 [A] GlobalLog (OOJSGlobal.m:256): 0.000192 : 0.000194
So the "p" local variable is 24 times faster than player.ship, and at me where I use about 200 OXPs the "w" is 3170(!) times faster than accessing a script in the long worldScripts array.

_________________
OXPs by Norby


Top
   
PostPosted: Tue Jul 18, 2017 4:52 pm 
Offline
---- E L I T E ----
---- E L I T E ----
User avatar

Joined: Sun Jul 19, 2015 1:09 pm
Posts: 412
@Norby Thanks for the tests, this explains a lot. I was naively thinking that more lines == more things for the CPU to be busy with, but that is silly. I will re-replace those in the HUD's code.


Top
   
PostPosted: Tue Jul 18, 2017 7:02 pm 
Offline
---- E L I T E ----
---- E L I T E ----
User avatar

Joined: Sun Jul 19, 2015 1:09 pm
Posts: 412
Version 1.3 is released, here is the changelog:
- fixed a small error in the script.js, using a variable which was not defined.
- optimized the script by switching back to local variables.
- improved scanner pulsation.


Top
   
PostPosted: Tue Jul 18, 2017 7:56 pm 
Offline
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral

Joined: Wed Feb 28, 2007 7:54 am
Posts: 5011
Getting many of those with the latest version:
Code:
21:54:04.753 [script.javaScript.exception.unexpectedType]: ***** JavaScript exception (DangerousHUD 1.3): TypeError: player.shiplayer is undefined
21:54:04.753 [script.javaScript.exception.unexpectedType]:       ../AddOns/gsagostinho.DangerousHUD.OrangeVariant.oxp/Config/script.js, line 114.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 71 posts ]  Go to page Previous 1 2 3 4 5 Next

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 21 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
Powered by phpBB® Forum Software © phpBB Limited