How are shields governed
Posted: Fri Jul 09, 2010 2:50 am
Just curious as to which part of the source code deals with the strength and recharge rate of player shields. Can only find energy rates in the player entity...
For information and discussion about Oolite.
https://bb.oolite.space/
Player shield management is inside PlayerEntity.m, -doBookkeeping method. There is a very conveniently placed line in there to help you locate it, that reads:Commander Learner wrote:Just curious as to which part of the source code deals with the strength and recharge rate of player shields. Can only find energy rates in the player entity...
This is specified in the shipdata.plist for player ships.Commander Learner wrote:Just curious as to which part of the source code deals with the strength and recharge rate of player shields. Can only find energy rates in the player entity...
No. In essence you are right...shields and energy are basically the same thing. They just work differently for players and NPCs where players have a greater variety of ways of improving things.DaddyHoggy wrote:So what everybody is saying is that I was wrong then...
Now (I think) we can damage equipment on NPC ships (or at least script its addition and removal) does not having shields make it unfair on NPCs as they don't get the "grace period" of having shields?Cmdr James wrote:Im pretty sure handling of damage is different if it is taken by shields instead of hull. For example heating, and equipment damage are not the same (I think).
As previously stated NPCs dont have shields, but this can be "simulated" with more energy.
I agree. I can see no justification for this imbalance, and I personally feel that if a player can have something, NPCs should also have it available. The Ooniverse is very one-sided in favour of the player, which is probably a good thing for a new player with a weak ship, but an experienced player with an Iron-Ass can find things a bit too easy sometimes.DaddyHoggy wrote:Now (I think) we can damage equipment on NPC ships (or at least script its addition and removal) does not having shields make it unfair on NPCs as they don't get the "grace period" of having shields?Cmdr James wrote:Im pretty sure handling of damage is different if it is taken by shields instead of hull. For example heating, and equipment damage are not the same (I think).
As previously stated NPCs dont have shields, but this can be "simulated" with more energy.
It just depends how you define shields. For the player you can add up shields energy and energy banks to get the total energy needed to kill a player ship.Cmdr James wrote:I dont think anyone argues that it is correct that NPCs dont have shields.
Code: Select all
if (energy < maxEnergy)
{
double energy_multiplier = 1.0 + 0.1 * [self installedEnergyUnitType]; // 1.8x recharge with normal energy unit, 2.6x with naval!
energy += (float)(energy_recharge_rate * energy_multiplier * delta_t);
if (energy > maxEnergy)
energy = maxEnergy;
}
// Recharge shields from energy banks
float rechargeFwd = (float)([self shieldRechargeRate] * delta_t);
float rechargeAft = rechargeFwd;
float fwdMax = [self maxForwardShieldLevel];
float aftMax = [self maxAftShieldLevel];
if (forward_shield < fwdMax)
{
if (forward_shield + rechargeFwd > fwdMax) rechargeFwd = fwdMax - forward_shield;
forward_shield += rechargeFwd;
energy -= rechargeFwd;
}
if (aft_shield < aftMax)
{
if (aft_shield + rechargeAft > aftMax) rechargeAft = aftMax - aft_shield;
aft_shield += rechargeAft;
energy -= rechargeAft;
}
forward_shield = OOClamp_0_max_f(forward_shield, fwdMax);
aft_shield = OOClamp_0_max_f(aft_shield, aftMax);
Code: Select all
- (float) shieldRechargeRate
{
return [self hasMilitaryShieldEnhancer] ? 3.0f : 2.0f;
}