[Release] Dangerous HUD

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

Moderators: another_commander, winston

User avatar
gsagostinho
---- E L I T E ----
---- E L I T E ----
Posts: 573
Joined: Sun Jul 19, 2015 1:09 pm

Re: [Release] Dangerous HUD

Post by gsagostinho »

Norby wrote:
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 :(
User avatar
Norby
---- E L I T E ----
---- 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

Post by Norby »

gsagostinho wrote: Sun Jul 09, 2017 4:31 pm
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: 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;
},
Then call this in your js:

Code: Select all

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.
User avatar
gsagostinho
---- E L I T E ----
---- E L I T E ----
Posts: 573
Joined: Sun Jul 19, 2015 1:09 pm

Re: [Release] Dangerous HUD

Post by gsagostinho »

@Norby many thanks for all your tips, I really appreciate it.
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...
User avatar
gsagostinho
---- E L I T E ----
---- E L I T E ----
Posts: 573
Joined: Sun Jul 19, 2015 1:09 pm

Re: [Release] Dangerous HUD

Post by gsagostinho »

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
User avatar
Cody
Sharp Shooter Spam Assassin
Sharp Shooter Spam Assassin
Posts: 16063
Joined: Sat Jul 04, 2009 9:31 pm
Location: The Lizard's Claw
Contact:

Re: [Release] Dangerous HUD

Post by Cody »

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!
User avatar
gsagostinho
---- E L I T E ----
---- E L I T E ----
Posts: 573
Joined: Sun Jul 19, 2015 1:09 pm

Re: [Release] Dangerous HUD

Post by gsagostinho »

Glad to hear that, Cody :D
User avatar
gsagostinho
---- E L I T E ----
---- E L I T E ----
Posts: 573
Joined: Sun Jul 19, 2015 1:09 pm

Re: [Release] Dangerous HUD

Post by gsagostinho »

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).
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4655
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: [Release] Dangerous HUD

Post by phkb »

Thought I'd give your HUD a spin! Very sweet it is too.

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.
User avatar
gsagostinho
---- E L I T E ----
---- E L I T E ----
Posts: 573
Joined: Sun Jul 19, 2015 1:09 pm

Re: [Release] Dangerous HUD

Post by gsagostinho »

@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
User avatar
phkb
Impressively Grand Sub-Admiral
Impressively Grand Sub-Admiral
Posts: 4655
Joined: Tue Jan 21, 2014 10:37 pm
Location: Writing more OXPs, because the world needs more OXPs.

Re: [Release] Dangerous HUD

Post by phkb »

No problem! BTW, it's actually faster to create a local variable and access that, than to use the fully described element.
User avatar
gsagostinho
---- E L I T E ----
---- E L I T E ----
Posts: 573
Joined: Sun Jul 19, 2015 1:09 pm

Re: [Release] Dangerous HUD

Post by gsagostinho »

phkb wrote:
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?
User avatar
Norby
---- E L I T E ----
---- 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

Post by Norby »

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: 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
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.
User avatar
gsagostinho
---- E L I T E ----
---- E L I T E ----
Posts: 573
Joined: Sun Jul 19, 2015 1:09 pm

Re: [Release] Dangerous HUD

Post by gsagostinho »

@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.
User avatar
gsagostinho
---- E L I T E ----
---- E L I T E ----
Posts: 573
Joined: Sun Jul 19, 2015 1:09 pm

Re: [Release] Dangerous HUD

Post by gsagostinho »

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.
another_commander
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 6557
Joined: Wed Feb 28, 2007 7:54 am

Re: [Release] Dangerous HUD

Post by another_commander »

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