Page 1 of 1

oolite damage model ?

Posted: Mon Apr 11, 2011 6:47 pm
by Lone_Wolf
I'm currently flying a dragon-M which has same shield / ernegy banks as the cobby, but a much higher recharge rate.

If i'm under attack by several ships with mil. lasers, the shields drain quickly and i get equipment damage.
energy levels however don't seem to go down (much) .

If my memory is correct in comments in the ironhide thread it was stated that after the shields were drained,
additional damage would reduce the energy level in the energy banks before hull/ cargo/ equipment damage was taken.

Based on my observation i wonder if that is correct.

situation :
shields are drained to 0
you get additional damage
what is the effect of the additonal damage ?

Re: oolite damage model ?

Posted: Mon Apr 11, 2011 7:13 pm
by Thargoid
IronHide comes in between shields and energy bank draining. However equipment damage and cargo loss can happen at any point when your shields are at zero, regardless of how much is in your energy banks (although I think there may be some dependence on the probability there).

IronHide for example doesn't stop things getting damaged, it only acts as extra protection before your energy banks get drained.

Re: oolite damage model ?

Posted: Mon Apr 11, 2011 7:28 pm
by Lone_Wolf
Thanks for clarifying what ironhide does, thargoid.
I hope one of the developers can shed light on my question.

Re: oolite damage model ?

Posted: Tue Apr 12, 2011 2:06 pm
by Lone_Wolf
I may have found what i was looking in PlayerEntity.m .

Interesting piece of code, some comments :

high max_cargo makes a ship more vulnerable


1 of 3 things can happen in order of likelyhood :
A. Cargo damaged
B. equipment damaged
C. trade-in-factor is reduced (next maintenance overhaul will be sooner)

Having a lot of cargo reduces the chance of B+C.
Does this make an Anaconda with 650 cheap cargopods almost invulnerable to equipment damage ?

Having less equipment reduces the chance of equipment damage, but increases the chance for C

Does the LCB expansion increase max_cargo ?

I play mainly as a bounty hunter, but this code makes me wonder if i should start looking at ships with bigger cargo holds and fill the hold with cheap stuff.
On the other hand, a ship with low max_cargo and low mass is less vulnerable.

Code: Select all

- (BOOL) takeInternalDamage
{
	unsigned n_cargo = max_cargo;
	unsigned n_mass = [self mass] / 10000;
	unsigned n_considered = (n_cargo + n_mass) * ship_trade_in_factor / 100; // a lower value of n_considered means more vulnerable to damage.
	unsigned damage_to = n_considered ? (ranrot_rand() % n_considered) : 0;	// n_considered can be 0 for small ships.
	BOOL     result = NO;
	// cargo damage
	if (damage_to < [cargo count])
	{
		ShipEntity* pod = (ShipEntity*)[cargo objectAtIndex:damage_to];
		NSString* cargo_desc = [UNIVERSE displayNameForCommodity:[pod commodityType]];
		if (!cargo_desc)
			return NO;
		[UNIVERSE clearPreviousMessage];
		[UNIVERSE addMessage:[NSString stringWithFormat:DESC(@"@-destroyed"), cargo_desc] forCount:4.5];
		[cargo removeObject:pod];
		return YES;
	}
	else
	{
		damage_to = n_considered - (damage_to + 1);	// reverse the die-roll
	}
	// equipment damage
	if (damage_to < [self equipmentCount])
	{
		NSArray			*systems = [[self equipmentEnumerator] allObjects];
		NSString		*system_key = [systems objectAtIndex:damage_to];
		OOEquipmentType	*eqType = [OOEquipmentType equipmentTypeWithIdentifier:system_key];
		NSString		*system_name = [eqType name];
		
		if (![eqType canBeDamaged] || system_name == nil)  return NO;
		
		// set the following so removeEquipment works on the right entity
		[self setScriptTarget:self];
		[UNIVERSE clearPreviousMessage];
		[self removeEquipmentItem:system_key];
		if (![UNIVERSE strict])
		{
			NSString *damagedKey = [NSString stringWithFormat:@"%@_DAMAGED", system_key];
			[self addEquipmentItem:damagedKey];	// for possible future repair.
			[self doScriptEvent:OOJSID("equipmentDamaged") withArgument:system_key];
			
			if (![self hasEquipmentItem:system_name] && [self hasEquipmentItem:damagedKey])
			{
				/*
					Display "foo damaged" message only if no script has
					repaired or removed the equipment item. (If a script does
					either of those and wants a message, it can write it
					itself.)
				*/
				[UNIVERSE addMessage:[NSString stringWithFormat:DESC(@"@-damaged"), system_name] forCount:4.5];
			}
		}
		else
		{
			[self doScriptEvent:OOJSID("equipmentDestroyed") withArgument:system_key];
			if (![self hasEquipmentItem:system_name])	// Because script may have undestroyed it
			{
				[UNIVERSE addMessage:[NSString stringWithFormat:DESC(@"@-destroyed"), system_name] forCount:4.5];
			}
		}
		
		// if Docking Computers have been selected to take damage and they happen to be on, switch them off
		if ([system_key isEqualToString:@"EQ_DOCK_COMP"] && autopilot_engaged)  
		{
			[self disengageAutopilot];
		}
		return YES;
	}
	//cosmetic damage
	if (((damage_to & 7) == 7)&&(ship_trade_in_factor > 75))
	{
		ship_trade_in_factor--;
		result = YES;
	}
	return result;
}

Re: oolite damage model ?

Posted: Wed Apr 13, 2011 3:54 pm
by Lone_Wolf
using the debug console i found that a cobra MK III (fully kitted out, including ironhide, autolock, energy bomb etc) has a mass of 185580 .
Going through the sourcecode i found strong indications that max_cargo is equal to the total cargospace.

For the above code snippet and my Cobbie that means :
n_cargo = 35
n_mass = 19 (rounded)

To make things easy i'm assuming ship_trade_in_factor is 100 .
n_considered = 54

with full cargo hold that translates to a chance of 35/54 = 64.8 % that if you get damage cargo and not equipment will be damaged.

Now suppose there's no LCB installed, then n_considered = 39 .
chance for cargo damage : 20/39 = 51.3 %

While i haven't got the mass of an anaconda, for the sake of argument let's assume it weighs 10 times as much as the cobbie .
n_cargo = 750
n_mass = 190
n_considered = 940

chance for damage cargo : 750 /940 = 79.8 %
If it is lighter then 10x cobbie the chance increases.

from the code and data 2 things are clear :
if you are in for a heavy fight, fill your cargo hold and loose equipment you don't really need.

(i think i can loose some equipped items i don't need all the time, so time to install sellit oxp).

Note : while searching i found a JS property not yet listed on the wiki :
player.ship.mass , read-only .

Re: oolite damage model ?

Posted: Wed Apr 13, 2011 4:03 pm
by JensAyton
Lone_Wolf wrote:
Note : while searching i found a JS property not yet listed on the wiki :
player.ship.mass , read-only .
It’s inherited from Entity.

Re: oolite damage model ?

Posted: Wed Apr 13, 2011 11:08 pm
by Lone_Wolf
Ahruman wrote:
Lone_Wolf wrote:
Note : while searching i found a JS property not yet listed on the wiki :
player.ship.mass , read-only .
It’s inherited from Entity.
No wonder i couldn't find it, hadn't thought of checking entity.

I've done more calculations, and my conclusion that filling the hold is a good way to reduce equipment damage is not entirely correct.
Having a full hold does reduce the chance for equipment damage a bit, but a lot less then i thought when i looked at the chances taking into account the way the code works.

for a cobbie with 23 equipment count (counted what's listed on F5 page) these are the results :
full hold : 35.19 % chance of equipment damage
empty hold : 41.82 % chance of equipment damage

for ships with bigger cargo holds, the chance for equipment damage is much lower, and the diff between full / empty hold is very small.

In other words : A Boa 2 can take a lot more punishment thern a cobbie

Re: oolite damage model ?

Posted: Wed Apr 20, 2011 5:40 pm
by Cmdr Wyvern
The NPC Dragon M, for being a smaller ship than the Cobbie, can shrug off a lot more abuse; but it's kitted with EEU and military shields.

When I was playtesting the Kirin in 1.73, I wanted to know how much fire it could handle before blowing. I deliberately misjumped it and let the Thargs hammer on it. It could handle a lot of punishment, but it is larger than an Anaconda.

Re: oolite damage model ?

Posted: Sun May 15, 2011 2:45 pm
by Ad_Astra
Cmdr Wyvern wrote:
The NPC Dragon M, for being a smaller ship than the Cobbie, can shrug off a lot more abuse; but it's kitted with EEU and military shields.

When I was playtesting the Kirin in 1.73, I wanted to know how much fire it could handle before blowing. I deliberately misjumped it and let the Thargs hammer on it. It could handle a lot of punishment, but it is larger than an Anaconda.
That's very interesting - the question becomes "If you regularly get into dangerous combat situations, is it worth getting a bigger bulkier ship that can take more punishment at the expense of speed and manoeuvrability?" :?:

Re: oolite damage model ?

Posted: Mon May 16, 2011 2:19 am
by Switeck
The regular Boa 2 can take a lot of punishment if you have all the goodies it can get. But it's not terribly slow or unmaneuverable., just expensive. At 175 TC capacity, it's also near the top of player ships for how much it can haul even though that pales compared to an Anaconda's 750 TC. Unless you're doing cargo contracts, you'll be lucky to fill it up with what just the main station has for sale.