Thiago P.

Better happiness (and repression)

Posted in Rambling, Math

← back to the blog


 

The public order(happiness vs unhappiness) system in Rome 2 is constant and accumulative (last time I checked).

This means that if a slight raise in taxes results in a net -2 public, after 50 turns, the city will rebel(-100 public order). REALLY. It takes 50 years for you to decide that the tax rate is to high. 1 turn per year = 50 years!

 

I more realistic model would be if each effect on public order had an upper or lower bound i.e. a maximum. Once public order reached that bound, that effect would no longer change public order.

For example, building a fishing port causes -2 public order per turn. If the bound of the fishing port were -20, then once public order reaches -20, the fishing port no longer affects public order. Additionally, the effect of -2, could decrease as public order gets closer to the bound (-20).

Why not implement such a function in JavaScript

 

function rationalInfluence(current, bound, weight) {
	if(current == 0) {
		current = 1;
	}

	// base factor - should decrease as "current" increases (assuming bound stays constant)
	const factor = bound/current;

	// map factor to a value between 0 and 1 and then multiply it by weight
	const growth = (factor / bound) * weight;

	current = current + growth;

	// once the bound is reached, stop
	if(current >= bound) {
		return bound;
	}
	else {
		return current;
	}
}

/*
* USAGE
* Every turn apply the return of rationalInfluence(...) to the current public order, for
* each item affecting the public order.
*/

 

The results of this when graphed, resemble a bounded exponential function. It may actually be possible to abandon the above JavaScript function in favor of a boiler plate bounded exponential function.

Mabey it's time to go back and review exponential functions.