How are shields governed
Moderators: winston, another_commander
- Commander Learner
- Dangerous
- Posts: 123
- Joined: Thu Aug 20, 2009 12:08 pm
- Location: Somewheeeeeere over the rainbooooooooooow~
How are shields governed
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...
Shooting polygons since 2001
- DaddyHoggy
- Intergalactic Spam Assassin
- Posts: 8515
- Joined: Tue Dec 05, 2006 9:43 pm
- Location: Newbury, UK
- Contact:
From memory - whether you're an adder or an Anaconda Oolite shield technology is identical - strength and recharge rate is not definable therefore. And NPCs don't actually have shields just energy (which actually is all shielding is if you're the player, it's just an energy reserve you use up before your equipment can be damaged)
Oolite Life is now revealed hereSelezen wrote:Apparently I was having a DaddyHoggy moment.
-
- Quite Grand Sub-Admiral
- Posts: 6683
- Joined: Wed Feb 28, 2007 7:54 am
Re: How are shields governed
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...
UPDATE_STAGE(@"updating energy and shield charges");
Everything happens between the line above and approximately the line that reads
UPDATE_STAGE(@"updating sun effects");
The recharge rate of any ship, including player, is set from ShipEntity.m, -shieldRechargeRate method.
- Smivs
- Retired Assassin
- Posts: 8408
- Joined: Tue Feb 09, 2010 11:31 am
- Location: Lost in space
- Contact:
Re: How are shields governed
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...
The recharge rate is fairly self-explanatory, with 1 being low and 5 being very high.
The number of Energy Banks is set by the 'Max Energy' setting. This works on a multiplyer of 64, so a Cobra with 4 energy banks has a Max Energy of 256 (4x64=256).
NPC ships don't really have the equivalent of things like shield boosters, so if you want to 'toughen-up' a NPC you have to tweak the recharge rate.
For example my Contractor has a recharge rate of 5 for the player ship, which can be augmented by adding Extra or Naval Energy Units. The pirate version has a recharge rate of 7 which is the roughly the equivalent of having an Extra Energy Unit, and the Bounty Hunter version has a rate of 10 to mimic a Naval Energy Unit.
Commander Smivs, the friendliest Gourd this side of Riedquat.
- DaddyHoggy
- Intergalactic Spam Assassin
- Posts: 8515
- Joined: Tue Dec 05, 2006 9:43 pm
- Location: Newbury, UK
- Contact:
So what everybody is saying is that I was wrong then...
Oolite Life is now revealed hereSelezen wrote:Apparently I was having a DaddyHoggy moment.
- Smivs
- Retired Assassin
- Posts: 8408
- Joined: Tue Feb 09, 2010 11:31 am
- Location: Lost in space
- Contact:
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...
Commander Smivs, the friendliest Gourd this side of Riedquat.
- Cmdr James
- Commodore
- Posts: 1357
- Joined: Tue Jun 05, 2007 10:43 pm
- Location: Berlin
- DaddyHoggy
- Intergalactic Spam Assassin
- Posts: 8515
- Joined: Tue Dec 05, 2006 9:43 pm
- Location: Newbury, UK
- Contact:
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.
Oolite Life is now revealed hereSelezen wrote:Apparently I was having a DaddyHoggy moment.
- Smivs
- Retired Assassin
- Posts: 8408
- Joined: Tue Feb 09, 2010 11:31 am
- Location: Lost in space
- Contact:
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.
I appreciate that this is a sticky problem...how do you give the novice a fighting chance while keeping things interesting for the more advanced player?
Commander Smivs, the friendliest Gourd this side of Riedquat.
- Cmdr James
- Commodore
- Posts: 1357
- Joined: Tue Jun 05, 2007 10:43 pm
- Location: Berlin
- Eric Walch
- Slightly Grand Rear Admiral
- Posts: 5536
- Joined: Sat Jun 16, 2007 3:48 pm
- Location: Netherlands
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.
However, during the period that shields still have energy, equipment can't be damaged. When you define that as having shields, one can say that NPC only have shields (One in total for both front and aft). As long as a NPC has energy, his equipment will not be at risk during a hit. That sounds as a shield to me.
Last edited by Eric Walch on Fri Jul 09, 2010 9:08 am, edited 1 time in total.
UPS-Courier & DeepSpacePirates & others at the box and some older versions
Which means no npc equipment gets damaged during fights!
There are a number of player specific features that we should be able to transfer to NPCs eventually, including battle damaged equipment & front/aft shields, but they're definitely something for EMMSRAN.
In the meantime, there's the unique opportunity for a 'realistic NPCs' oxp to implement NPC front/aft shield technology & battle damage for the immediate future...
There are a number of player specific features that we should be able to transfer to NPCs eventually, including battle damaged equipment & front/aft shields, but they're definitely something for EMMSRAN.
In the meantime, there's the unique opportunity for a 'realistic NPCs' oxp to implement NPC front/aft shield technology & battle damage for the immediate future...
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
- Commander Learner
- Dangerous
- Posts: 123
- Joined: Thu Aug 20, 2009 12:08 pm
- Location: Somewheeeeeere over the rainbooooooooooow~
Does that mean that shield charge rates are fixed? The only code that looks like it is player entity.m
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);
Shooting polygons since 2001
-
- Quite Grand Sub-Admiral
- Posts: 6683
- Joined: Wed Feb 28, 2007 7:54 am
Shield recharge rates are controlled from ShipEntity.m and are as follows:
Which means, with a military shield enhancer the shield recharge rate is 3, without one it is 2.
Code: Select all
- (float) shieldRechargeRate
{
return [self hasMilitaryShieldEnhancer] ? 3.0f : 2.0f;
}
- Commander Learner
- Dangerous
- Posts: 123
- Joined: Thu Aug 20, 2009 12:08 pm
- Location: Somewheeeeeere over the rainbooooooooooow~