@Norby I tried both solutions but nothing changedNorby wrote:Then maybe if on screen but use 0 or 1 width and height, or full transparent alpha?
[Release] Dangerous HUD
Moderators: winston, another_commander
- gsagostinho
- ---- E L I T E ----
- Posts: 573
- Joined: Sun Jul 19, 2015 1:09 pm
Re: [Release] Dangerous HUD
- Norby
- ---- E L I T E ----
- Posts: 2577
- Joined: Mon May 20, 2013 9:53 pm
- Location: Budapest, Hungary (Mainly Agricultural Democracy, TL10)
- Contact:
Re: [Release] Dangerous HUD
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: Select all
{
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;
},
Code: Select all
player.ship.setCustomHUDDial("DangerousHUD_scanner_circles_background",
"DangerousHUD_scanner_circles_background_red.png");
- gsagostinho
- ---- E L I T E ----
- Posts: 573
- Joined: Sun Jul 19, 2015 1:09 pm
Re: [Release] Dangerous HUD
@Norby many thanks for all your tips, I really appreciate it.
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...
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 equipmentsThere is an other way to show and hide images: replace the equipment_required parts to drawCustomImage.
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...
- gsagostinho
- ---- E L I T E ----
- Posts: 573
- Joined: Sun Jul 19, 2015 1:09 pm
Re: [Release] Dangerous HUD
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
===========
And here is a screenshot of the new mass lock indicator:
Download Links
==============
gsagostinho.DangerousHUD.BlueVariant.v1.1.zip
gsagostinho.DangerousHUD.GreenVariant.v1.1.zip
gsagostinho.DangerousHUD.OrangeVariant.v1.1.zip
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
===========
And here is a screenshot of the new mass lock indicator:
Download Links
==============
gsagostinho.DangerousHUD.BlueVariant.v1.1.zip
gsagostinho.DangerousHUD.GreenVariant.v1.1.zip
gsagostinho.DangerousHUD.OrangeVariant.v1.1.zip
- Cody
- Sharp Shooter Spam Assassin
- Posts: 16081
- Joined: Sat Jul 04, 2009 9:31 pm
- Location: The Lizard's Claw
- Contact:
Re: [Release] Dangerous HUD
Sweet - the Hooloovoo is well-pleased!
I would advise stilts for the quagmires, and camels for the snowy hills
And any survivors, their debts I will certainly pay. There's always a way!
And any survivors, their debts I will certainly pay. There's always a way!
- gsagostinho
- ---- E L I T E ----
- Posts: 573
- Joined: Sun Jul 19, 2015 1:09 pm
Re: [Release] Dangerous HUD
Glad to hear that, Cody
- gsagostinho
- ---- E L I T E ----
- Posts: 573
- Joined: Sun Jul 19, 2015 1:09 pm
Re: [Release] Dangerous HUD
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).
- 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).
- phkb
- Impressively Grand Sub-Admiral
- Posts: 4830
- Joined: Tue Jan 21, 2014 10:37 pm
- Location: Writing more OXPs, because the world needs more OXPs.
Re: [Release] Dangerous HUD
Thought I'd give your HUD a spin! Very sweet it is too.
One issue for the next release, though:
One issue for the next release, though:
Code: Select all
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.
- gsagostinho
- ---- E L I T E ----
- Posts: 573
- Joined: Sun Jul 19, 2015 1:09 pm
Re: [Release] Dangerous HUD
@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!
- phkb
- Impressively Grand Sub-Admiral
- Posts: 4830
- Joined: Tue Jan 21, 2014 10:37 pm
- Location: Writing more OXPs, because the world needs more OXPs.
Re: [Release] Dangerous HUD
No problem! BTW, it's actually faster to create a local variable and access that, than to use the fully described element.
- gsagostinho
- ---- E L I T E ----
- Posts: 573
- Joined: Sun Jul 19, 2015 1:09 pm
Re: [Release] Dangerous HUD
Really?! 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?phkb wrote:BTW, it's actually faster to create a local variable and access that, than to use the fully described element.
- Norby
- ---- E L I T E ----
- Posts: 2577
- Joined: Mon May 20, 2013 9:53 pm
- Location: Budapest, Hungary (Mainly Agricultural Democracy, TL10)
- Contact:
Re: [Release] Dangerous HUD
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:
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.
Code: Select all
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
- gsagostinho
- ---- E L I T E ----
- Posts: 573
- Joined: Sun Jul 19, 2015 1:09 pm
Re: [Release] Dangerous HUD
@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.
- gsagostinho
- ---- E L I T E ----
- Posts: 573
- Joined: Sun Jul 19, 2015 1:09 pm
Re: [Release] Dangerous HUD
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.
- 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.
-
- Quite Grand Sub-Admiral
- Posts: 6682
- Joined: Wed Feb 28, 2007 7:54 am
Re: [Release] Dangerous HUD
Getting many of those with the latest version:
Code: Select all
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.