Page 1 of 1

Difficulty Levels

Posted: Tue Aug 11, 2020 5:54 am
by StuccoFresco
Hi all, is it possible to change the Strenght bonus given by difficulty levels?

Re: Difficulty Levels

Posted: Tue Aug 11, 2020 12:33 pm
by GabeKnight
StuccoFresco wrote: Tue Aug 11, 2020 5:54 am Hi all, is it possible to change the Strenght bonus given by difficulty levels?
I guess not. But you can use the #stimpack cheat to boost individual units.

Re: Difficulty Levels

Posted: Tue Aug 11, 2020 6:21 pm
by StuccoFresco
Well I was trying to make all units default max strength 20. Changing it in the units.csv does nothing.

Re: Difficulty Levels

Posted: Mon Nov 16, 2020 4:33 pm
by huckc
I'm also interested in changing max difficulty from +3 enemy strength to +5.

Taking a quick look at the game files and it isn't an easy change it seems but I think I found it in the C# code (Assembly-CSharp.dll):

Code: Select all

App.unitStrengthMaxFactor : Single[]
	Used By
		AITasks.KillEnemy..ctor(Double)
		AITasks.RefuelAndRepair.EvaluateStateValue(GameState, GameState) : Double
		AITasks.StayAlive.Initialise(GameState) : Void
		Alliance.GetMaxUnitStrength() : Int32
		App..cctor()
		CampaignUI.CheckCoreValue() : Void
		NewUI.CampaignUI.CheckCoreValue() : Void
		Unit.ApplyStrengthDifficultyMod(GameState) : Void
	Assigned By
		App..cctor()
Getting set int App..cctor():

Code: Select all

unitStrengthMaxFactor = new float[] { 0.6f, 0.8f, 1f, 1.15f, 1.3f };

Re: Difficulty Levels

Posted: Mon Nov 16, 2020 7:41 pm
by huckc
So continuing from the above I able to able to change the strength modifiers using a hex editor by searching for the current array initializer above but in hex form:

Code: Select all

	0x9A, 0x99, 0x19, 0x3F, 0xCD, 0xCC, 0x4C, 0x3F, 0x00, 0x00, 0x80, 0x3F,
	0x33, 0x33, 0x93, 0x3F, 0x66, 0x66, 0xA6, 0x3F
You'll notice there's 20 values there, four for each difficulty level starting the with the first one. And since I was interesting in editing the last difficulty and making it 1.5x instead of 1.3x, I changed the final four values giving us this:

Code: Select all

	0x9A, 0x99, 0x19, 0x3F, 0xCD, 0xCC, 0x4C, 0x3F, 0x00, 0x00, 0x80, 0x3F,
	0x33, 0x33, 0x93, 0x3F, 0x00, 0x00, 0xC0, 0x3F
And now I'm getting pummeled by 15 strength enemy aircraft at Pearl Harbor :D

Re: Difficulty Levels

Posted: Mon Nov 16, 2020 10:50 pm
by GabeKnight
huckc wrote: Mon Nov 16, 2020 7:41 pm And now I'm getting pummeled by 15 strength enemy aircraft at Pearl Harbor :D
Cool. All this hex-stuff reminds of the things I was doing when I was young... :lol:

Okay, it seems to be easy for everybody to de-compile and read the function's source code, but what's the deal with re-compiling? Why use a hex editor?
huckc wrote: Mon Nov 16, 2020 4:33 pm

Code: Select all

unitStrengthMaxFactor = new float[] { 0.6f, 0.8f, 1f, 1.15f, 1.3f };
Interesting, so it's not really "12" HP with difficulty 4? :shock:

Re: Difficulty Levels

Posted: Mon Nov 16, 2020 11:33 pm
by huckc
GabeKnight wrote: Mon Nov 16, 2020 10:50 pm
huckc wrote: Mon Nov 16, 2020 7:41 pm And now I'm getting pummeled by 15 strength enemy aircraft at Pearl Harbor :D
Cool. All this hex-stuff reminds of the things I was doing when I was young... :lol:

Okay, it seems to be easy for everybody to de-compile and read the function's source code, but what's the deal with re-compiling? Why use a hex editor?
Using a hex editor is significantly easier than re-compiling code which I can only assume also has protections/barriers in place to prevent end users from doing so. When compiling, everything needs to be 100% in place and in working order, including the use of private keys and dependency systems that they would only possess.

Re: Difficulty Levels

Posted: Tue Nov 17, 2020 2:24 am
by GabeKnight
Okay, thanks for the info. :)

BTW, how does it play against 15HP enemy units? Winnable?
... I'm curious....Please do tell after you've played some of the German scens/campaigns... :mrgreen: