Age of Conquest: Income & Expenses
Due to numerous requests, below is a description of income & expenses in Age of Conquest III. The system is up and running on Android already and will come to PC, Macintosh & Linux soon.
The income and expenses for each turn are calculated as follows:
World world = ... // the world including everything Entity entity = ... // the empire we are doing the calculations for // assets long money = entity.getMoney(); // income: tax long taxIncome = getTaxIncome(world.getProduction(entity), entity.getTaxRate(), entity.getMorale()); money += taxIncome; // income: vassals for (Entity vassal: vassals) { long vassalIncome = getTaxIncome(world.getProduction(vassal), vassal.getTaxRate(), vassal.getMorale()); money += getVassalPay(taxIncome); } // expenses: economy and military spending money -= getEconomySpending(taxIncome, entity.getSpendingEconomy())); money -= getMilitarySpending(world.getMilitary(entity), entity.getSpendingMilitary())); // expenses: tributes to vassal masters for (Entity master: masters) { money -= getVassalPay(taxIncome); }
Please note, production is a factor of economy x population.
Utility functions to calculate costs as well as economy, population and military increases/decreases depending on the spending settings chosen.
/** The percent the vassal pays. */ public static final int VASSAL_PAY_PERCENTAGE = 10; /** The standard economy spending in percent [0, 100]. */ public static final int STANDARD_SPENDING_ECONOMY = 80; /** The standard military spending in percent [0, 100]. */ public static final int STANDARD_SPENDING_MILITARY = 80; /** * Returns the tax for the given number of people. * * @param production The production. * @param taxRate The tax rate in percent [0, 100]. * @param morale The morale in percent [0, 100]. * @return The tax. */ public long getTaxIncome(long production, int taxRate, int morale) { return Math.round(Math.pow(production * 0.08d, 0.96d) * taxRate/10*morale/100); } /** * Returns the payment a vassal slave has to pay to * his master based on his production. * * @param taxIncome The tax income of the vassal slave. * @return The pay a vassal slave has to pay to his master. */ public long getVassalPay(long taxIncome) { return taxIncome * VASSAL_PAY_PERCENTAGE / 100; } /** * Returns the investment spending for the given tax income. * * @param taxIncome The tax income. * @param economySpending The economy spending. * @return The expenses. */ public long getEconomySpending(long taxIncome, int economySpending) { return (taxIncome / 10) * economySpending / STANDARD_SPENDING_ECONOMY; } /** * Returns the economy increase for the given spending rate. * * @param economySpending The spending. * @return The increase factor. Stays stable for 1, decreases * or less than 1 and increases for more than 1. */ public float getEconomyIncrease(int economySpending) { return 1.03f + ((economySpending - Market.STANDARD_SPENDING_ECONOMY) * 0.03f / 100); } /** * Returns the population increase for the given spending rate. * * @param economySpending The spending. * @return The increase factor. Stays stable for 1, decreases * for less than 1 and increases for more than 1. */ public float getPopulationIncrease(int economySpending) { return 1.01f + (economySpending * 0.001f); } /** * Returns the upkeep cost for the given number of military units. * * @param military The military units. * @param militarySpending The military spending. * @return The upkeep cost. */ public long getMilitarySpending(long military, int militarySpending) { return (military / 5) * militarySpending / STANDARD_SPENDING_MILITARY; } /** * Returns the military increase for the given spending rate. * * @param militarySpending The spending. * @return The increase factor. Stays stable for 1, decreases * for less than 1 and increases for more than 1. */ public float getMilitaryIncrease(int militarySpending) { return 1.0f + ((militarySpending - Market.STANDARD_SPENDING_MILITARY) * 0.5f / 100); }