Naval Grid OXP
Moderators: winston, another_commander
Naval Grid OXP
Because it was asked here and because I had a little spare time, allow me to declassify the Naval Energy Grid.
This military enhancement is designed to properly connect a naval energy unit with military boosted ship shields, giving an enhanced recharging rate. It is switchable via the equipment switch key ("n" by default) to route the energy flow to either the reserve banks or to the shields, although this is overridden in the case of full shields or critically low energy levels.
Available from tech level 14 systems for the sum of 65,000 credits. Also requires the NEU and military shield boosters.
- - = = Download Here = = - -
This military enhancement is designed to properly connect a naval energy unit with military boosted ship shields, giving an enhanced recharging rate. It is switchable via the equipment switch key ("n" by default) to route the energy flow to either the reserve banks or to the shields, although this is overridden in the case of full shields or critically low energy levels.
Available from tech level 14 systems for the sum of 65,000 credits. Also requires the NEU and military shield boosters.
- - = = Download Here = = - -
Last edited by Thargoid on Thu Jul 21, 2011 7:29 pm, edited 1 time in total.
My OXPs via Boxspace or from my Wiki pages .
Thargoid TV
Dropbox Referral Link
Thargoid TV
Dropbox Referral Link
- maik
- Wiki Wizard
- Posts: 2028
- Joined: Wed Mar 10, 2010 12:30 pm
- Location: Ljubljana, Slovenia (mainly industrial, feudal, TL12)
Re: [Release]Naval Grid OXP
Added it to the [wiki]OXP List[/wiki].
Re: Naval Grid OXP
I have been messing around with some, er, "aggressive" settings, and have come up with the following (with apologies to Thargoid for changing the logic a bit . . .)
It should auto-tune to most ships that it can be used on, I think. Just replace the current shieldCheck function with the following two (I could have nested the boost function but I wanted to play!)
Do with this as you will . . . .
It should auto-tune to most ships that it can be used on, I think. Just replace the current shieldCheck function with the following two (I could have nested the boost function but I wanted to play!)
Do with this as you will . . . .
Code: Select all
this.$boostShield = function (shield, maxShield) {
var deficit = maxShield - shield;
if (deficit > this.strength) {
shield += this.strength;
player.ship.energy -= this.strength;
} else {
shield += deficit;
player.ship.energy -= deficit;
}
return shield
}
this.shieldCheck = function () {
this.strength = player.ship.maxEnergy / 16;
if (player.ship.equipmentStatus("EQ_NAVAL_SHIELD_BOOSTER") !== "EQUIPMENT_OK" || player.ship.equipmentStatus("EQ_NAVAL_ENERGY_UNIT") !== "EQUIPMENT_OK") {
player.consoleMessage("Naval Grid damaged and offline", 4);
player.ship.setEquipmentStatus("EQ_NAVAL_GRID", "EQUIPMENT_DAMAGED");
if (this.shieldCheckTimer) {
this.shieldCheckTimer.stop();
}
return
}
if (player.ship.docked || player.ship.equipmentStatus("EQ_NAVAL_GRID") !== "EQUIPMENT_OK") {
this.shieldCheckTimer.stop();
return
}
if (player.ship.energy < player.ship.maxEnergy / 4) {
return
} else if ((player.ship.forwardShield < player.ship.maxForwardShield) || (player.ship.aftShield < player.ship.maxAftShield)) {
if ((player.ship.maxForwardShield - player.ship.forwardShield) < (player.ship.maxAftShield - player.ship.aftShield)) {
player.ship.aftShield = this.$boostShield(player.ship.aftShield, player.ship.maxAftShield);
} else {
player.ship.forwardShield = this.$boostShield(player.ship.forwardShield, player.ship.maxForwardShield);
}
}
}
OXPs: Furball 1.8, Factions 1.12
Re: Naval Grid OXP
Interesting approach, m4r35n357 .
I'll look into using for next version.
One of the drawbacks of naval grid is that it needs the naval energy unit to be installed.
Getting a pilot to the point where they can buy NEU takes a lot of time.
(personally i work around that by looking in shipyards for the ship i fly, but with the NEU)
A less capable version of naval grid that requires mil Shields could solve that.
Would such a version be a good idea ?
I'll look into using for next version.
One of the drawbacks of naval grid is that it needs the naval energy unit to be installed.
Getting a pilot to the point where they can buy NEU takes a lot of time.
(personally i work around that by looking in shipyards for the ship i fly, but with the NEU)
A less capable version of naval grid that requires mil Shields could solve that.
Would such a version be a good idea ?
OS : Arch Linux 64-bit - rolling release
OXPs : My user page
Retired, reachable at [email protected]
OXPs : My user page
Retired, reachable at [email protected]
- Cmdr Wyvern
- ---- E L I T E ----
- Posts: 1649
- Joined: Tue Apr 11, 2006 1:47 am
- Location: Somewhere in the great starry void
Re: Naval Grid OXP
I looked into that.Lone_Wolf wrote:One of the drawbacks of naval grid is that it needs the naval energy unit to be installed.
Getting a pilot to the point where they can buy NEU takes a lot of time.
(personally i work around that by looking in shipyards for the ship i fly, but with the NEU)
A less capable version of naval grid that requires mil Shields could solve that.
Would such a version be a good idea ?
In the script, I found this bit of code -
Code: Select all
if(player.ship.equipmentStatus("EQ_NAVAL_SHIELD_BOOSTER") !== "EQUIPMENT_OK" || player.ship.equipmentStatus("EQ_NAVAL_ENERGY_UNIT") !== "EQUIPMENT_OK")
{ // as this.equipmentDamaged doesn't fire in this kind of script?
player.consoleMessage("Naval Grid damaged and offline", 4);
player.ship.setEquipmentStatus("EQ_NAVAL_GRID", "EQUIPMENT_DAMAGED");
if(this.shieldCheckTimer) { this.shieldCheckTimer.stop(); }
return;
}
Then I changed it's equipment.plist.
Code: Select all
(
(
8,
10000,
"Energy Grid",
"EQ_NAVAL_GRID",
"Smart-switching energy grid for enhanced shields and energy management. Upgraded flow supports faster shield recharging.",
{
"available_to_all" = yes;
script = "milGrid_script.js";
}
)
)
Then for a test, I put it on a startup Cobra and did a little pirate fighting.
Results: Normally, A Jameson would be whupped badly if not blown out of the sky by a pack of 3 to 4 pirates. Putting the grid on a startup ship improves chances of survival a little bit, but with a hefty demand on the energy banks. IMHO, From there, odds improve along the normal upgrade path - of course.
Running Oolite buttery smooth & rock stable w/ tons of eyecandy oxps on:
ASUS Prime X370-A
Ryzen 5 1500X
16GB DDR4 3200MHZ
128GB NVMe M.2 SSD (Boot drive)
1TB Hybrid HDD (For software and games)
EVGA GTX-1070 SC
1080P Samsung large screen monitor
ASUS Prime X370-A
Ryzen 5 1500X
16GB DDR4 3200MHZ
128GB NVMe M.2 SSD (Boot drive)
1TB Hybrid HDD (For software and games)
EVGA GTX-1070 SC
1080P Samsung large screen monitor
Re: Naval Grid OXP
Thanks for checking that, Cmdr Wyvern .
Assuming energy is above 64 ( 1 bank), naval grid adds 1 to fwd & aft shield strength 4 times a second (and subtracts 1 from energy).
This can amount to subtracting 8 energy every second if both shields need a boost.
That's higher then the energy recharge speed of the startup cobra.
Looks like we need a more dynamic way.
How about this :
If energy is below 25% of max, grid does nothing ( for the cobra3 this equals 64) .
3 devices ( all conflict with eachother so you can only have 1 installed) :
standard grid :
TL 8 , price 1000
Never adds more then 30% of energy rechargy rate per shield
basic cobra3 has energy recharge rate of 4, so gives 1.2
advanced grid :
requires & provides EEU
TL 10, price 2500
adds max 35% of energy recharge rate per shield
Cobra3 + EEU have energy recharge of 4 * 1.8 = 7.2, so gives 2.4 max
Naval grid
Requires & provides NEU, conflicts with standard & advanced grid
TL 14 , price 65000
add 39% of ship energy recharge rate
Cobra3 + NEU have 4 * 2.6 = 10.4 , so gives max 4.056
Not sure if basic grid and standard grid are good enough, will require testing.
Assuming energy is above 64 ( 1 bank), naval grid adds 1 to fwd & aft shield strength 4 times a second (and subtracts 1 from energy).
This can amount to subtracting 8 energy every second if both shields need a boost.
That's higher then the energy recharge speed of the startup cobra.
Looks like we need a more dynamic way.
How about this :
If energy is below 25% of max, grid does nothing ( for the cobra3 this equals 64) .
3 devices ( all conflict with eachother so you can only have 1 installed) :
standard grid :
TL 8 , price 1000
Never adds more then 30% of energy rechargy rate per shield
basic cobra3 has energy recharge rate of 4, so gives 1.2
advanced grid :
requires & provides EEU
TL 10, price 2500
adds max 35% of energy recharge rate per shield
Cobra3 + EEU have energy recharge of 4 * 1.8 = 7.2, so gives 2.4 max
Naval grid
Requires & provides NEU, conflicts with standard & advanced grid
TL 14 , price 65000
add 39% of ship energy recharge rate
Cobra3 + NEU have 4 * 2.6 = 10.4 , so gives max 4.056
Not sure if basic grid and standard grid are good enough, will require testing.
OS : Arch Linux 64-bit - rolling release
OXPs : My user page
Retired, reachable at [email protected]
OXPs : My user page
Retired, reachable at [email protected]
Re: Naval Grid OXP
After thinking about things, i've decided it's better to make Naval Grid more dynamic, switch to a conditions script and adapt the code to my own style before adding new devices.
OS : Arch Linux 64-bit - rolling release
OXPs : My user page
Retired, reachable at [email protected]
OXPs : My user page
Retired, reachable at [email protected]
Re: Naval Grid OXP
I have thought more about naval grid, and now feel it's best to use the r/w property of shield recharge rate so the core game code will handle the recharging of shields.
I'm currently thinking of 2 devices , a standard one that will require EEU and a naval version that will require NEU.
The available room to recharge shield will be calculated like this :
room = multiplier * .9 *
The .9 will ensure there's always some energy recharge left for other purposes.
The multiplier will cycle from 0 to max probably with steps of 25% and be settable through n , with b setting it to max (useful when fleeing).
The effective room will be divided between fwd & aft shield based on the ratio of their shield recharge rates.
The standard device could have a max of 75% , while the naval version could go up to 100% .
Please voice your thoughts about this approach.
I'm currently thinking of 2 devices , a standard one that will require EEU and a naval version that will require NEU.
The available room to recharge shield will be calculated like this :
room = multiplier * .9 *
energyRechargeRate - ( forwardShieldRechargeRate+ aftShieldRechargeRate )
The .9 will ensure there's always some energy recharge left for other purposes.
The multiplier will cycle from 0 to max probably with steps of 25% and be settable through n , with b setting it to max (useful when fleeing).
The effective room will be divided between fwd & aft shield based on the ratio of their shield recharge rates.
The standard device could have a max of 75% , while the naval version could go up to 100% .
Please voice your thoughts about this approach.
OS : Arch Linux 64-bit - rolling release
OXPs : My user page
Retired, reachable at [email protected]
OXPs : My user page
Retired, reachable at [email protected]
- 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: Naval Grid OXP
You need one more parenthesis around rates.Lone_Wolf wrote:room = multiplier * .9 *energyRechargeRate - ( forwardShieldRechargeRate+ aftShieldRechargeRate )
I do not think there is a point to make this equipment adjustable due to better if all energy go into the shields to defend the internal equipments until the last bank is filled, moreover another primeable equipment is not the best in red alert.
A single device is enough if the formula contain
energyRechargeRate
, this is already higher with NEU than EEU. So imho:
Code: Select all
room = .9 * ( energyRechargeRate - ( forwardShieldRechargeRate + aftShieldRechargeRate ) )
Re: Naval Grid OXP
The formulae was indeed missing those parenthesis.
Currently Naval Grid is already primable (n basically shows a status message) , although i doubt many people use it.
I do agree technically it's possible to have 1 device, but Thargoid set naval grid to a very high price and require NEU on purpose.
I would like to keep as much as possible of those intentions in the oxp.
How about removing the primable part, but give the standard device a lower multiplier then the naval version ?
The Naval grid would then become an upgrade to the standard version (which conflicts with NEU).
Handwavium : The standard version is dimensioned to work with the EEU and would just burn out when having to deal with the massive amount of available recharge enegy supplied by the NEU.
Currently Naval Grid is already primable (n basically shows a status message) , although i doubt many people use it.
I do agree technically it's possible to have 1 device, but Thargoid set naval grid to a very high price and require NEU on purpose.
I would like to keep as much as possible of those intentions in the oxp.
How about removing the primable part, but give the standard device a lower multiplier then the naval version ?
The Naval grid would then become an upgrade to the standard version (which conflicts with NEU).
Handwavium : The standard version is dimensioned to work with the EEU and would just burn out when having to deal with the massive amount of available recharge enegy supplied by the NEU.
OS : Arch Linux 64-bit - rolling release
OXPs : My user page
Retired, reachable at [email protected]
OXPs : My user page
Retired, reachable at [email protected]
- 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: Naval Grid OXP
Ok, your handwavium is very reasonable.Lone_Wolf wrote:How about removing the primable part, but give the standard device a lower multiplier then the naval version ?
Re: Naval Grid OXP
I've looked deeper and found several potential problems .
- Core game has 2 devices that influence shield recharge : Shield Boosters & Mil Shields
Both use a multiplier while my devices are intended to use an additive change.
My changes are intend to be applied AFTER shield booster / mil shield changes have been applied.
This means that if shield booster / mil shield get added or removed, i will have to :
revert the additive change
apply the change from shield booster/ mil shiels
calculate a new additive value
- The value used by my devices will also need to be recalculated if EEU or NEU get added/removed
- devices from other oxps could also change shield recharge and/or energy recharge. again I will have to recalculate energy grid values for these.
Basically i will have to atleast replace core equipmentAdded , equipmentDamaged , equipmentRepaired & equipementRemoved handlers by my own handler for every device that changes shield recharge and/or energy recharge.
Ofcourse there's an easy alternative : my devices could also use a multiplier instead of an additive.
Thargoid did his best to only apply naval grid boost if there was enough energy.
My personal feeling is that an additive shield recharge change that makes sure there's energy left for other things is much closer to his approach then using a mulitplicative change.
- Core game has 2 devices that influence shield recharge : Shield Boosters & Mil Shields
Both use a multiplier while my devices are intended to use an additive change.
My changes are intend to be applied AFTER shield booster / mil shield changes have been applied.
This means that if shield booster / mil shield get added or removed, i will have to :
revert the additive change
apply the change from shield booster/ mil shiels
calculate a new additive value
- The value used by my devices will also need to be recalculated if EEU or NEU get added/removed
- devices from other oxps could also change shield recharge and/or energy recharge. again I will have to recalculate energy grid values for these.
Basically i will have to atleast replace core equipmentAdded , equipmentDamaged , equipmentRepaired & equipementRemoved handlers by my own handler for every device that changes shield recharge and/or energy recharge.
Ofcourse there's an easy alternative : my devices could also use a multiplier instead of an additive.
Thargoid did his best to only apply naval grid boost if there was enough energy.
My personal feeling is that an additive shield recharge change that makes sure there's energy left for other things is much closer to his approach then using a mulitplicative change.
OS : Arch Linux 64-bit - rolling release
OXPs : My user page
Retired, reachable at [email protected]
OXPs : My user page
Retired, reachable at [email protected]
Re: Naval Grid OXP
The problems were easier to solve then i had expected, i now have a 1.10 WIP version that needs playtesting.
Some numbers :
Cobra3 + EEU + Shield Boosters + energy grid gives .8 extra shield charge PER shield , or 2.8 total
Cobra3 + NEU + Shield Boosters + Naval grid gives 3.3 extra per shield or 5.3 total
Cobra3 + NEU + Mil Shields + Naval grid gives 2.07 extra per shield or 5.07 total
FDL 3G +t , NEU, Mil shields, Naval Grid gives 3.2085 , total 6.2085
Caduceus alpha, NEU, Mil Shields, Naval Grid : 4.086 , total 7.086
For most ships this number is lower then the potential increase ( 4 + 4 ) of the old naval grid, but that potential value was rarely achieved due to the huge drain on the energy banks.
Some numbers :
Cobra3 + EEU + Shield Boosters + energy grid gives .8 extra shield charge PER shield , or 2.8 total
Cobra3 + NEU + Shield Boosters + Naval grid gives 3.3 extra per shield or 5.3 total
Cobra3 + NEU + Mil Shields + Naval grid gives 2.07 extra per shield or 5.07 total
FDL 3G +t , NEU, Mil shields, Naval Grid gives 3.2085 , total 6.2085
Caduceus alpha, NEU, Mil Shields, Naval Grid : 4.086 , total 7.086
For most ships this number is lower then the potential increase ( 4 + 4 ) of the old naval grid, but that potential value was rarely achieved due to the huge drain on the energy banks.
OS : Arch Linux 64-bit - rolling release
OXPs : My user page
Retired, reachable at [email protected]
OXPs : My user page
Retired, reachable at [email protected]
Re: Naval Grid OXP
Previous upload had several typos, also i simplified the code.
New download : https://app.box.com/s/mkozkxrr3cfypf6n7nhgdra0fw4ur00j
Main script :
New download : https://app.box.com/s/mkozkxrr3cfypf6n7nhgdra0fw4ur00j
Main script :
Code: Select all
"use strict";
this.name = "Naval Grid";
this.author = "Lone_Wolf";
this.copyright = "2015 Lone_Wolf";
this.licence = "CC-by-SA 4.0";
this.description = "Enhanced shield recharging unit";
this.version = "1.10";
this._ng_charging_devices =
[
"EQ_SHIELD_BOOSTER",
"EQ_NAVAL_SHIELD_BOOSTER",
"EQ_ENERGY_UNIT",
"EQ_NAVAL_ENERGY_UNIT"
];
this._ng_shield_charge_modifiers =
{
fwd:0,
aft:0
};
this._ng_switch_max = 0;
this.startUpComplete = function()
{
if ( !player.ship.script ) { player.ship.setScript("oolite-default-ship-script.js"); }; // just in case
if ( player.ship.equipmentStatus("EQ_ENERGY_GRID") == "EQUIPMENT_OK")
{
this._ng_switch_max = 0.5;
this._ng_setup_handlers();
};
if ( player.ship.equipmentStatus("EQ_NAVAL_GRID") == "EQUIPMENT_OK")
{
this._ng_switch_max = 0.9;
this._ng_setup_handlers();
};
delete this.startup;
};
this._ng_setup_handlers = function()
{
// store existing handlers
if ( player.ship.script.equipmentAdded ) { player.ship.script._ng_player_equipmentAdded_original = player.ship.script.equipmentAdded; };
if ( player.ship.script.equipmentRemoved ) { player.ship.script._ng_player_equipmentRemoved_original = player.ship.script.equipmentRemoved; };
// set new handlers
var new_player_equipmentAdded = function(eqkey)
{
worldScripts["Naval Grid"]._ng_equipment(eqkey, player.ship.script._ng_player_equipmentAdded_original );
};
var new_player_equipmentRemoved = function(eqkey)
{
worldScripts["Naval Grid"]._ng_equipment(eqkey, player.ship.script._ng_player_equipmentRemoved_original );
};
player.ship.script.equipmentAdded = new_player_equipmentAdded;
player.ship.script.equipmentRemoved = new_player_equipmentRemoved;
};
this._ng_player_equipment = function (eqkey, original_handler)
{
// avoiding "this.xxx" cause function will be called as a method of player.ship.script
// only act if STATUS_IN_FLIGHT
if ( player.ship.status != STATUS_IN_FLIGHT ) { original_handler(eqkey); return };
// verify if added/removed device influences NG modifiers
if ( worldScripts["Naval Grid"]._ng_charging_devices.indexOf(eqkey) == -1 ) { original_handler(eqkey); return };
// revert ng modifiers
worldScripts["Naval Grid"]._ng_player_modifiers("revert");
// apply original handler for device
original_handler(eqkey);
worldScripts["Naval Grid"]._ng_player_modifiers( "apply");
};
this._ng_player_modifiers = function(type)
{
// type = string
// apply = add values
// revert = subtract values
// verify if energy grid or naval grid are present and undamaged
if ( this._ng_switch_max == 0 ) return;
var rates =
{
fwd: player.ship.forwardShieldRechargeRate,
aft: player.ship.aftShieldRechargeRate,
energy: player.ship.energyRechargeRate,
switch_max: this._ng_switch_max
};
var modifiers = { fwd: 0,aft: 0 };
modifiers = this._ng_calc_modifiers(rates);
switch ( type )
{
case "apply":
player.ship.forwardShieldRechargeRate += modifiers.fwd;
player.ship.aftShieldRechargeRate += modifiers.fwd;
break;
case "revert":
player.ship.forwardShieldRechargeRate -= modifiers.fwd;
player.ship.aftShieldRechargeRate -= modifiers.fwd;
break;
default:
break;
};
};
this._ng_calc_modifiers = function(charge_rates)
{
/* Input
object charge_rates = { fwd_charge, aft_charge, energy_charge, switch_max }
Output
object = { fwd_modifier, aft_modifier }
*/
var modifiers = { fwd: 0, aft: 0 };
var shield_charge = fwd_charge + aft_charge;
charge_room = switch_max * ( energy_charge - shield_charge );
modifiers.fwd = (fwd_charge / shield_charge) * charge_room;
modifiers.aft = (aft_charge / shield_charge) * charge_room;
return modifiers;
};
OS : Arch Linux 64-bit - rolling release
OXPs : My user page
Retired, reachable at [email protected]
OXPs : My user page
Retired, reachable at [email protected]
- 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: Naval Grid OXP
Nice work. The normal Energy Grid for 2500cr is a good help in the early-midgame imho.