View Issue Details

IDProjectCategoryView StatusLast Update
0002788FSSCPAIpublic2013-02-10 09:36
ReporterWoolie Wool Assigned ToThe_E  
PriorityimmediateSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
PlatformAMD Phenom IIOSWindowsOS VersionVista
Product Version3.6.16 
Summary0002788: Difficulty level appears locked on Insane
DescriptionThe difficulty level for the game appears stuck on Insane, at least in regards to weapon fire rates and damage scaling. No matter how low you set the difficulty, enemy weapons will always do full damage.
Steps To ReproduceSet the difficulty to Very Easy. Load an FSPort mission with no shields (for instance, Small Deadly Space from the original FS1 campaign, The Fifth Column from the Twist of Fate Demo). Allow enemies to shoot you.

Vasudan Light Lasers will do 2-4% damage depending on whether one or both bolts hit.

Terran Turrets will do around 18% damage.

Being near (<150 m) an exploding Ma'at in Small Deadly Space will do catastrophic damage, perhaps killing you outright.

On older builds (the one I cross-tested on was dated 12/28/11), damage done by these weapons on Very Easy is one fourth this amount, as intended.
TagsNo tags attached.

Activities

Woolie Wool

2013-02-07 05:07

reporter   ~0014686

3.6.14 RC8 is not affected by this bug so it must have crept in during the 3.6.15 cycle.

niffiwan

2013-02-07 10:45

developer   ~0014687

Last edited: 2013-02-07 10:47

I have reproduced this with a little debug code to output the amount of damage taken by ships. I think it was introduced in r8629.

Tested in Easy (2/5), no mods active

r8628 I'm taking 6.75 hull damage from Subach's
r8629 I'm taking 13.5 hull damage from Subach's

I'll attach my test mission (which is just a hacked up version of an Axem test mission :nervous:)

Yarn

2013-02-08 00:00

developer  

WeaponDamageTest.fs2 (5,260 bytes)

Yarn

2013-02-08 00:00

developer   ~0014688

I can confirm that the bug was indeed introduced in r8629.

I have uploaded another test mission that should test this bug more reliably.

Zacam

2013-02-09 00:00

administrator   ~0014689

Last edited: 2013-02-09 03:05

Has anyone thought to check the damage scaling (pre and post) based on ALL the difficulty levels?

And yes. Woolie was kind enough to do exactly that over IRC with me.
Hull integrity damage reduction on an unshielded Apollo from a Terran Turret using the FS2 default AI profile, from Very Easy to Insane: 5, 9, 12, 15, 18

Is the results from a build pre-revision and the test build (which is current trunk with the revision backed out, but that has other side effects)

Build with the revision in question: the damage is 18, always on all difficulties.

niffiwan

2013-02-09 03:08

developer   ~0014691

Last edited: 2013-02-09 03:11

Aww... I just did that as well with Yarn's mission - well, not to let the results go to waste :)

No Mod active - Shivan Mega Laser firing at an Ursa

r8628
    very easy: 7.500000
    easy: 15.000000
    medium: 19.500000
    hard: 25.500000
    insane: 30.000000

r8629
    very easy: 30.000000
    easy: 30.000000
    medium: 30.000000
    hard: 30.000004
    insane: 30.000000

(also removed my test mission from the ticket)

Also note: the firing speed of the Basilisk did change, with hard & insane being noticeably faster than very easy / easy / medium

Woolie Wool

2013-02-09 03:18

reporter   ~0014692

Last edited: 2013-02-09 03:53

Confirmed that this actually isn't related to insane difficulty, but simply ignoring all damage scaling by difficulty.

I created a new AI profile called "LOL U R DED" with the damage factor on Insane set to 50000. Turrets still did 18% damage to the Apollo with newer builds.

In older builds, after correcting a stupid typo, a single ML-16 shot could kill the player in this profile on Insane in older builds. So it indeed has nothing to do with Insane but rather the complete absence of damage scaling.

Profile is:

$Profile name: LOL U R DED
$Player Damage Factor: 0.25, 0.5, 1, 1.5, 50000
#End

Yarn

2013-02-09 03:44

developer   ~0014693

Woolie Wool, I think I know why that's happening: you entered 0.5 as 0,5, which the game interprets as two values instead of one. See what happens if you correct that.

Woolie Wool

2013-02-09 03:52

reporter   ~0014694

Corrected, see note edit above. Everything ran as expected, instant overkill in older builds, 18% damage in newer builds.

Zacam

2013-02-09 04:01

administrator   ~0014695

So, it's not that it cares about the difficulty level scaling, it's that it is getting some arbitrary value and using that regardless of the difficulty scaling.

That -should- make it easier to track down.

Woolie Wool

2013-02-09 04:27

reporter   ~0014696

The +Difficulty Scale Type: parameter in armor.tbl is also broken and does nothing.

The_E

2013-02-09 23:32

administrator  

2788.patch (4,750 bytes)   
Index: shiphit.cpp
===================================================================
--- shiphit.cpp	(revision 9527)
+++ shiphit.cpp	(working copy)
@@ -1930,8 +1930,7 @@
 	int other_obj_is_asteroid;
 	int other_obj_is_debris;
 	int other_obj_is_ship;
-	float shp_diff_dmg_scale = 1.0f;	// Nuke: we will multiply difficulty related damage factors against this, so they can be passed to armor type GetDamage calls.
-	float sub_diff_dmg_scale = 1.0f;	// Nuke
+	float difficulty_scale_factor = 1.0f;
 
 	Assert(ship_obj);	// Goober5000
 	Assert(hitpos);		// Goober5000
@@ -1989,8 +1988,7 @@
 			// Do a little "skill" balancing for the player in single player and coop multiplayer
 			if (ship_obj->flags & OF_PLAYER_SHIP)	{
 				// Nuke - store it in a couple factor and we will apply it where needed
-				shp_diff_dmg_scale *= The_mission.ai_profile->player_damage_scale[Game_skill_level];
-				sub_diff_dmg_scale *= The_mission.ai_profile->player_damage_scale[Game_skill_level];
+				difficulty_scale_factor *= The_mission.ai_profile->player_damage_scale[Game_skill_level];
 			}		
 		}
 	}
@@ -2011,7 +2009,7 @@
 			Assert((beam_get_weapon_info_index(other_obj) >= 0) && (beam_get_weapon_info_index(other_obj) < Num_weapon_types));
 			if (((Weapon_info[beam_get_weapon_info_index(other_obj)].subtype != WP_LASER) || special_check) && (Player_obj != NULL) && (ship_obj == Player_obj))
 			{
-				ship_hit_pain(damage * shp_diff_dmg_scale);
+				ship_hit_pain(damage * difficulty_scale_factor);
 			}	
 		}
 		if (other_obj->type == OBJ_WEAPON)
@@ -2019,7 +2017,7 @@
 			Assert((Weapons[other_obj->instance].weapon_info_index > -1) && (Weapons[other_obj->instance].weapon_info_index < Num_weapon_types));
 			if (((Weapon_info[Weapons[other_obj->instance].weapon_info_index].subtype != WP_LASER) || special_check) && (Player_obj != NULL) && (ship_obj == Player_obj))
 			{
-				ship_hit_pain(damage * shp_diff_dmg_scale);
+				ship_hit_pain(damage * difficulty_scale_factor);
 			}
 		}
 	}	// read violation sanity check
@@ -2032,7 +2030,7 @@
 
 	//	if ship is already dying, shorten deathroll.
 	if (shipp->flags & SF_DYING) {
-		shiphit_hit_after_death(ship_obj, (damage * shp_diff_dmg_scale));
+		shiphit_hit_after_death(ship_obj, (damage * difficulty_scale_factor));
 		return;
 	}
 	
@@ -2079,21 +2077,21 @@
 			}
 			
 			float pre_shield = damage; // Nuke: dont use the difficulty scaling in here, since its also appled in Armor_type.GetDamage. dont want it to apply twice
-			float pre_shield_ss = (subsystem_damage * sub_diff_dmg_scale); // Nuke - same here
+			float pre_shield_ss = subsystem_damage; // Nuke - same here
 
 			if (piercing_pct > 0.0f) {
 				damage = pre_shield * (1.0f - piercing_pct);
 			}
 
 			// Nuke: apply pre_shield difficulty scaling here, since it was meant to be applied through damage
-			pre_shield *= shp_diff_dmg_scale;
+			pre_shield *= difficulty_scale_factor;
 
 			if(shipp->shield_armor_type_idx != -1)
 			{
 				// Nuke: this call will decide when to use the damage factor, but it will get used, unless the modder is dumb (like setting +Difficulty Scale Type: to 'manual' and not manually applying it in their calculations)
-				damage = Armor_types[shipp->shield_armor_type_idx].GetDamage(damage, dmg_type_idx, shp_diff_dmg_scale);
+				damage = Armor_types[shipp->shield_armor_type_idx].GetDamage(damage, dmg_type_idx, difficulty_scale_factor);
 			} else { // Nuke: if that didn't get called, difficulty would not be applied to damage so apply it here
-				damage *= shp_diff_dmg_scale;
+				damage *= difficulty_scale_factor;
 			}
 
 			damage = apply_damage_to_shield(ship_obj, quadrant, damage);
@@ -2122,7 +2120,7 @@
 	if ( (damage > 0.0f) || (subsystem_damage > 0.0f) )	{
 		int	weapon_info_index;
 		int armor_flags = 0;		
-		float pre_subsys = (subsystem_damage * sub_diff_dmg_scale); // Nuke: should be the last time we need to do this in this function
+		float pre_subsys = subsystem_damage; // Nuke: should be the last time we need to do this in this function
 		bool apply_hull_armor = true;
 		bool apply_diff_scale = true;
 
@@ -2159,13 +2157,13 @@
 			
 			if(shipp->armor_type_idx != -1)
 			{
-				damage = Armor_types[shipp->armor_type_idx].GetDamage(damage, dmg_type_idx, shp_diff_dmg_scale);
+				damage = Armor_types[shipp->armor_type_idx].GetDamage(damage, dmg_type_idx, difficulty_scale_factor);
 				apply_diff_scale = false;
 			}
 		}
 		// Nuke: this is done incase difficulty scaling is not applied into damage by getDamage() above
 		if (apply_diff_scale) {
-			damage *= shp_diff_dmg_scale; // Nuke: we can finally stop doing this now
+			damage *= difficulty_scale_factor; // Nuke: we can finally stop doing this now
 		}
 
 		// continue with damage?
2788.patch (4,750 bytes)   

The_E

2013-02-09 23:33

administrator   ~0014697

Attached a patch that may fix this. Please test.

niffiwan

2013-02-10 03:37

developer   ~0014698

Patch appears to fix the damage scaling. Tested with Yarn's mission:

Very Easy -> Insane:
7.500000
15.000000
19.500000
25.500000
30.000000

The_E

2013-02-10 09:36

administrator   ~0014699

Patch committed to trunk in 9529. The issues with +Difficulty Scale Type: will be dealt with in Mantis 2793.

Issue History

Date Modified Username Field Change
2013-02-07 05:03 Woolie Wool New Issue
2013-02-07 05:07 Woolie Wool Note Added: 0014686
2013-02-07 10:45 niffiwan Note Added: 0014687
2013-02-07 10:45 niffiwan Assigned To => niffiwan
2013-02-07 10:45 niffiwan Status new => confirmed
2013-02-07 10:46 niffiwan File Added: hurtme.fs2
2013-02-07 10:47 niffiwan Note Edited: 0014687
2013-02-07 10:47 niffiwan Assigned To niffiwan =>
2013-02-08 00:00 Yarn File Added: WeaponDamageTest.fs2
2013-02-08 00:00 Yarn Note Added: 0014688
2013-02-09 00:00 Zacam Note Added: 0014689
2013-02-09 03:05 Zacam Note Edited: 0014689
2013-02-09 03:08 niffiwan Note Added: 0014691
2013-02-09 03:08 niffiwan File Deleted: hurtme.fs2
2013-02-09 03:09 niffiwan Note Edited: 0014691
2013-02-09 03:11 niffiwan Note Edited: 0014691
2013-02-09 03:18 Woolie Wool Note Added: 0014692
2013-02-09 03:19 Woolie Wool Note Edited: 0014692
2013-02-09 03:27 Woolie Wool Note Edited: 0014692
2013-02-09 03:44 Yarn Note Added: 0014693
2013-02-09 03:48 Woolie Wool Note Edited: 0014692
2013-02-09 03:52 Woolie Wool Note Added: 0014694
2013-02-09 03:53 Woolie Wool Note Edited: 0014692
2013-02-09 04:01 Zacam Note Added: 0014695
2013-02-09 04:27 Woolie Wool Note Added: 0014696
2013-02-09 23:32 The_E File Added: 2788.patch
2013-02-09 23:33 The_E Note Added: 0014697
2013-02-10 03:37 niffiwan Note Added: 0014698
2013-02-10 09:36 The_E Note Added: 0014699
2013-02-10 09:36 The_E Status confirmed => resolved
2013-02-10 09:36 The_E Resolution open => fixed
2013-02-10 09:36 The_E Assigned To => The_E