Opening up the Morale Formula

I’ve been looking at this bug and am getting frustrated at our mess of a morale formula.

It’s long overdue that we pick this thing apart publicly so we can start with a new baseline. If we want to add some secret sauce to it after, that’s fine, but our base formula is completely out of whack.

Here are the juicy bits:

VAR_A = number of Attacker’s attacks on Defender in the last 26 turns
VAR_B = number of Attacker’s attacks on Defender in the last 26-52 turns
VAR_C = number of Attacker’s attacks on Defender in the last 52-78 turns

VAR_Y = 1 + ((VAR_A / 10) + (VAR_B / 20) + (VAR_C / 40)) * sqrt(100 / DEFENDER_SIZE);

MORALE_LOSS = (1 + 3 * pow(VAR_X, 4/3) * VAR_Y) / pow(ATTACKER_SIZE] / 100,2/3);

You can test the formula above here:

To be blunt: I have no idea why it’s written this way. This is a core part of the game code that has been victim of black magic and random adjustments over the years. The current morale code above was itself resurrected from an old copy of the game files that predated the 2015 morale shake-up.

I don’t have access to the “original” morale formula, and per Stefan, there are no copies of the game files older than the ones I already have.

In short: if we want something that feels closer to the original, and/or something more balanced, we’re going to have to reverse engineer it based on what we remember. Alternatively, we can throw our expectations out the window and start from scratch.

I’m going to come up with some alternatives to test with, but those of you with math chops are more than welcome to throw out ideas of your own. The general goal is simple: the larger the gap between you and a smaller empire, the more morale you should lose.

There’s a google sheet here if anybody wants to clone it to muck around with it:

Interesting to see number of previous attacks impacts morale. It’s not just size dependent after all.

That Y variable :rofl: Why? So complex lol. It seems to create a weighing factor on defender size.

Pow var x and pow attacker size in formula feels like it can be simplied as its just multiplication with same base number.

Going to play with this a bit.

Most easy way to make a morale formula imho. Give the community attacker and defender sizes. Let them fill in suitable morale loss. Plot a curve through the averages.

I am glad it adds numbers, if you were at those sizes but reversed so 100-5 then you are looking at 120+ which gives chance for the little guy to still play.

120 was roughly formed from attacker/defender 100/5 (20) plus attacker size (100) to make 120. Not an accurate formula but it gives a realistic estimate out the other end in a quick and easy fashion.

So attacker 35 and defender 35 would give 36 morale, attacker 20 and defender 300 would give 20 morale, see it doesn’t work with everything to test the current formula but 120+ is reasonable for 100-5

I don’t see specific need to change the current (classic: Pre-2015) one and the modern morale system was hated dearly.

Lets assume no history, than VAR Y is 1

When i fill in the example of the bug report (attacker 1 vs defender 150). I get 1% morale loss and not 22%.

@I_like_pie I suspect the part VAR_Y) / pow(ATTACKER_SIZE] / 100,2/3); to be bugged.

With one planet that part equals to 21.5%. Add 1% base morale (0,5% in war) and the numbers add up to the bug report. Maybe that part gets added somewhere instead of multiplied?

1 planet bug was noted a while back and to quote pie, ‘feel free to “call me out” as much as you’d like on bugs i’ve addressed a year ago :wink:’. You are not expressly calling him out but I don’t want the quote to go to waste.

1 Like

Not quite a year ago but yes I’ve been sitting on this one for months. :stuck_out_tongue: Call outs here justified.

/me lashes self

If we were to look at a whole new morale formula, it’s interesting to see what you want to achieve with it, and what people find important in morale and to be the purpose of morale in general. This I find very interesting, and happy to help with.

Reverse engineering an old piece of code --> No thanks!

I tried reverse engineering my morale cost expectations… i did calc in high school but pretty much just played blackjack at the back of the class… i could get it to sort of work but the scaling was out of control.

8 posts were split to a new topic: Fleet Efficiency

I remember in the Alpha and Beta rounds, that there were a group of players that reverse engineered the various formulas as they were not released publicly yet. Altruist, Starstrike and others whose names escape my mind. They did it by running tests on themselves within a galaxy while regular play was happening. Bold, but it worked to their advantage.

A big if, but if it would be possible to get in touch with some of those Legends, they might be willing to put those same math skills to work to help decipher the existing formulas and come up with better ones.

We’re likely going to replace morale entirely, so there is no longer a need to “fix” or redesign it.

Please see Fleet Efficiency for further discussion.