Join us at the Oolite Anniversary Party -- London, 7th July 2024, 1pm
More details in this thread.

NPC shields [release]

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

Moderators: winston, another_commander

The Black Albatross
Above Average
Above Average
Posts: 22
Joined: Thu Mar 10, 2011 8:24 pm

Re: NPC shields (proof-of-concept OXP)

Post by The Black Albatross »

Maybe it's possible to emulate Shield Boosters or even the Military Shield Enhancement on certain npc ships?
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: NPC shields (proof-of-concept OXP)

Post by Commander McLane »

The Black Albatross wrote:
Maybe it's possible to emulate Shield Boosters or even the Military Shield Enhancement on certain npc ships?
May I quote myself from the first post of this thread?
Commander McLane wrote:
All NPC shields will absorb 128 points of energy damage, just like basic player shields. It is possible to raise that strength for NPCs with shield boosters or a military shield enhancement, and in fact the code for that is already included, but it is currently de-activated, because it may make NPCs just too tough.

...

Hence I am reluctant to give ships with boosters a higher shield strength, because the shield boosting equipment is already reflected in the ship's max energy.
The point is not simulating it on certain NPCs. The point is that NPCs already have Shield Boosters and Military Shield Enhancement, at least since Oolite 1.65. The code gives them more energy banks for these equipments (and a higher energy recharge for the MSE). Therefore giving them more shields as well would reward them twice for the same equipment.
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5527
Joined: Thu Jun 12, 2008 6:55 pm

Re: NPC shields (proof-of-concept OXP)

Post by Thargoid »

Commander McLane wrote:
I was thinking of it as basically shields for NPCs. Inasmuch as IronHide adds another (the third after energy banks and shields) protective deplorable layer around player ships, it can be said that NPC shields are the next step in the arms race in order to balance out the advantage IronHide is giving to the player. :wink:

(EDIT: It seems that NPC shields are still weaker than IronHide. I forgot to mention that above, but I've set their strength to half the ship's max energy, but capped at 256. I'm even thinking about making it a universal 128 (equalling unmodified player ship shields). IronHide gives either 200 or 400 extra protection.)

To be honest, I didn't even think about IronHide before (I don't have it and wasn't really aware of it when I had the idea). It just struck me yesterday evening that the new shipTakingDamage handler can be put to good use, and that the newish shipSpawned world script handler is very convenient for amending ship scripts with minimal invasive technique. From there on the few lines of code developed rather naturally.

The little stroke of genius—if I may say so—however was to use the ship temperature for an optical effect. I had experimented with creating shield-absorbs-energy effect before by using a single red flasher bigger than the ship. But that never took off. Even now that we can add and remove subentities on the fly it wouldn't work very well. Multiple hits in quick succession (military laser salvo) wouldn't look realistic, not to mention how ships with other flashers would blink in a silly way.

I'm still waiting for more feedback. Do you like it? How should it be tweaked? In my version I have already added one more line of code in order to prevent 'overusing' the shields. If 23 damage are inflicted, and only 16 shield strength are left, the difference of 7 goes into energy damage now. In the released version even the 'insufficient' shield still gives complete protection.
The operational method is exactly the same as IronHide (except the recharge, which I deliberately omitted), although you are quite correct that in the player case it is a third element rather than a second one. I think your logic is the same as mine was but slightly in reverse, in so far as shipTakingDamage was implemented by Ahruman from my feature request, specifically to make IronHide work properly as it now does (to work after player shields rather than before it). So what you've done is (completely independently) run my thinking backwards, albeit to the NPCs rather than the player. Which in itself is no bad thing, as you say shipSpawned is most convenient for this kind of thing, which again didn't exist when I originally wrote IH.

The shader usage is a nice idea, not one I can do as my laptop doesn't support them. Might one suggest perhaps using a different colour than red to indicate the visual scattering of the laser energy rather than as a temperature rise. In TV/movies it's more usually a cyan/blue color when such things occur, although I can follow the logic of basing it on temperature. Oh and adding and removing flashers still isn't possible by script, as "special" sub-ents (flashers and exhausts) are still not visible to scripting. The only way would be to entirely switch lights on and off, which would of course affect all flashers on the ship, not just one specifically for this usage. Plus you couldn't add the extra sub-ent anyway, at least without a whole new shipdata or at least an override.

One other thought, maybe we should combine the two OXPs together as they're doing very analogous things and make it a co-OXP?
Zireael
---- E L I T E ----
---- E L I T E ----
Posts: 1396
Joined: Tue Nov 09, 2010 1:44 pm

Re: NPC shields (proof-of-concept OXP)

Post by Zireael »

Commander McLane wrote:
The Black Albatross wrote:
Maybe it's possible to emulate Shield Boosters or even the Military Shield Enhancement on certain npc ships?
May I quote myself from the first post of this thread?
Commander McLane wrote:
All NPC shields will absorb 128 points of energy damage, just like basic player shields. It is possible to raise that strength for NPCs with shield boosters or a military shield enhancement, and in fact the code for that is already included, but it is currently de-activated, because it may make NPCs just too tough.

...

Hence I am reluctant to give ships with boosters a higher shield strength, because the shield boosting equipment is already reflected in the ship's max energy.
The point is not simulating it on certain NPCs. The point is that NPCs already have Shield Boosters and Military Shield Enhancement, at least since Oolite 1.65. The code gives them more energy banks for these equipments (and a higher energy recharge for the MSE). Therefore giving them more shields as well would reward them twice for the same equipment.
But these pieces of equipment have nothing to do with energy banks and recharge! Why not change that?
The Black Albatross
Above Average
Above Average
Posts: 22
Joined: Thu Mar 10, 2011 8:24 pm

Re: NPC shields (proof-of-concept OXP)

Post by The Black Albatross »

Commander McLane wrote:
The Black Albatross wrote:
Maybe it's possible to emulate Shield Boosters or even the Military Shield Enhancement on certain npc ships?
May I quote myself from the first post of this thread?
Commander McLane wrote:
All NPC shields will absorb 128 points of energy damage, just like basic player shields. It is possible to raise that strength for NPCs with shield boosters or a military shield enhancement, and in fact the code for that is already included, but it is currently de-activated, because it may make NPCs just too tough.

...

Hence I am reluctant to give ships with boosters a higher shield strength, because the shield boosting equipment is already reflected in the ship's max energy.
The point is not simulating it on certain NPCs. The point is that NPCs already have Shield Boosters and Military Shield Enhancement, at least since Oolite 1.65. The code gives them more energy banks for these equipments (and a higher energy recharge for the MSE). Therefore giving them more shields as well would reward them twice for the same equipment.
Ah, I must have missed that. Thanks. So does the energy bank increase give NPCs the exact same increase in damage absorbed as SBs and MSE does for the player? If so, then I agree that it is redundant to also simulate a shield increase for these equipments, though it may be marginally more "elegant" to revise the system as Zirael says so that it works the same across the board for both PC and NPC ships. Then you won't have to worry about equipment that boosts energy recharge also incorrectly boosting the recharge of what is supposed to stand for the shields of NPC ships, as (if I'm guessing correctly) energy bank recharge rate is supposed to be independent of shield regeneration rate.

In my opinion it's ideal that equipment works identically for NPC and PC ships both, but if it doesn't change gameplay in any apparent way, then I understand if you don't consider it worth the effort.
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: NPC shields (proof-of-concept OXP)

Post by Commander McLane »

Zireael wrote:
Commander McLane wrote:
The point is not simulating it on certain NPCs. The point is that NPCs already have Shield Boosters and Military Shield Enhancement, at least since Oolite 1.65. The code gives them more energy banks for these equipments (and a higher energy recharge for the MSE). Therefore giving them more shields as well would reward them twice for the same equipment.
But these pieces of equipment have nothing to do with energy banks and recharge! Why not change that?
Because that's how the core game simulates NPC-shields. Shields are treated as an extension of energy banks, which is the logical, albeit simplified way to treat them; for the player ship the Shield Booster gives it an extra 'shield bank', and the MSE another extra 'shield bank' and faster shield recharge; therefore it's logical to translate that into energy banks and energy recharge for NPCs.

And as you know, we are in a feature freeze, which means that no changes are currently made to the core game, except for bug fixes.
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: NPC shields (proof-of-concept OXP)

Post by Commander McLane »

The Black Albatross wrote:
In my opinion it's ideal that equipment works identically for NPC and PC ships both, but if it doesn't change gameplay in any apparent way, then I understand if you don't consider it worth the effort.
I agree on the point of equipment working identically or at least similarly. However, achieving this requires a change in the core game code. That's why NPC-shields are on the wish list for Oolite 2.

For the time being, however, no such changes will be made, because the developers are concentrating their efforts on the release of a stable version, therefore the only changes to the game code currently permitted are bug fixes.

Hence this OXP is only the next best thing to actual NPC-shields. It's the optimum (I hope) that can be achieved short of changing the game code, but it has the imperfections mentioned in the first post, which can't be overcome without changing the game code. Thus, the OXP does change gameplay. Explicit warnings about this fact are in both the first post of this thread and its readMe. And therefore I am explicitly asking for your feedback. If you test the OXP, please tell me just how much it changes gameplay.
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: NPC shields (proof-of-concept OXP)

Post by Commander McLane »

Thargoid wrote:
The shader usage is a nice idea, not one I can do as my laptop doesn't support them. Might one suggest perhaps using a different colour than red to indicate the visual scattering of the laser energy rather than as a temperature rise.
I think there is a misunderstanding here. Shader usage is beyond my capabilities. Thus I came to the idea to simply use the temperature in order to simulate a glow effect.

If it would be possible to assign a shader on the fly, without using shipdata, and if someone could provide one which makes the hull of any ship flash for a split second, or even a sphere around the ship, regardless of ship size, I'll happily use it instead of raising ship temperature. I know zilch about shaders, I haven't the faintest idea whether that's possible.
Thargoid wrote:
One other thought, maybe we should combine the two OXPs together as they're doing very analogous things and make it a co-OXP?
I don't know. Personally I don't have IronHide installed, but still like to have NPCs with shields. Other people may not want NPC shields, but at the same time may want to use IronHide. Combining the two would make that a little complicated, I think. For me they offer separate functionalities, even if on the scripting side they look similar.
User avatar
Gimi
---- E L I T E ----
---- E L I T E ----
Posts: 2073
Joined: Tue Aug 29, 2006 5:02 pm
Location: Norway

Re: NPC shields (proof-of-concept OXP)

Post by Gimi »

Commander McLane wrote:
Thargoid wrote:
One other thought, maybe we should combine the two OXPs together as they're doing very analogous things and make it a co-OXP?
I don't know. Personally I don't have IronHide installed, but still like to have NPCs with shields. Other people may not want NPC shields, but at the same time may want to use IronHide. Combining the two would make that a little complicated, I think. For me they offer separate functionalities, even if on the scripting side they look similar.
Couldn't you use OXP Config to turn parts of the OXP on or off. Reducing the number of OXP's is a good thing in my world. (Sorry for meddling)
"A brilliant game of blasting and trading... Truly a mega-game... The game of a lifetime."
(Gold Medal Award, Zzap!64 May 1985).
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: NPC shields (proof-of-concept OXP)

Post by Commander McLane »

Gimi wrote:
Couldn't you use OXP Config to turn parts of the OXP on or off. Reducing the number of OXP's is a good thing in my world. (Sorry for meddling)
I don't have OXP Config installed, either. :wink:

And I don't think that reducing the number of OXPs is a goal. OXPs are all about choice. They're non-necessary enhancements of the game. The whole point of them is to allow each player to decide which of them they want to use, and which not. By far the easiest way of deciding that is to download and install exactly those OXPs you want to use.

As I wrote above, NPC-shields and player-ship-armour are two separate things IMO. I don't see why they should be combined into one single OXP. I equally don't see why for instance the KleptoHUD, Missile Analyzer, Deep Space Pirates, Random Hits, Tionisla Orbital Graveyard, and Deposed should be combined into one single OXP, and then the player be forced to fiddle with JS code in order to select only those of the mix which they actually want. Just downloading and installing exactly what you want seems a lot more convenient to me.
User avatar
Cody
Sharp Shooter Spam Assassin
Sharp Shooter Spam Assassin
Posts: 16080
Joined: Sat Jul 04, 2009 9:31 pm
Location: The Lizard's Claw
Contact:

Re: NPC shields (proof-of-concept OXP)

Post by Cody »

Commander McLane wrote:
Personally I don't have IronHide installed, but still like to have NPCs with shields.
This is my view also... I don't wish or need to harden my ship, only the npc ships.
I like this OXP... so far the dogfights are somewhat more difficult, but all the more immersive for that.
I've lowered the glow effect to 0.80, and this suits me nicely. However, the idea of a shader-type flash is attractive.
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
Gimi
---- E L I T E ----
---- E L I T E ----
Posts: 2073
Joined: Tue Aug 29, 2006 5:02 pm
Location: Norway

Re: NPC shields (proof-of-concept OXP)

Post by Gimi »

Commander McLane wrote:
Gimi wrote:
Couldn't you use OXP Config to turn parts of the OXP on or off. Reducing the number of OXP's is a good thing in my world. (Sorry for meddling)
I don't have OXP Config installed, either. :wink:

And I don't think that reducing the number of OXPs is a goal. OXPs are all about choice. They're non-necessary enhancements of the game. The whole point of them is to allow each player to decide which of them they want to use, and which not. By far the easiest way of deciding that is to download and install exactly those OXPs you want to use.

As I wrote above, NPC-shields and player-ship-armour are two separate things IMO. I don't see why they should be combined into one single OXP. I equally don't see why for instance the KleptoHUD, Missile Analyzer, Deep Space Pirates, Random Hits, Tionisla Orbital Graveyard, and Deposed should be combined into one single OXP, and then the player be forced to fiddle with JS code in order to select only those of the mix which they actually want. Just downloading and installing exactly what you want seems a lot more convenient to me.
I feel misunderstood now :( . These OXP's are related in functionality, and thus in my view combining them wouldn't be a bad thing. Now personally I would NOT want them combined if I was unable to disable one or the other. On the other hand, when it comes to NPC shields, this in my view is also something that probably belongs in the core game in the future, while Iron hide probably does not, so maybe combining is not a good idea. :|
Anyway (compliment coming), what I really like is that this is one of very few OXP's that alters the balance of the game in the favor of NPC's without interfering with the core game design/concept. Well done :D .
"A brilliant game of blasting and trading... Truly a mega-game... The game of a lifetime."
(Gold Medal Award, Zzap!64 May 1985).
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: NPC shields (proof-of-concept OXP)

Post by Commander McLane »

Gimi wrote:
I feel misunderstood now :( .
Sorry. I didn't mean any offence.
Gimi wrote:
These OXP's are related in functionality, and thus in my view combining them wouldn't be a bad thing.
Here we simply disagree. I don't think they're related in functionality, because they impact on different aspects of the game. Therefore I don't find a combination a logical step.
Gimi wrote:
Now personally I would NOT want them combined if I was unable to disable one or the other.
As I said, IMO the easiest way of disabling one or the other is to only install one or the other. Thus they shouldn't be combined in the first place.
Gimi wrote:
On the other hand, when it comes to NPC shields, this in my view is also something that probably belongs in the core game in the future,
Fully agreed. For me this OXP is only the (imperfect) short-term solution, until NPC-shields get implemented in the game itself.
Gimi wrote:
Anyway (compliment coming), what I really like is that this is one of very few OXP's that alters the balance of the game in the favor of NPC's without interfering with the core game design/concept. Well done :D .
Thanks for the compliment! :D
User avatar
CaptSolo
---- E L I T E ----
---- E L I T E ----
Posts: 909
Joined: Wed Feb 23, 2011 10:08 pm
Location: Preying Manta
Contact:

Re: NPC shields (proof-of-concept OXP)

Post by CaptSolo »

Commander McLane wrote:
CaptSolo wrote:
This OXP doesn't work for me but am sure it is not the OXP. Also, although I should test it some more, it seems DeepSpacePirates doesn't function with NPC Shields.
Could you be a little more precise? 'Doesn't work' or 'doesn't function' isn't really helpful for understanding what's wrong.
CaptSolo wrote:
I flew around for quite a long time without getting into the usual dogfight.
Do you mean there were no pirates, or they were there but didn't fight you? Also, which version of DSP have you installed?
Another Commander is correct - no shader capabilitiy here. As for DSP OXP, It is version 1.3. There were no pirates but like I said that may have been just a fluke. Sorry for not replying sooner but my account was suspended for awhile. My fault and I'm very happy to be back.
User avatar
Cody
Sharp Shooter Spam Assassin
Sharp Shooter Spam Assassin
Posts: 16080
Joined: Sat Jul 04, 2009 9:31 pm
Location: The Lizard's Claw
Contact:

Re: NPC shields (proof-of-concept OXP)

Post by Cody »

CaptSolo wrote:
Sorry for not replying sooner but my account was suspended for awhile.
Do you mean yesterday, CaptSolo? The forum was down, not your personal account.
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!
Post Reply