<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://wiki.soccerverse.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Tyki</id>
	<title>Soccerverse Wiki - User contributions [en-gb]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.soccerverse.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Tyki"/>
	<link rel="alternate" type="text/html" href="https://wiki.soccerverse.com/index.php/Special:Contributions/Tyki"/>
	<updated>2026-05-06T01:55:40Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.45.3</generator>
	<entry>
		<id>https://wiki.soccerverse.com/index.php?title=Backend_Game_Logic&amp;diff=66</id>
		<title>Backend Game Logic</title>
		<link rel="alternate" type="text/html" href="https://wiki.soccerverse.com/index.php?title=Backend_Game_Logic&amp;diff=66"/>
		<updated>2025-05-06T16:43:25Z</updated>

		<summary type="html">&lt;p&gt;Tyki: /* End of Season */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki walks through all of the backend game logic (GSP), starting at the game world&#039;s creation and the creation of its first season, all the way through a season&#039;s worth of fixtures, the end of season event and then the creation of a new season.&lt;br /&gt;
&lt;br /&gt;
The match day process flow of pre‑match, match and post match is walked through as well as the daily player fitness increases.&lt;br /&gt;
&lt;br /&gt;
Some source code snippets are provided in certain places to help explain the formulas that are used.&lt;br /&gt;
&lt;br /&gt;
==When the game world is created==&lt;br /&gt;
&lt;br /&gt;
For each club, the average rating of the best 11 players is calculated and stored.  &lt;br /&gt;
This value is immutable and later used for things such as calculating the average player rating of the league, which is also immutable.&lt;br /&gt;
&lt;br /&gt;
It&#039;s stored as:&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;clubs.rating_start&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Then the first season is created.&lt;br /&gt;
&lt;br /&gt;
==Creating a new season==&lt;br /&gt;
&lt;br /&gt;
* Each club&#039;s transfer limits are reset for transfer in and transfer out.&lt;br /&gt;
* Each club&#039;s form is reset.&lt;br /&gt;
* Players&#039; form, yellow cards, red cards, yellow/red cards, banned and stamina are all reset.&lt;br /&gt;
* A player&#039;s wage for the season is calculated based on his current rating.  &lt;br /&gt;
If the player rating is below 60 then the wage is calculated using the formula below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if (rating &amp;lt; 60)&lt;br /&gt;
    return (5 * rating) * moneybase_multiplier;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where &#039;&#039;moneybase_multiplier&#039;&#039; is set to be 50,000 when the game world is created.&lt;br /&gt;
&lt;br /&gt;
If the player value is 60 rated or above then it uses the formula below, basically starting at 1500 then increasing by 20% more than the previous rating.  &lt;br /&gt;
It uses the formula below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AmountT wage = 300;&lt;br /&gt;
&lt;br /&gt;
for(int ic1 = 1; ic1 &amp;lt;= (rating-60); ic1++)&lt;br /&gt;
{&lt;br /&gt;
    wage = ((wage * 12 ) / 10);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
return wage * moneybase_multiplier;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A grid of all the wages to ratings can be seen in the table below:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Rating !! Wage&lt;br /&gt;
|-&lt;br /&gt;
| 50 || 1,250&lt;br /&gt;
|-&lt;br /&gt;
| 51 || 1,275&lt;br /&gt;
|-&lt;br /&gt;
| 52 || 1,300&lt;br /&gt;
|-&lt;br /&gt;
| 53 || 1,325&lt;br /&gt;
|-&lt;br /&gt;
| 54 || 1,350&lt;br /&gt;
|-&lt;br /&gt;
| 55 || 1,375&lt;br /&gt;
|-&lt;br /&gt;
| 56 || 1,400&lt;br /&gt;
|-&lt;br /&gt;
| 57 || 1,425&lt;br /&gt;
|-&lt;br /&gt;
| 58 || 1,450&lt;br /&gt;
|-&lt;br /&gt;
| 59 || 1,475&lt;br /&gt;
|-&lt;br /&gt;
| 60 || 1,500&lt;br /&gt;
|-&lt;br /&gt;
| 61 || 1,800&lt;br /&gt;
|-&lt;br /&gt;
| 62 || 2,160&lt;br /&gt;
|-&lt;br /&gt;
| 63 || 2,592&lt;br /&gt;
|-&lt;br /&gt;
| 64 || 3,110&lt;br /&gt;
|-&lt;br /&gt;
| 65 || 3,732&lt;br /&gt;
|-&lt;br /&gt;
| 66 || 4,479&lt;br /&gt;
|-&lt;br /&gt;
| 67 || 5,375&lt;br /&gt;
|-&lt;br /&gt;
| 68 || 6,450&lt;br /&gt;
|-&lt;br /&gt;
| 69 || 7,740&lt;br /&gt;
|-&lt;br /&gt;
| 70 || 9,288&lt;br /&gt;
|-&lt;br /&gt;
| 71 || 11,145&lt;br /&gt;
|-&lt;br /&gt;
| 72 || 13,374&lt;br /&gt;
|-&lt;br /&gt;
| 73 || 16,049&lt;br /&gt;
|-&lt;br /&gt;
| 74 || 19,259&lt;br /&gt;
|-&lt;br /&gt;
| 75 || 23,111&lt;br /&gt;
|-&lt;br /&gt;
| 76 || 27,733&lt;br /&gt;
|-&lt;br /&gt;
| 77 || 33,279&lt;br /&gt;
|-&lt;br /&gt;
| 78 || 39,935&lt;br /&gt;
|-&lt;br /&gt;
| 79 || 47,922&lt;br /&gt;
|-&lt;br /&gt;
| 80 || 57,506&lt;br /&gt;
|-&lt;br /&gt;
| 81 || 69,008&lt;br /&gt;
|-&lt;br /&gt;
| 82 || 82,809&lt;br /&gt;
|-&lt;br /&gt;
| 83 || 99,371&lt;br /&gt;
|-&lt;br /&gt;
| 84 || 119,245&lt;br /&gt;
|-&lt;br /&gt;
| 85 || 143,094&lt;br /&gt;
|-&lt;br /&gt;
| 86 || 171,713&lt;br /&gt;
|-&lt;br /&gt;
| 87 || 206,056&lt;br /&gt;
|-&lt;br /&gt;
| 88 || 247,267&lt;br /&gt;
|-&lt;br /&gt;
| 89 || 296,720&lt;br /&gt;
|-&lt;br /&gt;
| 90 || 356,064&lt;br /&gt;
|-&lt;br /&gt;
| 91 || 427,277&lt;br /&gt;
|-&lt;br /&gt;
| 92 || 512,733&lt;br /&gt;
|-&lt;br /&gt;
| 93 || 615,279&lt;br /&gt;
|-&lt;br /&gt;
| 94 || 738,335&lt;br /&gt;
|-&lt;br /&gt;
| 95 || 886,002&lt;br /&gt;
|-&lt;br /&gt;
| 96 || 1,063,203&lt;br /&gt;
|-&lt;br /&gt;
| 97 || 1,275,843&lt;br /&gt;
|-&lt;br /&gt;
| 98 || 1,531,012&lt;br /&gt;
|-&lt;br /&gt;
| 99 || 1,837,214&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* Each player&#039;s value is calculated and updated at the start of each season.&lt;br /&gt;
&lt;br /&gt;
It uses the formula below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AmountT players_value = wage * multiplier;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where &#039;&#039;multiplier&#039;&#039; is set to be 75.  &lt;br /&gt;
So the value of a player is 75 weeks of his wages.&lt;br /&gt;
&lt;br /&gt;
If the player is over 22 years old, then for each year of his age he loses 10% of his value compared to the previous year.&lt;br /&gt;
&lt;br /&gt;
This stops when a player reaches 40 years of age, then players aged 40 and above are all valued the same as a 40 year old player.  &lt;br /&gt;
See the formula below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if(players_age &amp;gt; 22)&lt;br /&gt;
{&lt;br /&gt;
    if(players_age &amp;gt; 40)&lt;br /&gt;
        players_age = 40;&lt;br /&gt;
  &lt;br /&gt;
    for(int ic1 = 23; ic1 &amp;lt;= (players_age); ic1++)&lt;br /&gt;
    {&lt;br /&gt;
        players_value = (players_value * 9) / 10;&lt;br /&gt;
    }             &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Players&#039; fitness is reset to be between 85–100, using the formula below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
const int fitness = 85 + rand_get_mod(15);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Creating all the competitions==&lt;br /&gt;
&lt;br /&gt;
The competitions are created for the domestic, continental and world tournaments.&lt;br /&gt;
&lt;br /&gt;
Each country has a domestic cup and every club in the country is put into the cup. For the first round it is possible that the number of teams in the cup are not a power of 2, which means some clubs will not have an opponent and will need a bye to the next round.  &lt;br /&gt;
See the formula below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int num_dummy_teams = 0;&lt;br /&gt;
if (round == 1)&lt;br /&gt;
{&lt;br /&gt;
    const int num_teams_needed = (1 &amp;lt;&amp;lt; num_rounds);&lt;br /&gt;
    num_dummy_teams = num_teams_needed - num_teams;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The leagues are created and the correct teams are put into them for each domestic league and the continental group stages.&lt;br /&gt;
&lt;br /&gt;
If it is the first season then the clubs that go into all the domestic leagues, continental groups and the world club cup are pre‑defined and provided in a data file.&lt;br /&gt;
&lt;br /&gt;
If it is not the first season then the clubs that go into the domestic leagues are based upon the previous seasons with any promotion and relegations factored in.&lt;br /&gt;
&lt;br /&gt;
The continental groups will have the winners of all the previous season&#039;s domestic leagues put into the group stage. One spot is allocated for each country apart from ENG, GER, ESP, RUS, JPN and SK who each get 2 spots.&lt;br /&gt;
&lt;br /&gt;
The world club cup will have the winners of the previous season&#039;s four continental competitions placed in it.&lt;br /&gt;
&lt;br /&gt;
==Setup the Economies for the Domestic Leagues and the Continental Competitions==&lt;br /&gt;
&lt;br /&gt;
The average league attendance for each league and the average player rating of the clubs in the league are both stored.  &lt;br /&gt;
See the formula below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int ave_league_attendance;&lt;br /&gt;
int ave_club_rating_start;&lt;br /&gt;
&lt;br /&gt;
const int ave_league_attendance = league_attendance / num_teams;&lt;br /&gt;
const int ave_club_rating_start = league_rating / num_teams;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These values are immutable and all future seasons use the same values.&lt;br /&gt;
&lt;br /&gt;
At the start of the first season, each club starts off with a balance that would be enough to pay half a season&#039;s worth of its wages.  &lt;br /&gt;
See the formula below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int num_gameweek_wages_for_club_balance = (num_rounds * 5000 / 10000;&lt;br /&gt;
AmountT start_balance = club_wages * num_gameweek_wages_for_club_balance;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When the first season is created, the following values are calculated for each domestic league and continental competition: ticket cost, TV money and prize money pot. As below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AmountT ticket_cost;&lt;br /&gt;
AmountT tv_money;&lt;br /&gt;
AmountT prize_money_pot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These values are immutable and all future seasons use the same values.&lt;br /&gt;
&lt;br /&gt;
A season&#039;s worth of income for each domestic league is calculated by adding up a season&#039;s worth of outgoings for all the clubs in the league, which is the league&#039;s wage bill.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
league_wages += (league_wages * 500) / 10000;   //inflation rate&lt;br /&gt;
&lt;br /&gt;
AmountT weekly_ticket_pot = (league_wages * gate_reciepts_percentage) / 10000;&lt;br /&gt;
AmountT weekly_tv_pot = (league_wages * tv_percentage) / 10000;&lt;br /&gt;
int weekly_tickets_sold = league_attendance / 2; //halve games played at home&lt;br /&gt;
&lt;br /&gt;
const AmountT ticket_price = weekly_ticket_pot / weekly_tickets_sold;&lt;br /&gt;
const AmountT weekly_tv_money = weekly_tv_pot / num_teams;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The income is set to match the outgoings so that by the end of the season if all the clubs&#039; balances were added up, it would be around the same as at the start of a season (assuming no transfers had taken place).&lt;br /&gt;
&lt;br /&gt;
A 5% inflation rate is added to the income so that there is a little extra money for each of the clubs.&lt;br /&gt;
&lt;br /&gt;
The income is split 50/50 between TV revenue and Gate receipts (which is further split into sponsorship, merchandise). The ticket price for the league is calculated based on the number of fans expected to attend all the matches in a season.&lt;br /&gt;
&lt;br /&gt;
The prize money pot for the league, which is distributed at the end of the season, is calculated by taking 12% of a season&#039;s worth of the league&#039;s wages.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int num_gameweek_wages_for_prize_pot = (num_rounds * 1200) / 10000;    &lt;br /&gt;
AmountT season_prize_money_pot = league_wages * num_gameweek_wages_for_prize_pot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the continental competitions, the same income calculation is done for each of the group stage leagues. However, the group with the highest TV Revenue, Ticket Price and Prize Money Pot within a continent is then chosen to be used for all the other groups too.&lt;br /&gt;
&lt;br /&gt;
As previously mentioned, these values are all permanently stored and used for all the future seasons. This means that the season&#039;s income is always the same for each league and anchored around how the leagues&#039; outgoings were (its wage bill) at the start of the game.&lt;br /&gt;
&lt;br /&gt;
==Schedules==&lt;br /&gt;
&lt;br /&gt;
The schedule for the game world as a whole will have 45 gameweeks, each game week falling on Saturdays and Wednesdays.&lt;br /&gt;
&lt;br /&gt;
All leagues play their first game at the same time and their last game at the same date. As leagues all have a different number of clubs in them, they also have different numbers of fixtures during a season. Some leagues will have a few Wednesdays off, to spread the matches evenly.&lt;br /&gt;
&lt;br /&gt;
Some gameweeks will have more than one match played in them as there could be cup games, either domestic, continental or world cup on a Monday.&lt;br /&gt;
&lt;br /&gt;
The schedule can be seen here:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Week !! Date !! Weekday !! Competition !! Match Day !! &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || 15.07.2024 || Monday || &#039;&#039;&#039;BREAK&#039;&#039;&#039; ||  || bye round in code&lt;br /&gt;
|-&lt;br /&gt;
|  || 17.07.2024 || Wednesday || &#039;&#039;&#039;BREAK&#039;&#039;&#039; ||  || bye round in code&lt;br /&gt;
|-&lt;br /&gt;
|  || 20.07.2024 || Saturday || League || 1 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || 22.07.2024 || Monday || Continental 1 ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 24.07.2024 || Wednesday || League || 2 || &lt;br /&gt;
|-&lt;br /&gt;
|  || 27.07.2024 || Saturday || League || 3 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || 29.07.2024 || Monday || Continental 2 ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 31.07.2024 || Wednesday || League || 4 || bye round league&lt;br /&gt;
|-&lt;br /&gt;
|  || 03.08.2024 || Saturday || League || 5 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || 05.08.2024 || Monday || Cup1 ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 07.08.2024 || Wednesday || League || 6 || bye round league&lt;br /&gt;
|-&lt;br /&gt;
|  || 10.08.2024 || Saturday || League || 7 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || 12.08.2024 || Monday || Continental 3 ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 14.08.2024 || Wednesday || League || 8 || bye round league&lt;br /&gt;
|-&lt;br /&gt;
|  || 17.08.2024 || Saturday || League || 9 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || 19.08.2024 || Monday || Continental 4 ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 21.08.2024 || Wednesday || League || 10 || bye round league&lt;br /&gt;
|-&lt;br /&gt;
|  || 24.08.2024 || Saturday || League || 11 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || 26.08.2024 || Monday || Continental 5 ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 28.08.2024 || Wednesday || League || 12 || bye round league&lt;br /&gt;
|-&lt;br /&gt;
|  || 31.08.2024 || Saturday || League || 13 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || 02.09.2024 || Monday || Cup2 ||  || bye round cup&lt;br /&gt;
|-&lt;br /&gt;
|  || 04.09.2024 || Wednesday || League || 14 || bye round league&lt;br /&gt;
|-&lt;br /&gt;
|  || 07.09.2024 || Saturday || League || 15 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || 09.09.2024 || Monday || Continental 6 ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 11.09.2024 || Wednesday || League || 16 || bye round league&lt;br /&gt;
|-&lt;br /&gt;
|  || 14.09.2024 || Saturday || League || 17 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || 16.09.2024 || Monday || Continental 7 ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 18.09.2024 || Wednesday || League || 18 || bye round league&lt;br /&gt;
|-&lt;br /&gt;
|  || 21.09.2024 || Saturday || League || 19 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || 23.09.2024 || Monday || Cup3 ||  || bye round cup&lt;br /&gt;
|-&lt;br /&gt;
|  || 25.09.2024 || Wednesday || League || 20 || &lt;br /&gt;
|-&lt;br /&gt;
|  || 28.09.2024 || Saturday || League || 21 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || 30.09.2024 || Monday || Continental 8 ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 02.10.2024 || Wednesday || League || 22 || bye round league&lt;br /&gt;
|-&lt;br /&gt;
|  || 05.10.2024 || Saturday || League || 23 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || 07.10.2024 || Monday || Cup4 ||  || bye round cup&lt;br /&gt;
|-&lt;br /&gt;
|  || 09.10.2024 || Wednesday || League || 24 || &lt;br /&gt;
|-&lt;br /&gt;
|  || 12.10.2024 || Saturday || League || 25 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || 14.10.2024 || Monday || Continental 9 ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 16.10.2024 || Wednesday || League || 26 || bye round league&lt;br /&gt;
|-&lt;br /&gt;
|  || 19.10.2024 || Saturday || League || 27 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || 21.10.2024 || Monday || Cup5 ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 23.10.2024 || Wednesday || League || 28 || &lt;br /&gt;
|-&lt;br /&gt;
|  || 26.10.2024 || Saturday || League || 29 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || 28.10.2024 || Monday || Continental 10 ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 30.10.2024 || Wednesday || League || 30 || bye round league&lt;br /&gt;
|-&lt;br /&gt;
|  || 02.11.2024 || Saturday || League || 31 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || 04.11.2024 || Monday || Cup6 ||  || bye round cup&lt;br /&gt;
|-&lt;br /&gt;
|  || 06.11.2024 || Wednesday || League || 32 || &lt;br /&gt;
|-&lt;br /&gt;
|  || 09.11.2024 || Saturday || League || 33 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || 11.11.2024 || Monday || Club World 1 ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 13.11.2024 || Wednesday || Club World 2 ||  || bye round league&lt;br /&gt;
|-&lt;br /&gt;
|  || 16.11.2024 || Saturday || League || 34 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || 18.11.2024 || Monday || Cup7 ||  || bye round cup&lt;br /&gt;
|-&lt;br /&gt;
|  || 20.11.2024 || Wednesday || League || 35 || &lt;br /&gt;
|-&lt;br /&gt;
|  || 23.11.2024 || Saturday || League || 36 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || 25.11.2024 || Monday || Continental 1/16 ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 27.10.2024 || Wednesday || League || 37 || &lt;br /&gt;
|-&lt;br /&gt;
|  || 30.11.2024 || Saturday || League || 38 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21&#039;&#039;&#039; || 02.12.2024 || Monday || Cup8 ||  || bye round cup&lt;br /&gt;
|-&lt;br /&gt;
|  || 04.12.2024 || Wednesday || League || 39 || &lt;br /&gt;
|-&lt;br /&gt;
|  || 07.12.2024 || Saturday || League || 40 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;22&#039;&#039;&#039; || 09.12.2024 || Monday || Continental QF ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 11.12.2024 || Wednesday || League || 41 || &lt;br /&gt;
|-&lt;br /&gt;
|  || 14.12.2024 || Saturday || League || 42 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || 16.12.2024 || Monday || Continental SF ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 18.12.2024 || Wednesday || League || 43 || &lt;br /&gt;
|-&lt;br /&gt;
|  || 21.12.2024 || Saturday || League || 44 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24&#039;&#039;&#039; || 23.12.2024 || Monday || Cup9 ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 25.12.2024 || Wednesday || League || 45 || &lt;br /&gt;
|-&lt;br /&gt;
|  || 28.12.2024 || Saturday || Continental F ||  || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || 30.12.2024 || Monday || &#039;&#039;&#039;BREAK&#039;&#039;&#039; ||  || bye round in code&lt;br /&gt;
|-&lt;br /&gt;
|  || 01.01.2025 || Wednesday || &#039;&#039;&#039;BREAK&#039;&#039;&#039; ||  || bye round in code&lt;br /&gt;
|-&lt;br /&gt;
|  || 04.01.2025 || Saturday || &#039;&#039;&#039;BREAK&#039;&#039;&#039; ||  || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1/26&#039;&#039;&#039; || 06.01.2025 || Monday || &#039;&#039;&#039;BREAK&#039;&#039;&#039; ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 08.01.2025 || Wednesday || &#039;&#039;&#039;BREAK&#039;&#039;&#039; ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 11.01.2025 || Saturday || League || 1 || &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each season will start on either the second Saturday of January or the second Saturday of July:  &lt;br /&gt;
See the dates for the first 10 seasons:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Season 1:  &lt;br /&gt;
    start: 2025-1-11 0:0:0 (1736553600)  &lt;br /&gt;
    end:   2025-7-12 0:0:0 (1752278400)  &lt;br /&gt;
    first turn: 2025-1-18 6:0:0 (1737180000)  &lt;br /&gt;
    last turn:  2025-6-29 0:0:0 (1751155200)  &lt;br /&gt;
Season 2:  &lt;br /&gt;
    start: 2025-7-12 0:0:0 (1752278400)  &lt;br /&gt;
    end:   2026-1-10 0:0:0 (1768003200)  &lt;br /&gt;
    first turn: 2025-7-19 6:0:0 (1752904800)  &lt;br /&gt;
    last turn:  2025-12-28 0:0:0 (1766880000)  &lt;br /&gt;
Season 3:  &lt;br /&gt;
    start: 2026-1-10 0:0:0 (1768003200)  &lt;br /&gt;
    end:   2026-7-11 0:0:0 (1783728000)  &lt;br /&gt;
    first turn: 2026-1-17 6:0:0 (1768629600)  &lt;br /&gt;
    last turn:  2026-6-28 0:0:0 (1782604800)  &lt;br /&gt;
Season 4:  &lt;br /&gt;
    start: 2026-7-11 0:0:0 (1783728000)  &lt;br /&gt;
    end:   2027-1-9 0:0:0 (1799452800)  &lt;br /&gt;
    first turn: 2026-7-18 6:0:0 (1784354400)  &lt;br /&gt;
    last turn:  2026-12-27 0:0:0 (1798329600)  &lt;br /&gt;
Season 5:  &lt;br /&gt;
    start: 2027-1-9 0:0:0 (1799452800)  &lt;br /&gt;
    end:   2027-7-10 0:0:0 (1815177600)  &lt;br /&gt;
    first turn: 2027-1-16 6:0:0 (1800079200)  &lt;br /&gt;
    last turn:  2027-6-27 0:0:0 (1814054400)  &lt;br /&gt;
Season 6:  &lt;br /&gt;
    start: 2027-7-10 0:0:0 (1815177600)  &lt;br /&gt;
    end:   2028-1-8 0:0:0 (1830902400)  &lt;br /&gt;
    first turn: 2027-7-17 6:0:0 (1815804000)  &lt;br /&gt;
    last turn:  2027-12-26 0:0:0 (1829779200)  &lt;br /&gt;
Season 7:  &lt;br /&gt;
    start: 2028-1-8 0:0:0 (1830902400)  &lt;br /&gt;
    end:   2028-7-8 0:0:0 (1846627200)  &lt;br /&gt;
    first turn: 2028-1-15 6:0:0 (1831528800)  &lt;br /&gt;
    last turn:  2028-6-25 0:0:0 (1845504000)  &lt;br /&gt;
Season 8:  &lt;br /&gt;
    start: 2028-7-8 0:0:0 (1846627200)  &lt;br /&gt;
    end:   2029-1-6 0:0:0 (1862352000)  &lt;br /&gt;
    first turn: 2028-7-15 6:0:0 (1847253600)  &lt;br /&gt;
    last turn:  2028-12-24 0:0:0 (1861228800)  &lt;br /&gt;
Season 9:  &lt;br /&gt;
    start: 2029-1-6 0:0:0 (1862352000)  &lt;br /&gt;
    end:   2029-7-7 0:0:0 (1878076800)  &lt;br /&gt;
    first turn: 2029-1-13 6:0:0 (1862978400)  &lt;br /&gt;
    last turn:  2029-6-24 0:0:0 (1876953600)  &lt;br /&gt;
Season 10:  &lt;br /&gt;
    start: 2029-7-7 0:0:0 (1878076800)  &lt;br /&gt;
    end:   2030-1-5 0:0:0 (1893801600)  &lt;br /&gt;
    first turn: 2029-7-14 6:0:0 (1878703200)  &lt;br /&gt;
    last turn:  2029-12-23 0:0:0 (1892678400)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Stadium Building and Fanbase Changes==&lt;br /&gt;
&lt;br /&gt;
Under certain circumstances the stadiums will auto build a little bit at the start of each season, aiming to have a stadium capacity target of either the club&#039;s fanbase + 30% or the average attendance of the league + 30%, whichever is smaller.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int target_attendance;&lt;br /&gt;
if (ave_attendance &amp;lt; fans_current)&lt;br /&gt;
    target_attendance = (ave_attendance * 130) / 100;&lt;br /&gt;
else&lt;br /&gt;
    target_attendance = (fans_current * 130) / 100;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the current size of the stadium is smaller than the target attendance then seat capacity will be added somewhere between the current size and the target. Note, this will not happen if the number of new seats to be added is less than 200.  &lt;br /&gt;
See the formula below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int new_size = stadium_size_current;&lt;br /&gt;
int increase = 0;&lt;br /&gt;
&lt;br /&gt;
if (stadium_size_current &amp;lt; target_attendance)&lt;br /&gt;
{&lt;br /&gt;
    const int max_inc = target_attendance - stadium_size_current;&lt;br /&gt;
    const int min_inc = max_inc / 2;&lt;br /&gt;
&lt;br /&gt;
    increase = min_inc + rand_get_mod(max_inc - min_inc);&lt;br /&gt;
&lt;br /&gt;
    if (increase &amp;gt; 200)&lt;br /&gt;
    {&lt;br /&gt;
        new_size = stadium_size_current + increase;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example:  &lt;br /&gt;
This means that all clubs in the lower leagues have the potential to have a stadium size sufficient enough to hold the average number of fans in the top league + 30%, if they got into that league and stayed in there, allowing them to compete on a more even basis.&lt;br /&gt;
&lt;br /&gt;
Under certain circumstances, at the start of each season, the fan base can rise and fall depending on if the club has been promoted or relegated.&lt;br /&gt;
&lt;br /&gt;
If the club is currently in the division that it started in then its fanbase can rise, tending towards either the league&#039;s average attendance or the fanbase it started the game with, whichever is greater.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if (club_division == division_start)&lt;br /&gt;
{&lt;br /&gt;
    //move to league average or start fanbase (whichever is bigger)&lt;br /&gt;
&lt;br /&gt;
    if (fans_start &amp;gt; ave_attendance)&lt;br /&gt;
        target_fanbase = fans_start;&lt;br /&gt;
    else&lt;br /&gt;
        target_fanbase = ave_attendance;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the club is not in the division that it started in, then it has either been promoted or relegated and its target fanbase will change accordingly.  &lt;br /&gt;
See the formula below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
else  //In non-starting league&lt;br /&gt;
{&lt;br /&gt;
    if (fans_start &amp;gt; ave_attendance)&lt;br /&gt;
        target_fanbase = fans_start - (fans_start - ave_attendance) / 2;&lt;br /&gt;
    else&lt;br /&gt;
        target_fanbase = ave_attendance;&lt;br /&gt;
&lt;br /&gt;
    if (club_division &amp;gt; division_start)&lt;br /&gt;
    {&lt;br /&gt;
        //got relegated&lt;br /&gt;
    }&lt;br /&gt;
    else if (club_division &amp;lt; division_start)&lt;br /&gt;
    {&lt;br /&gt;
        if (target_fanbase &amp;lt; fans_start)&lt;br /&gt;
            target_fanbase = fans_start;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each season the fan base will tend from its current fan base towards its target by 50%.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int new_attendance = fans_current;&lt;br /&gt;
if (fans_current &amp;gt; target_fanbase)  //shrink it&lt;br /&gt;
    new_attendance = fans_current - (fans_current - target_fanbase) / 2;&lt;br /&gt;
if (fans_current &amp;lt; target_fanbase)  //grow it&lt;br /&gt;
    new_attendance = fans_current + (target_fanbase - fans_current) / 2;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example:  &lt;br /&gt;
If a club had a fanbase of 1000 and got promoted, its fanbase would slowly rise each season until it was at the average fanbase of the league that it is now in. An English division 10 club with a 1000 fanbase could eventually have a fanbase of over 35,000 if it got into and stayed in the English division 1.&lt;br /&gt;
&lt;br /&gt;
As mentioned before, the stadium would also gradually increase its capacity, alongside the fanbase.&lt;br /&gt;
&lt;br /&gt;
==Fitness==&lt;br /&gt;
&lt;br /&gt;
On each matchday, fitness is reduced for each player during the match.&lt;br /&gt;
&lt;br /&gt;
It uses the formula below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
reduce_level = (1 * time_played) / 15;&lt;br /&gt;
new_fitness = start_fitness - reduce_level - rand_get_mod(6);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Basically if he played 90 minutes he would lose (randomly) between 24 and 29 fitness points, which is on average 26/27 a match.  &lt;br /&gt;
Of course if he played less, say 45 minutes, then he would lose half of that, on average.&lt;br /&gt;
&lt;br /&gt;
Then each day at 3am UTC time, fitness increases with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
new_fitness = fitness + 5 + rand_get_mod(5);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So it goes up between 5 and 9 points each day, which is on average 7 a day.&lt;br /&gt;
&lt;br /&gt;
As an example:  &lt;br /&gt;
If a player&#039;s fitness was 100% and he played two league games a week, say Saturday and Wednesday, he would go down 53 points on average (e.g. 26+27) and up 49 a week on average (e.g. plus 7 for 7 days).&lt;br /&gt;
&lt;br /&gt;
Gradually over a season the player will reduce and will need to be rotated. If the club plays in cup games too then they will reduce even faster, so squad rotation is even more important if the club is also aiming to win cups.&lt;br /&gt;
&lt;br /&gt;
Note: A player&#039;s fitness will increase more slowly if he is injured but back in the next two weeks.  &lt;br /&gt;
See below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if (injured &amp;gt; timestamp)&lt;br /&gt;
{&lt;br /&gt;
    fitness += 3 + rand_get_mod(5);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the player is injured for two weeks or more then his fitness will not increase.&lt;br /&gt;
&lt;br /&gt;
==Transfers - Unmanaged Club==&lt;br /&gt;
&lt;br /&gt;
There is logic that runs each day that allows unmanaged clubs to join in the transfer market. &lt;br /&gt;
* Each unmanaged club will have an attempt to either buy or sell 6 times, distributed over a season&lt;br /&gt;
* A club will not make an attempt if it is managed or used its seasons in/out limits&lt;br /&gt;
* The 6 attempts are configurable in a parameter and can even be turned off by setting it at 0.&lt;br /&gt;
		&lt;br /&gt;
&lt;br /&gt;
First, find what the target average rating is that we want a club’s starting 11 players to be (‘target rating’).&lt;br /&gt;
&lt;br /&gt;
This could either be the value that the club started at or the average of the division the club is currently in.  If the club is currently in the division it started in then we use the former, otherwise we use the latter.&lt;br /&gt;
&lt;br /&gt;
Note: This works the same as the target ‘fan base’ used for attendance as clubs are promoted and relegated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Buy Decision===&lt;br /&gt;
&lt;br /&gt;
Find what player position is the most required for the club.&lt;br /&gt;
* prioritise position if below any min position thresholds&lt;br /&gt;
* then prioritise position if below any ideal position thresholds&lt;br /&gt;
* otherwise go for any position other than another GK&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
- is the club&#039;s current average rating less than the ‘target rating’?&lt;br /&gt;
YES&lt;br /&gt;
   bid for player, (‘target rating’ to ‘target rating + 5’), (age 23+)&lt;br /&gt;
&lt;br /&gt;
- has there been a player bid yet?&lt;br /&gt;
NO&lt;br /&gt;
   - is the squad small / below min position limits?&lt;br /&gt;
   YES&lt;br /&gt;
      bid for squad player in required positions (‘target rating’ to ‘target rating - 5’)  (any age)&lt;br /&gt;
   NO&lt;br /&gt;
      bid for squad player in required positions (‘target rating’ to ‘target rating - 5’)  (age &amp;lt; 23) - since the squad is not small we can go for a youth player&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: All bids need to meet the following before being placed:&lt;br /&gt;
* A suitable player is on the market&lt;br /&gt;
* The club has funds to make a bid&lt;br /&gt;
* The clubs squad is not full&lt;br /&gt;
* The club has no current outstanding bids&lt;br /&gt;
* The chosen player has been on the market for at least 1 day  (not implemented)&lt;br /&gt;
&lt;br /&gt;
===Sell Decision===&lt;br /&gt;
&lt;br /&gt;
Find what player positions are above the ideal size for each position then prioritise this position if above any ideal position thresholds&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
- is the club&#039;s current average rating above the ‘target rating’?&lt;br /&gt;
YES&lt;br /&gt;
   List a player, (‘target rating’ to ‘target rating + 5’), (age 23+)&lt;br /&gt;
&lt;br /&gt;
- has there been a player listed yet?&lt;br /&gt;
NO&lt;br /&gt;
   - is the squad large / above all the ideal position thresholds?&lt;br /&gt;
   YES&lt;br /&gt;
      List a squad player from a chosen position (‘target rating’ to ‘target rating - 5’)  (any age)&lt;br /&gt;
   NO&lt;br /&gt;
      List a squad player from a chosen position (‘target rating’ to ‘target rating - 5’)  (age 30+) - since the squad is not large we can go for an older&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: All transfer listings need to meet the following before being placed:&lt;br /&gt;
* The clubs squad is not below the minimum allowed squad size&lt;br /&gt;
* The club has not currently listed any players for sale&lt;br /&gt;
&lt;br /&gt;
==Matchday==&lt;br /&gt;
&lt;br /&gt;
All the fixtures that have not yet played are identified and prepared for processing their matchdays.&lt;br /&gt;
&lt;br /&gt;
For each fixture, the tactics and teamsheets for both teams are processed and validated before the match.&lt;br /&gt;
&lt;br /&gt;
If any player is unhappy then they lose 10% of their rating and if a player is injured or banned then he is considered to be a &amp;quot;dud player&amp;quot; and will not take part in the match.&lt;br /&gt;
&lt;br /&gt;
If the match is a continental competition then the ticket price and TV revenue numbers that are specific to that competition are used. Domestic cups use the ticket price and TV revenue numbers that the home team uses for its domestic league games. Each domestic league has its own ticket price and TV revenue that all clubs in that league use.&lt;br /&gt;
&lt;br /&gt;
==Attendance==&lt;br /&gt;
&lt;br /&gt;
The number of fans that turn up for matches are as follows:&lt;br /&gt;
&lt;br /&gt;
Domestic league and cup games will use the home club&#039;s fanbase, assuming they fit into the home club&#039;s stadium, as the number of fans that will turn up on matchday.&lt;br /&gt;
&lt;br /&gt;
The fanbase does not grow or shrink if you win or lose games; however, after the sixth domestic league game in the season, the attendance for domestic games can increase by up to 30% from its fanbase depending on how high in the table the club is above the middle of the table, and up to 30% less depending on how low the club is from the middle of the table.  &lt;br /&gt;
See the formula below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//change the attendance based on the club&#039;s domestic league position&lt;br /&gt;
if (games_played &amp;gt; 6)&lt;br /&gt;
{&lt;br /&gt;
  int mid_table = num_teams / 2; //Get the league table size and half it.&lt;br /&gt;
&lt;br /&gt;
  //if in top half of table means more fans&lt;br /&gt;
  if (new_position &amp;lt; mid_table)&lt;br /&gt;
  {&lt;br /&gt;
    int units_of_fans = mid_table - new_position;&lt;br /&gt;
    c-&amp;gt;fans = c-&amp;gt;fans + ((c-&amp;gt;fans / 30) * units_of_fans);&lt;br /&gt;
  }&lt;br /&gt;
  else if(new_position &amp;gt; mid_table)  //bottom half of the table means less fans&lt;br /&gt;
  {&lt;br /&gt;
    int units_of_fans = new_position - mid_table;&lt;br /&gt;
    c-&amp;gt;fans = c-&amp;gt;fans - ((c-&amp;gt;fans / 30) * units_of_fans);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If it&#039;s a domestic cup or shield game then they usually get more fans than a league game, so it looks to use either the fan base (with the 30% modifier if applicable) or 75% of the stadium size, whichever is bigger.  &lt;br /&gt;
See the formula below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if((comp_type == COMP_TYPE_NATIONAL_CUP) ||&lt;br /&gt;
   (comp_type == COMP_TYPE_NATIONAL_SHIELD))&lt;br /&gt;
{&lt;br /&gt;
  int minimum_fans = (c-&amp;gt;stadium_size / 4) * 3;&lt;br /&gt;
&lt;br /&gt;
  if (c-&amp;gt;fans &amp;lt; minimum_fans)&lt;br /&gt;
  {&lt;br /&gt;
    c-&amp;gt;fans = minimum_fans - rand_get_mod(100);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Continental and world club cup games almost always have full stadium attendances.&lt;br /&gt;
&lt;br /&gt;
==Tactics Autopick==&lt;br /&gt;
&lt;br /&gt;
If the club has no manager or it has a manager who has submitted invalid tactics, then the autopick will kick in.&lt;br /&gt;
&lt;br /&gt;
Invalid tactics are:&lt;br /&gt;
* Contains at least one player who is injured or match banned.&lt;br /&gt;
* Has no goalkeeper in the goalkeeper position – unless there is a good reason like all the goalkeepers in the squad are injured or banned.&lt;br /&gt;
&lt;br /&gt;
The autopick will randomly choose one of the following formations: 4-4-2, 4-3-3 or 4-5-1 and then find the best possible player for each of the positions in the chosen formation. The player&#039;s fitness will also be taken into consideration when choosing the best players for each position.&lt;br /&gt;
&lt;br /&gt;
==Player Rating Adjustments==&lt;br /&gt;
&lt;br /&gt;
Each player is checked if it is being played in the correct position that it is meant to be played in; for example, a DC in a DC position.&lt;br /&gt;
&lt;br /&gt;
If the player is not in the correct position then he is penalized. The further out of position a player is the more he is penalized. The grid below shows what percentage should be knocked off the player&#039;s goalkeeping, tackling, passing and shooting rating, should he be out of position.  &lt;br /&gt;
See: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
const int g_grid_outta_pos_multi[16][9][7] = {&lt;br /&gt;
{&lt;br /&gt;
    {0, 0, 0, 0, 0, 0, 0}, //G&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40},&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40},&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40},&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40},&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40},&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40},&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40},&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}, //LB&lt;br /&gt;
    {3, 3, 5, 5, 5, 0, 0},&lt;br /&gt;
    {3, 3, 5, 5, 5, 0, 0},&lt;br /&gt;
    {3, 3, 5, 5, 5, 0, 0},&lt;br /&gt;
    {5, 5, 10, 10, 10, 0, 0},&lt;br /&gt;
    {10, 15, 15, 15, 15, 10, 5},&lt;br /&gt;
    {25, 25, 25, 25, 25, 25, 20},&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35}&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}, //CB&lt;br /&gt;
    {5, 0, 0, 0, 0, 0, 5},&lt;br /&gt;
    {5, 0, 0, 0, 0, 0, 5},&lt;br /&gt;
    {10, 10, 5, 5, 5, 10, 10},&lt;br /&gt;
    {10, 10, 5, 5, 5, 10, 10},&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 15},&lt;br /&gt;
    {25, 25, 25, 25, 25, 25, 25},&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35}&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}, //RB&lt;br /&gt;
    {0, 0, 5, 5, 5, 3, 3},&lt;br /&gt;
    {0, 0, 5, 5, 5, 3, 3},&lt;br /&gt;
    {0, 0, 5, 5, 5, 3, 3},&lt;br /&gt;
    {0, 0, 10, 10, 10, 5, 5},&lt;br /&gt;
    {5, 10, 15, 15, 15, 15, 10},&lt;br /&gt;
    {20, 25, 25, 25, 25, 25, 25},&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35}&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}, //DML&lt;br /&gt;
    {10, 10, 15, 15, 15, 5, 5},&lt;br /&gt;
    {10, 10, 15, 15, 15, 5, 5},&lt;br /&gt;
    {2, 2, 2, 2, 1, 0, 0},&lt;br /&gt;
    {2, 2, 2, 2, 1, 0, 0},&lt;br /&gt;
    {3, 3, 3, 3, 2, 0, 0},&lt;br /&gt;
    {15, 15, 15, 15, 10, 5, 5},&lt;br /&gt;
    {25, 25, 25, 25, 25, 25, 25},&lt;br /&gt;
    {25, 25, 25, 25, 25, 25, 25}&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}, //DMC&lt;br /&gt;
    {15, 15, 10, 10, 10, 15, 15},&lt;br /&gt;
    {15, 15, 10, 10, 10, 15, 15},&lt;br /&gt;
    {3, 0, 0, 0, 0, 0, 3},&lt;br /&gt;
    {3, 0, 0, 0, 0, 0, 3},&lt;br /&gt;
    {3, 0, 0, 0, 0, 0, 3},&lt;br /&gt;
    {15, 15, 10, 10, 10, 15, 15},&lt;br /&gt;
    {25, 15, 15, 15, 15, 15, 25},&lt;br /&gt;
    {25, 25, 25, 25, 25, 25, 25}&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}, //DMR&lt;br /&gt;
    {5, 5, 15, 15, 15, 10, 10},&lt;br /&gt;
    {5, 5, 15, 15, 15, 10, 10},&lt;br /&gt;
    {0, 0, 1, 2, 2, 2, 2},&lt;br /&gt;
    {0, 0, 1, 2, 2, 2, 2},&lt;br /&gt;
    {0, 0, 2, 3, 3, 3, 3},&lt;br /&gt;
    {5, 5, 10, 15, 15, 15, 15},&lt;br /&gt;
    {25, 25, 25, 25, 25, 25, 25},&lt;br /&gt;
    {25, 25, 25, 25, 25, 25, 25}&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}, //LM&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 15},&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 15},&lt;br /&gt;
    {5, 5, 5, 5, 4, 0, 0},&lt;br /&gt;
    {3, 3, 3, 3, 2, 0, 0},&lt;br /&gt;
    {1, 1, 1, 1, 1, 0, 0},&lt;br /&gt;
    {3, 3, 3, 3, 2, 0, 0},&lt;br /&gt;
    {10, 10, 10, 10, 10, 10, 10},&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 15}&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}, //CM&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 15},&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 15},&lt;br /&gt;
    {5, 5, 1, 1, 1, 5, 5},&lt;br /&gt;
    {3, 3, 0, 0, 0, 3, 3},&lt;br /&gt;
    {3, 0, 0, 0, 0, 0, 3},&lt;br /&gt;
    {3, 1, 0, 0, 0, 1, 3},&lt;br /&gt;
    {15, 5, 5, 5, 5, 5, 15},&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 15}&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}, //RM&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 15},&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 15},&lt;br /&gt;
    {0, 0, 4, 5, 5, 5, 5},&lt;br /&gt;
    {0, 0, 2, 3, 3, 3, 3},&lt;br /&gt;
    {0, 0, 1, 1, 1, 1, 1},&lt;br /&gt;
    {0, 0, 2, 3, 3, 3, 3},&lt;br /&gt;
    {10, 10, 10, 10, 10, 10, 10},&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 15}&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}, //AML&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {25, 25, 35, 25, 25, 25, 25},&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 10},&lt;br /&gt;
    {5, 5, 5, 5, 5, 0, 0},&lt;br /&gt;
    {5, 5, 3, 3, 1, 0, 0},&lt;br /&gt;
    {5, 5, 3, 3, 1, 0, 0},&lt;br /&gt;
    {10, 10, 10, 10, 5, 3, 3}&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}, //AM&lt;br /&gt;
    {25, 25, 25, 25, 25, 25, 25},&lt;br /&gt;
    {25, 25, 25, 25, 25, 25, 25},&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 15},&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 15},&lt;br /&gt;
    {3, 0, 0, 0, 0, 0, 3},&lt;br /&gt;
    {3, 0, 0, 0, 0, 0, 3},&lt;br /&gt;
    {3, 0, 0, 0, 0, 0, 3},&lt;br /&gt;
    {10, 10, 10, 10, 10, 10, 10}&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}, //AMR&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {25, 25, 35, 25, 25, 25, 25},&lt;br /&gt;
    {10, 15, 15, 15, 15, 15, 15},&lt;br /&gt;
    {0, 0, 5, 5, 5, 5, 5},&lt;br /&gt;
    {0, 0, 1, 3, 3, 5, 5},&lt;br /&gt;
    {0, 0, 1, 3, 3, 5, 5},&lt;br /&gt;
    {3, 3, 5, 10, 10, 10, 10}&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}, //FL&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {25, 25, 25, 25, 25, 25, 25},&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 15},&lt;br /&gt;
    {5, 5, 5, 5, 5, 5, 5},&lt;br /&gt;
    {3, 2, 2, 1, 1, 0, 0},&lt;br /&gt;
    {3, 2, 2, 1, 1, 0, 0}&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}, //FC&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {25, 25, 25, 25, 25, 25, 25},&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 15},&lt;br /&gt;
    {5, 5, 5, 5, 5, 5, 5},&lt;br /&gt;
    {3, 1, 0, 0, 0, 1, 3},&lt;br /&gt;
    {3, 1, 0, 0, 0, 1, 3}&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}, //FR&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {25, 25, 25, 25, 25, 25, 25},&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 15},&lt;br /&gt;
    {5, 5, 5, 5, 5, 5, 5},&lt;br /&gt;
    {0, 0, 1, 1, 2, 3, 3},&lt;br /&gt;
    {0, 0, 1, 1, 2, 3, 3}&lt;br /&gt;
}&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Player ratings are also adjusted when taking into consideration each player&#039;s tempo, tackling style and morale.&lt;br /&gt;
&lt;br /&gt;
The tackling style can be set to be more aggressive, which means they will tackle better but also increase their chances of getting a yellow or red card.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
const int tackling_style_adjuster = 2000;&lt;br /&gt;
&lt;br /&gt;
if(tackling_style == 0)&lt;br /&gt;
{&lt;br /&gt;
    c-&amp;gt;ply[ply_off].rating_aggression = c-&amp;gt;ply[ply_off].rating_aggression - ((c-&amp;gt;ply[ply_off].rating_aggression * tackling_style_adjuster) / 10000);&lt;br /&gt;
    if(c-&amp;gt;ply[ply_off].rating_aggression &amp;lt; 10)&lt;br /&gt;
        c-&amp;gt;ply[ply_off].rating_aggression = 10;&lt;br /&gt;
}&lt;br /&gt;
else if(tackling_style == 2)&lt;br /&gt;
{&lt;br /&gt;
    c-&amp;gt;ply[ply_off].rating_aggression = c-&amp;gt;ply[ply_off].rating_aggression + ((c-&amp;gt;ply[ply_off].rating_aggression * tackling_style_adjuster) / 10000);&lt;br /&gt;
    if(c-&amp;gt;ply[ply_off].rating_aggression &amp;gt; 99)&lt;br /&gt;
        c-&amp;gt;ply[ply_off].rating_aggression = 99;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The tempo sets the player&#039;s rating and stamina. A higher tempo means that the player plays better although his fitness will drop more and faster. A lower tempo does the opposite on the ratings and stamina.&lt;br /&gt;
&lt;br /&gt;
Morale when it is set to &amp;quot;unhappy&amp;quot; will knock 10% off the player&#039;s ratings.&lt;br /&gt;
&lt;br /&gt;
==Match Results==&lt;br /&gt;
&lt;br /&gt;
After the match has been played, certain calculations are made and stored.&lt;br /&gt;
&lt;br /&gt;
Manager (veteran) points are awarded; 3 for a win and 1 for a draw.&lt;br /&gt;
&lt;br /&gt;
===Gate Receipts===&lt;br /&gt;
&lt;br /&gt;
For visual effects, the gate receipts are distributed between gate receipts, sponsorship and merchandise, with the combined total actually going 20% over. This extra 20% is then taken off through ground maintenance.  &lt;br /&gt;
See below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AmountT gate_receipts = (AmountT)((c[0].fans * c[0].ticket_cost) * 0.8);&lt;br /&gt;
const AmountT sponsor = (AmountT)((c[0].fans * c[0].ticket_cost) * 0.3);&lt;br /&gt;
const AmountT merchandise = (AmountT)((c[0].fans * c[0].ticket_cost) * 0.1);&lt;br /&gt;
&lt;br /&gt;
const AmountT ground_maintenance = (AmountT)((c[0].fans * c[0].ticket_cost) * 0.2);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the domestic cup games, continental knockouts and world club cup, the gate receipts are split evenly between the home team and the away team.  &lt;br /&gt;
There is only TV money for the continental knockout games and it is the same amount for both the home and away team.&lt;br /&gt;
&lt;br /&gt;
===Payouts===&lt;br /&gt;
&lt;br /&gt;
Payouts to users are made for the club/player influencers and the manager and agent wages.&lt;br /&gt;
&lt;br /&gt;
If it was a domestic league game then:&lt;br /&gt;
&lt;br /&gt;
* 0.2% of the player&#039;s wage is paid out between its influencers.&lt;br /&gt;
* 0.002% of the player&#039;s wage is paid out to the agent (if the player has one).&lt;br /&gt;
* If the club has a manager that is not locked and is active, then it gets paid a wage of 0.0004% of the club&#039;s TV income.&lt;br /&gt;
* If the club is not in debt before the game then 1% of the club&#039;s income is paid out between its influencers. This comes out of the club&#039;s balance.&lt;br /&gt;
&lt;br /&gt;
If it was a domestic cup, continental game or world club cup then:&lt;br /&gt;
&lt;br /&gt;
* If the club is not in debt before the game then 1% of the club&#039;s income is paid out between its influencers. This comes out of the club&#039;s balance.&lt;br /&gt;
&lt;br /&gt;
====Bonuses====&lt;br /&gt;
&lt;br /&gt;
* If the player starts the match then a starting lineup bonus of 0.05% of the player&#039;s wage is passed onto his influencers. A minimum of 45 minutes need to be played.&lt;br /&gt;
&lt;br /&gt;
* If the player scored then a goal bonus of 0.1% of the player&#039;s wage is passed onto his influencers for each goal scored.&lt;br /&gt;
&lt;br /&gt;
* If the player assists then an assist bonus of 0.1% of the player&#039;s wage is passed onto his influencers for each assist.&lt;br /&gt;
&lt;br /&gt;
* If there was a clean sheet then the players who played in goals and defence who were in the starting eleven get a clean sheet bonus of 0.1% of the player&#039;s wage.  &lt;br /&gt;
The player needs to have played at least 75 minutes of the game.&lt;br /&gt;
&lt;br /&gt;
===Fitness===&lt;br /&gt;
&lt;br /&gt;
Fitness is reduced for all players that played in the match. The more minutes they play the more fitness they lose. Goalkeepers lose a lot less, currently four times less, than outfield players.  &lt;br /&gt;
See below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int reduce_level;&lt;br /&gt;
if (ic2 &amp;gt; 0)&lt;br /&gt;
    reduce_level = (4 * time_played) / 15;&lt;br /&gt;
else&lt;br /&gt;
    reduce_level = (1 * time_played) / 15;&lt;br /&gt;
&lt;br /&gt;
fitness = (fitness &amp;lt; 35 ? 1 : fitness - reduce_level - rand_get_mod(6));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Players can get injured for between 2 and 160 days, although it is weighted with more chance towards the lower end.  &lt;br /&gt;
See below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
injury_days = rand_get_mod( rand_get_mod (rand_get_mod (rand_get_mod (159) + 1) + 1) + 1) + 2;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The more days a player has been injured, the more fitness he will lose.  &lt;br /&gt;
See:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if (injury_days &amp;gt; 120)&lt;br /&gt;
{&lt;br /&gt;
    reduce_level = 40 + rand_get_mod(5);&lt;br /&gt;
}&lt;br /&gt;
else if (injury_days &amp;gt; 80)&lt;br /&gt;
{&lt;br /&gt;
    reduce_level += 30 + rand_get_mod(5);&lt;br /&gt;
}&lt;br /&gt;
else if (injury_days &amp;gt; 40)&lt;br /&gt;
{&lt;br /&gt;
    reduce_level += 10 + rand_get_mod(5);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Cup Final Prize Monday and Payouts==&lt;br /&gt;
&lt;br /&gt;
During the season, cup finals are played for domestic, continental and world tournaments that result in prize money for the clubs and payouts for the influence holders.&lt;br /&gt;
&lt;br /&gt;
* The cup prize pots are calculated at the start of the game by taking the average starting balance of the 10 clubs in the cup that have the biggest starting balance. This value is then used for that cup&#039;s prize pot for all future seasons.&lt;br /&gt;
&lt;br /&gt;
* From the cup prize pot, the club gets 25% if it is the winner and 12.5% if it is the runner up.&lt;br /&gt;
&lt;br /&gt;
* Club influence holders get paid 10% of what a club receives from cup prize money (if any).&lt;br /&gt;
** This 10% is split between all the club influence holders and the more influence a user holds in the club, the bigger portion of the 10% that influencer receives.&lt;br /&gt;
** Note: Some or even all of this will go to the club if the club has a debt&lt;br /&gt;
&lt;br /&gt;
* Each player in the club gets a bonus that equates to 0.1% of a club&#039;s cup prize money&lt;br /&gt;
** The more influence a user holds in the player, the bigger portion of the 0.1% that influence holder will receive.&lt;br /&gt;
** Note: The players rating is further used to determine the payout; e.g. a 50 rated player will get half of that 0,1%&lt;br /&gt;
&lt;br /&gt;
* The manager who wins the cup gets 10 manager points and the manager who is the runner up gets 5 manager points.&lt;br /&gt;
&lt;br /&gt;
==End of Season==&lt;br /&gt;
&lt;br /&gt;
When the last fixture of the season has been played, prize money is paid out to each of the clubs in all of the domestic leagues.&lt;br /&gt;
&lt;br /&gt;
Manager points are awarded; 10 for 1st place in a league and 5 for second place.&lt;br /&gt;
&lt;br /&gt;
50% of the league prize money pot is split equally between the clubs in a linear way with the 1st placed club getting the most and the last placed club getting the least. For example, a league with 20 clubs would have the percentage split as follows: 1st: 9.5%......10th: 5%.......20th: 0.5%.  &lt;br /&gt;
&lt;br /&gt;
See the formula below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
const int equal = 100 / num_teams;&lt;br /&gt;
int percdue = (num_teams - position) * equal;&lt;br /&gt;
int potperc = ((percdue &amp;lt;&amp;lt; 8) / 100) * (2 * equal);&lt;br /&gt;
&lt;br /&gt;
if (potperc == 0)&lt;br /&gt;
{&lt;br /&gt;
    percdue = 100 - (num_teams - 1) * equal;&lt;br /&gt;
    potperc = ((percdue &amp;lt;&amp;lt; 8) / 100) * (2 * equal);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
AmountT prize_money = (potperc / 100) * prize_money_pot;&lt;br /&gt;
&lt;br /&gt;
prize_money = ((prize_money &amp;gt;&amp;gt; 8));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
clubs_amount = (prize_money * 5000) / 10000;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
10% of a club&#039;s league prize money is split between all club influencers, provided the club isn&#039;t in debt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
shareholders_amount = prize_money - clubs_amount;&lt;br /&gt;
shareholders_amount = (shareholders_amount * 1000) / 10000;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
0.1% of a club&#039;s league prize money is for the influencers of each player, discounted with the player&#039;s rating.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
const AmountT the_prize_share = (prize_money * 5) / 10000;   &lt;br /&gt;
AmountT sent_prize_share = (the_prize_share * player_rating) / 100;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The season then remains the current season for a few more days, before a new season is created.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Events Between Seasons===&lt;br /&gt;
&lt;br /&gt;
All the other end of season events (such as contracts, auctioning players) is done only at the point when the new season is created and the old season is replaced by it.&lt;br /&gt;
&lt;br /&gt;
A ProcessSeasonEnd script is run&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   void ProcessSeasonEnd (DbHandleData&amp;amp; db, const IdT seasonId)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Taking each of the events within it in turn:&lt;br /&gt;
&lt;br /&gt;
===Updating the player data===&lt;br /&gt;
&lt;br /&gt;
The players database is updated at the end of each season, just before the new season is created.&lt;br /&gt;
&lt;br /&gt;
New players are added, existing players updated and some players retire.&lt;br /&gt;
&lt;br /&gt;
Adding new players:&lt;br /&gt;
* If a player in real life has been playing for one of the 5350 clubs in Soccerverse, is not yet in the game and the data from the api is correctly updated, then he will get added to the game and to the free bench.&lt;br /&gt;
&lt;br /&gt;
Updating players:&lt;br /&gt;
* Some of the current players will have their rating, position, side and influence price adjusted, all depending on how they have been performing in real life since the last update. Players that didn&#039;t have a date of birth set previously might get it added.&lt;br /&gt;
&lt;br /&gt;
Retiring players:&lt;br /&gt;
* When a player retires he leaves his current club and he goes on the freebench, however, he can not be bought by anyone.&lt;br /&gt;
* All transfer auctions involving the player are cancelled.&lt;br /&gt;
* Users are no longer able to buy influence from the game for this player.  &lt;br /&gt;
* However, users can trade any existing influence in this player between themselves.&lt;br /&gt;
* Since the player can not play for any club, he will not generate any influence payouts.&lt;br /&gt;
&lt;br /&gt;
All players will also have their value (and wage if on the free bench and not on an active contract) recalculated, as they are now a bit older and potentially worth a little less, and also the ratings will have changed.&lt;br /&gt;
&lt;br /&gt;
===Player Contracts===&lt;br /&gt;
&lt;br /&gt;
* Every player who is at a club has his contract reduced by one season.&lt;br /&gt;
* If the contract runs out then the player gets moved to the free bench.&lt;br /&gt;
* However, under certain conditions the contract will get auto-renewed for one season:&lt;br /&gt;
** Players set to &amp;quot;do not renew&amp;quot; by the agent will never be auto-renewed and will definitely leave.&lt;br /&gt;
** If the club is not actively managed or the manager is locked, then all other player contracts are auto-renewed.&lt;br /&gt;
** If the manager is active, up to 2 players may leave, and all others get auto-renewed.&lt;br /&gt;
** Worst players are released first, and only players may leave in whose position the squad has enough other players.&lt;br /&gt;
&lt;br /&gt;
===Clubs in Debt - Auto Auction===&lt;br /&gt;
&lt;br /&gt;
If a club is in debt then it will attempt to sell off the club&#039;s best player not already in an active auction by putting him on the transfer market auction with a minimum bid of 1 SVC.  In the very unlikely event that no player is available (e.g. because all players in the club retired or had their contracts run out) nothing happens.&lt;br /&gt;
&lt;br /&gt;
This auction is started immediately (ending in a week, not started only when a bid is made).  If no bid is made within the week, then the player leaves to the free bench.&lt;br /&gt;
&lt;br /&gt;
There are three reasons for this:&lt;br /&gt;
* It will reduce the club&#039;s wage bill so that its costs are lower in the future.&lt;br /&gt;
* Other clubs may decide to bid and buy the player on the auction system, potentially getting some money into the club.&lt;br /&gt;
* Losing the best player is an incentive to manage the club&#039;s finances properly.&lt;br /&gt;
&lt;br /&gt;
===Fixing Squads===&lt;br /&gt;
&lt;br /&gt;
For all clubs, the overall squad size and structure (minimum players for each position) is fixed.&lt;br /&gt;
&lt;br /&gt;
The minimum parameters can be seen below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
const unsigned MIN_TEAM_SIZE = 21;&lt;br /&gt;
&lt;br /&gt;
const std::map&amp;lt;RequiredSquadPosition, unsigned&amp;gt; MIN_TEAM_PER_POS = {&lt;br /&gt;
  {RequiredSquadPosition::GK, 2},&lt;br /&gt;
  {RequiredSquadPosition::DEFENDER, 5},&lt;br /&gt;
  {RequiredSquadPosition::MIDFIELD, 5},&lt;br /&gt;
  {RequiredSquadPosition::ATTACKER, 3},&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The worst players on the freebench are chosen as long as no other club are bidding for them.  They are transferred for free to the club.&lt;br /&gt;
&lt;br /&gt;
===Players wages and values===&lt;br /&gt;
&lt;br /&gt;
* The values for all players are recalculated, based on possible rating changes and their changes in age for the current season.&lt;br /&gt;
* The wages for all players on the free bench are calculated.  &lt;br /&gt;
&lt;br /&gt;
(Players at a club have their wages fixed until a new contract gets signed.)&lt;br /&gt;
&lt;br /&gt;
===Club Dilution Events (Cash Injection)===&lt;br /&gt;
&lt;br /&gt;
Club dilutions are implemented but not active yet in the code!  This is how they will work once activated:&lt;br /&gt;
&lt;br /&gt;
* When a club is in debt at a season end a dilution event to raise SVC for the club is started immediately.  &lt;br /&gt;
* When not in debt, a dilution proposal is created, and club influence holders can vote it down.  This ensures that lost wallet keys won&#039;t make clubs permanently lost.&lt;br /&gt;
* The amount of new influence to be created in an event or proposal is 5%&lt;br /&gt;
* The amount of SVC raised is whatever users of the game bid for that 5% (put into the dilution pool).  For these end-of-season dilutions, there is no minimum raise specified.  It could be that one user gets all the 5% for just 1 SVC, but market forces will prevent that (and ensure a &amp;quot;fair value&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
===A new season is created.===&lt;/div&gt;</summary>
		<author><name>Tyki</name></author>
	</entry>
	<entry>
		<id>https://wiki.soccerverse.com/index.php?title=Backend_Game_Logic&amp;diff=65</id>
		<title>Backend Game Logic</title>
		<link rel="alternate" type="text/html" href="https://wiki.soccerverse.com/index.php?title=Backend_Game_Logic&amp;diff=65"/>
		<updated>2025-03-24T22:47:56Z</updated>

		<summary type="html">&lt;p&gt;Tyki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki walks through all of the backend game logic (GSP), starting at the game world&#039;s creation and the creation of its first season, all the way through a season&#039;s worth of fixtures, the end of season event and then the creation of a new season.&lt;br /&gt;
&lt;br /&gt;
The match day process flow of pre‑match, match and post match is walked through as well as the daily player fitness increases.&lt;br /&gt;
&lt;br /&gt;
Some source code snippets are provided in certain places to help explain the formulas that are used.&lt;br /&gt;
&lt;br /&gt;
==When the game world is created==&lt;br /&gt;
&lt;br /&gt;
For each club, the average rating of the best 11 players is calculated and stored.  &lt;br /&gt;
This value is immutable and later used for things such as calculating the average player rating of the league, which is also immutable.&lt;br /&gt;
&lt;br /&gt;
It&#039;s stored as:&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;clubs.rating_start&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Then the first season is created.&lt;br /&gt;
&lt;br /&gt;
==Creating a new season==&lt;br /&gt;
&lt;br /&gt;
* Each club&#039;s transfer limits are reset for transfer in and transfer out.&lt;br /&gt;
* Each club&#039;s form is reset.&lt;br /&gt;
* Players&#039; form, yellow cards, red cards, yellow/red cards, banned and stamina are all reset.&lt;br /&gt;
* A player&#039;s wage for the season is calculated based on his current rating.  &lt;br /&gt;
If the player rating is below 60 then the wage is calculated using the formula below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if (rating &amp;lt; 60)&lt;br /&gt;
    return (5 * rating) * moneybase_multiplier;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where &#039;&#039;moneybase_multiplier&#039;&#039; is set to be 50,000 when the game world is created.&lt;br /&gt;
&lt;br /&gt;
If the player value is 60 rated or above then it uses the formula below, basically starting at 1500 then increasing by 20% more than the previous rating.  &lt;br /&gt;
It uses the formula below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AmountT wage = 300;&lt;br /&gt;
&lt;br /&gt;
for(int ic1 = 1; ic1 &amp;lt;= (rating-60); ic1++)&lt;br /&gt;
{&lt;br /&gt;
    wage = ((wage * 12 ) / 10);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
return wage * moneybase_multiplier;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A grid of all the wages to ratings can be seen in the table below:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Rating !! Wage&lt;br /&gt;
|-&lt;br /&gt;
| 50 || 1,250&lt;br /&gt;
|-&lt;br /&gt;
| 51 || 1,275&lt;br /&gt;
|-&lt;br /&gt;
| 52 || 1,300&lt;br /&gt;
|-&lt;br /&gt;
| 53 || 1,325&lt;br /&gt;
|-&lt;br /&gt;
| 54 || 1,350&lt;br /&gt;
|-&lt;br /&gt;
| 55 || 1,375&lt;br /&gt;
|-&lt;br /&gt;
| 56 || 1,400&lt;br /&gt;
|-&lt;br /&gt;
| 57 || 1,425&lt;br /&gt;
|-&lt;br /&gt;
| 58 || 1,450&lt;br /&gt;
|-&lt;br /&gt;
| 59 || 1,475&lt;br /&gt;
|-&lt;br /&gt;
| 60 || 1,500&lt;br /&gt;
|-&lt;br /&gt;
| 61 || 1,800&lt;br /&gt;
|-&lt;br /&gt;
| 62 || 2,160&lt;br /&gt;
|-&lt;br /&gt;
| 63 || 2,592&lt;br /&gt;
|-&lt;br /&gt;
| 64 || 3,110&lt;br /&gt;
|-&lt;br /&gt;
| 65 || 3,732&lt;br /&gt;
|-&lt;br /&gt;
| 66 || 4,479&lt;br /&gt;
|-&lt;br /&gt;
| 67 || 5,375&lt;br /&gt;
|-&lt;br /&gt;
| 68 || 6,450&lt;br /&gt;
|-&lt;br /&gt;
| 69 || 7,740&lt;br /&gt;
|-&lt;br /&gt;
| 70 || 9,288&lt;br /&gt;
|-&lt;br /&gt;
| 71 || 11,145&lt;br /&gt;
|-&lt;br /&gt;
| 72 || 13,374&lt;br /&gt;
|-&lt;br /&gt;
| 73 || 16,049&lt;br /&gt;
|-&lt;br /&gt;
| 74 || 19,259&lt;br /&gt;
|-&lt;br /&gt;
| 75 || 23,111&lt;br /&gt;
|-&lt;br /&gt;
| 76 || 27,733&lt;br /&gt;
|-&lt;br /&gt;
| 77 || 33,279&lt;br /&gt;
|-&lt;br /&gt;
| 78 || 39,935&lt;br /&gt;
|-&lt;br /&gt;
| 79 || 47,922&lt;br /&gt;
|-&lt;br /&gt;
| 80 || 57,506&lt;br /&gt;
|-&lt;br /&gt;
| 81 || 69,008&lt;br /&gt;
|-&lt;br /&gt;
| 82 || 82,809&lt;br /&gt;
|-&lt;br /&gt;
| 83 || 99,371&lt;br /&gt;
|-&lt;br /&gt;
| 84 || 119,245&lt;br /&gt;
|-&lt;br /&gt;
| 85 || 143,094&lt;br /&gt;
|-&lt;br /&gt;
| 86 || 171,713&lt;br /&gt;
|-&lt;br /&gt;
| 87 || 206,056&lt;br /&gt;
|-&lt;br /&gt;
| 88 || 247,267&lt;br /&gt;
|-&lt;br /&gt;
| 89 || 296,720&lt;br /&gt;
|-&lt;br /&gt;
| 90 || 356,064&lt;br /&gt;
|-&lt;br /&gt;
| 91 || 427,277&lt;br /&gt;
|-&lt;br /&gt;
| 92 || 512,733&lt;br /&gt;
|-&lt;br /&gt;
| 93 || 615,279&lt;br /&gt;
|-&lt;br /&gt;
| 94 || 738,335&lt;br /&gt;
|-&lt;br /&gt;
| 95 || 886,002&lt;br /&gt;
|-&lt;br /&gt;
| 96 || 1,063,203&lt;br /&gt;
|-&lt;br /&gt;
| 97 || 1,275,843&lt;br /&gt;
|-&lt;br /&gt;
| 98 || 1,531,012&lt;br /&gt;
|-&lt;br /&gt;
| 99 || 1,837,214&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* Each player&#039;s value is calculated and updated at the start of each season.&lt;br /&gt;
&lt;br /&gt;
It uses the formula below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AmountT players_value = wage * multiplier;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where &#039;&#039;multiplier&#039;&#039; is set to be 75.  &lt;br /&gt;
So the value of a player is 75 weeks of his wages.&lt;br /&gt;
&lt;br /&gt;
If the player is over 22 years old, then for each year of his age he loses 10% of his value compared to the previous year.&lt;br /&gt;
&lt;br /&gt;
This stops when a player reaches 40 years of age, then players aged 40 and above are all valued the same as a 40 year old player.  &lt;br /&gt;
See the formula below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if(players_age &amp;gt; 22)&lt;br /&gt;
{&lt;br /&gt;
    if(players_age &amp;gt; 40)&lt;br /&gt;
        players_age = 40;&lt;br /&gt;
  &lt;br /&gt;
    for(int ic1 = 23; ic1 &amp;lt;= (players_age); ic1++)&lt;br /&gt;
    {&lt;br /&gt;
        players_value = (players_value * 9) / 10;&lt;br /&gt;
    }             &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Players&#039; fitness is reset to be between 85–100, using the formula below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
const int fitness = 85 + rand_get_mod(15);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Creating all the competitions==&lt;br /&gt;
&lt;br /&gt;
The competitions are created for the domestic, continental and world tournaments.&lt;br /&gt;
&lt;br /&gt;
Each country has a domestic cup and every club in the country is put into the cup. For the first round it is possible that the number of teams in the cup are not a power of 2, which means some clubs will not have an opponent and will need a bye to the next round.  &lt;br /&gt;
See the formula below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int num_dummy_teams = 0;&lt;br /&gt;
if (round == 1)&lt;br /&gt;
{&lt;br /&gt;
    const int num_teams_needed = (1 &amp;lt;&amp;lt; num_rounds);&lt;br /&gt;
    num_dummy_teams = num_teams_needed - num_teams;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The leagues are created and the correct teams are put into them for each domestic league and the continental group stages.&lt;br /&gt;
&lt;br /&gt;
If it is the first season then the clubs that go into all the domestic leagues, continental groups and the world club cup are pre‑defined and provided in a data file.&lt;br /&gt;
&lt;br /&gt;
If it is not the first season then the clubs that go into the domestic leagues are based upon the previous seasons with any promotion and relegations factored in.&lt;br /&gt;
&lt;br /&gt;
The continental groups will have the winners of all the previous season&#039;s domestic leagues put into the group stage. One spot is allocated for each country apart from ENG, GER, ESP, RUS, JPN and SK who each get 2 spots.&lt;br /&gt;
&lt;br /&gt;
The world club cup will have the winners of the previous season&#039;s four continental competitions placed in it.&lt;br /&gt;
&lt;br /&gt;
==Setup the Economies for the Domestic Leagues and the Continental Competitions==&lt;br /&gt;
&lt;br /&gt;
The average league attendance for each league and the average player rating of the clubs in the league are both stored.  &lt;br /&gt;
See the formula below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int ave_league_attendance;&lt;br /&gt;
int ave_club_rating_start;&lt;br /&gt;
&lt;br /&gt;
const int ave_league_attendance = league_attendance / num_teams;&lt;br /&gt;
const int ave_club_rating_start = league_rating / num_teams;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These values are immutable and all future seasons use the same values.&lt;br /&gt;
&lt;br /&gt;
At the start of the first season, each club starts off with a balance that would be enough to pay half a season&#039;s worth of its wages.  &lt;br /&gt;
See the formula below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int num_gameweek_wages_for_club_balance = (num_rounds * 5000 / 10000;&lt;br /&gt;
AmountT start_balance = club_wages * num_gameweek_wages_for_club_balance;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When the first season is created, the following values are calculated for each domestic league and continental competition: ticket cost, TV money and prize money pot. As below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AmountT ticket_cost;&lt;br /&gt;
AmountT tv_money;&lt;br /&gt;
AmountT prize_money_pot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These values are immutable and all future seasons use the same values.&lt;br /&gt;
&lt;br /&gt;
A season&#039;s worth of income for each domestic league is calculated by adding up a season&#039;s worth of outgoings for all the clubs in the league, which is the league&#039;s wage bill.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
league_wages += (league_wages * 500) / 10000;   //inflation rate&lt;br /&gt;
&lt;br /&gt;
AmountT weekly_ticket_pot = (league_wages * gate_reciepts_percentage) / 10000;&lt;br /&gt;
AmountT weekly_tv_pot = (league_wages * tv_percentage) / 10000;&lt;br /&gt;
int weekly_tickets_sold = league_attendance / 2; //halve games played at home&lt;br /&gt;
&lt;br /&gt;
const AmountT ticket_price = weekly_ticket_pot / weekly_tickets_sold;&lt;br /&gt;
const AmountT weekly_tv_money = weekly_tv_pot / num_teams;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The income is set to match the outgoings so that by the end of the season if all the clubs&#039; balances were added up, it would be around the same as at the start of a season (assuming no transfers had taken place).&lt;br /&gt;
&lt;br /&gt;
A 5% inflation rate is added to the income so that there is a little extra money for each of the clubs.&lt;br /&gt;
&lt;br /&gt;
The income is split 50/50 between TV revenue and Gate receipts (which is further split into sponsorship, merchandise). The ticket price for the league is calculated based on the number of fans expected to attend all the matches in a season.&lt;br /&gt;
&lt;br /&gt;
The prize money pot for the league, which is distributed at the end of the season, is calculated by taking 12% of a season&#039;s worth of the league&#039;s wages.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int num_gameweek_wages_for_prize_pot = (num_rounds * 1200) / 10000;    &lt;br /&gt;
AmountT season_prize_money_pot = league_wages * num_gameweek_wages_for_prize_pot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the continental competitions, the same income calculation is done for each of the group stage leagues. However, the group with the highest TV Revenue, Ticket Price and Prize Money Pot within a continent is then chosen to be used for all the other groups too.&lt;br /&gt;
&lt;br /&gt;
As previously mentioned, these values are all permanently stored and used for all the future seasons. This means that the season&#039;s income is always the same for each league and anchored around how the leagues&#039; outgoings were (its wage bill) at the start of the game.&lt;br /&gt;
&lt;br /&gt;
==Schedules==&lt;br /&gt;
&lt;br /&gt;
The schedule for the game world as a whole will have 45 gameweeks, each game week falling on Saturdays and Wednesdays.&lt;br /&gt;
&lt;br /&gt;
All leagues play their first game at the same time and their last game at the same date. As leagues all have a different number of clubs in them, they also have different numbers of fixtures during a season. Some leagues will have a few Wednesdays off, to spread the matches evenly.&lt;br /&gt;
&lt;br /&gt;
Some gameweeks will have more than one match played in them as there could be cup games, either domestic, continental or world cup on a Monday.&lt;br /&gt;
&lt;br /&gt;
The schedule can be seen here:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Week !! Date !! Weekday !! Competition !! Match Day !! &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || 15.07.2024 || Monday || &#039;&#039;&#039;BREAK&#039;&#039;&#039; ||  || bye round in code&lt;br /&gt;
|-&lt;br /&gt;
|  || 17.07.2024 || Wednesday || &#039;&#039;&#039;BREAK&#039;&#039;&#039; ||  || bye round in code&lt;br /&gt;
|-&lt;br /&gt;
|  || 20.07.2024 || Saturday || League || 1 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || 22.07.2024 || Monday || Continental 1 ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 24.07.2024 || Wednesday || League || 2 || &lt;br /&gt;
|-&lt;br /&gt;
|  || 27.07.2024 || Saturday || League || 3 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || 29.07.2024 || Monday || Continental 2 ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 31.07.2024 || Wednesday || League || 4 || bye round league&lt;br /&gt;
|-&lt;br /&gt;
|  || 03.08.2024 || Saturday || League || 5 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || 05.08.2024 || Monday || Cup1 ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 07.08.2024 || Wednesday || League || 6 || bye round league&lt;br /&gt;
|-&lt;br /&gt;
|  || 10.08.2024 || Saturday || League || 7 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || 12.08.2024 || Monday || Continental 3 ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 14.08.2024 || Wednesday || League || 8 || bye round league&lt;br /&gt;
|-&lt;br /&gt;
|  || 17.08.2024 || Saturday || League || 9 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || 19.08.2024 || Monday || Continental 4 ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 21.08.2024 || Wednesday || League || 10 || bye round league&lt;br /&gt;
|-&lt;br /&gt;
|  || 24.08.2024 || Saturday || League || 11 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || 26.08.2024 || Monday || Continental 5 ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 28.08.2024 || Wednesday || League || 12 || bye round league&lt;br /&gt;
|-&lt;br /&gt;
|  || 31.08.2024 || Saturday || League || 13 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || 02.09.2024 || Monday || Cup2 ||  || bye round cup&lt;br /&gt;
|-&lt;br /&gt;
|  || 04.09.2024 || Wednesday || League || 14 || bye round league&lt;br /&gt;
|-&lt;br /&gt;
|  || 07.09.2024 || Saturday || League || 15 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || 09.09.2024 || Monday || Continental 6 ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 11.09.2024 || Wednesday || League || 16 || bye round league&lt;br /&gt;
|-&lt;br /&gt;
|  || 14.09.2024 || Saturday || League || 17 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || 16.09.2024 || Monday || Continental 7 ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 18.09.2024 || Wednesday || League || 18 || bye round league&lt;br /&gt;
|-&lt;br /&gt;
|  || 21.09.2024 || Saturday || League || 19 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || 23.09.2024 || Monday || Cup3 ||  || bye round cup&lt;br /&gt;
|-&lt;br /&gt;
|  || 25.09.2024 || Wednesday || League || 20 || &lt;br /&gt;
|-&lt;br /&gt;
|  || 28.09.2024 || Saturday || League || 21 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || 30.09.2024 || Monday || Continental 8 ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 02.10.2024 || Wednesday || League || 22 || bye round league&lt;br /&gt;
|-&lt;br /&gt;
|  || 05.10.2024 || Saturday || League || 23 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || 07.10.2024 || Monday || Cup4 ||  || bye round cup&lt;br /&gt;
|-&lt;br /&gt;
|  || 09.10.2024 || Wednesday || League || 24 || &lt;br /&gt;
|-&lt;br /&gt;
|  || 12.10.2024 || Saturday || League || 25 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || 14.10.2024 || Monday || Continental 9 ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 16.10.2024 || Wednesday || League || 26 || bye round league&lt;br /&gt;
|-&lt;br /&gt;
|  || 19.10.2024 || Saturday || League || 27 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || 21.10.2024 || Monday || Cup5 ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 23.10.2024 || Wednesday || League || 28 || &lt;br /&gt;
|-&lt;br /&gt;
|  || 26.10.2024 || Saturday || League || 29 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || 28.10.2024 || Monday || Continental 10 ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 30.10.2024 || Wednesday || League || 30 || bye round league&lt;br /&gt;
|-&lt;br /&gt;
|  || 02.11.2024 || Saturday || League || 31 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || 04.11.2024 || Monday || Cup6 ||  || bye round cup&lt;br /&gt;
|-&lt;br /&gt;
|  || 06.11.2024 || Wednesday || League || 32 || &lt;br /&gt;
|-&lt;br /&gt;
|  || 09.11.2024 || Saturday || League || 33 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || 11.11.2024 || Monday || Club World 1 ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 13.11.2024 || Wednesday || Club World 2 ||  || bye round league&lt;br /&gt;
|-&lt;br /&gt;
|  || 16.11.2024 || Saturday || League || 34 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || 18.11.2024 || Monday || Cup7 ||  || bye round cup&lt;br /&gt;
|-&lt;br /&gt;
|  || 20.11.2024 || Wednesday || League || 35 || &lt;br /&gt;
|-&lt;br /&gt;
|  || 23.11.2024 || Saturday || League || 36 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || 25.11.2024 || Monday || Continental 1/16 ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 27.10.2024 || Wednesday || League || 37 || &lt;br /&gt;
|-&lt;br /&gt;
|  || 30.11.2024 || Saturday || League || 38 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21&#039;&#039;&#039; || 02.12.2024 || Monday || Cup8 ||  || bye round cup&lt;br /&gt;
|-&lt;br /&gt;
|  || 04.12.2024 || Wednesday || League || 39 || &lt;br /&gt;
|-&lt;br /&gt;
|  || 07.12.2024 || Saturday || League || 40 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;22&#039;&#039;&#039; || 09.12.2024 || Monday || Continental QF ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 11.12.2024 || Wednesday || League || 41 || &lt;br /&gt;
|-&lt;br /&gt;
|  || 14.12.2024 || Saturday || League || 42 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || 16.12.2024 || Monday || Continental SF ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 18.12.2024 || Wednesday || League || 43 || &lt;br /&gt;
|-&lt;br /&gt;
|  || 21.12.2024 || Saturday || League || 44 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24&#039;&#039;&#039; || 23.12.2024 || Monday || Cup9 ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 25.12.2024 || Wednesday || League || 45 || &lt;br /&gt;
|-&lt;br /&gt;
|  || 28.12.2024 || Saturday || Continental F ||  || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || 30.12.2024 || Monday || &#039;&#039;&#039;BREAK&#039;&#039;&#039; ||  || bye round in code&lt;br /&gt;
|-&lt;br /&gt;
|  || 01.01.2025 || Wednesday || &#039;&#039;&#039;BREAK&#039;&#039;&#039; ||  || bye round in code&lt;br /&gt;
|-&lt;br /&gt;
|  || 04.01.2025 || Saturday || &#039;&#039;&#039;BREAK&#039;&#039;&#039; ||  || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1/26&#039;&#039;&#039; || 06.01.2025 || Monday || &#039;&#039;&#039;BREAK&#039;&#039;&#039; ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 08.01.2025 || Wednesday || &#039;&#039;&#039;BREAK&#039;&#039;&#039; ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 11.01.2025 || Saturday || League || 1 || &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each season will start on either the second Saturday of January or the second Saturday of July:  &lt;br /&gt;
See the dates for the first 10 seasons:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Season 1:  &lt;br /&gt;
    start: 2025-1-11 0:0:0 (1736553600)  &lt;br /&gt;
    end:   2025-7-12 0:0:0 (1752278400)  &lt;br /&gt;
    first turn: 2025-1-18 6:0:0 (1737180000)  &lt;br /&gt;
    last turn:  2025-6-29 0:0:0 (1751155200)  &lt;br /&gt;
Season 2:  &lt;br /&gt;
    start: 2025-7-12 0:0:0 (1752278400)  &lt;br /&gt;
    end:   2026-1-10 0:0:0 (1768003200)  &lt;br /&gt;
    first turn: 2025-7-19 6:0:0 (1752904800)  &lt;br /&gt;
    last turn:  2025-12-28 0:0:0 (1766880000)  &lt;br /&gt;
Season 3:  &lt;br /&gt;
    start: 2026-1-10 0:0:0 (1768003200)  &lt;br /&gt;
    end:   2026-7-11 0:0:0 (1783728000)  &lt;br /&gt;
    first turn: 2026-1-17 6:0:0 (1768629600)  &lt;br /&gt;
    last turn:  2026-6-28 0:0:0 (1782604800)  &lt;br /&gt;
Season 4:  &lt;br /&gt;
    start: 2026-7-11 0:0:0 (1783728000)  &lt;br /&gt;
    end:   2027-1-9 0:0:0 (1799452800)  &lt;br /&gt;
    first turn: 2026-7-18 6:0:0 (1784354400)  &lt;br /&gt;
    last turn:  2026-12-27 0:0:0 (1798329600)  &lt;br /&gt;
Season 5:  &lt;br /&gt;
    start: 2027-1-9 0:0:0 (1799452800)  &lt;br /&gt;
    end:   2027-7-10 0:0:0 (1815177600)  &lt;br /&gt;
    first turn: 2027-1-16 6:0:0 (1800079200)  &lt;br /&gt;
    last turn:  2027-6-27 0:0:0 (1814054400)  &lt;br /&gt;
Season 6:  &lt;br /&gt;
    start: 2027-7-10 0:0:0 (1815177600)  &lt;br /&gt;
    end:   2028-1-8 0:0:0 (1830902400)  &lt;br /&gt;
    first turn: 2027-7-17 6:0:0 (1815804000)  &lt;br /&gt;
    last turn:  2027-12-26 0:0:0 (1829779200)  &lt;br /&gt;
Season 7:  &lt;br /&gt;
    start: 2028-1-8 0:0:0 (1830902400)  &lt;br /&gt;
    end:   2028-7-8 0:0:0 (1846627200)  &lt;br /&gt;
    first turn: 2028-1-15 6:0:0 (1831528800)  &lt;br /&gt;
    last turn:  2028-6-25 0:0:0 (1845504000)  &lt;br /&gt;
Season 8:  &lt;br /&gt;
    start: 2028-7-8 0:0:0 (1846627200)  &lt;br /&gt;
    end:   2029-1-6 0:0:0 (1862352000)  &lt;br /&gt;
    first turn: 2028-7-15 6:0:0 (1847253600)  &lt;br /&gt;
    last turn:  2028-12-24 0:0:0 (1861228800)  &lt;br /&gt;
Season 9:  &lt;br /&gt;
    start: 2029-1-6 0:0:0 (1862352000)  &lt;br /&gt;
    end:   2029-7-7 0:0:0 (1878076800)  &lt;br /&gt;
    first turn: 2029-1-13 6:0:0 (1862978400)  &lt;br /&gt;
    last turn:  2029-6-24 0:0:0 (1876953600)  &lt;br /&gt;
Season 10:  &lt;br /&gt;
    start: 2029-7-7 0:0:0 (1878076800)  &lt;br /&gt;
    end:   2030-1-5 0:0:0 (1893801600)  &lt;br /&gt;
    first turn: 2029-7-14 6:0:0 (1878703200)  &lt;br /&gt;
    last turn:  2029-12-23 0:0:0 (1892678400)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Stadium Building and Fanbase Changes==&lt;br /&gt;
&lt;br /&gt;
Under certain circumstances the stadiums will auto build a little bit at the start of each season, aiming to have a stadium capacity target of either the club&#039;s fanbase + 30% or the average attendance of the league + 30%, whichever is smaller.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int target_attendance;&lt;br /&gt;
if (ave_attendance &amp;lt; fans_current)&lt;br /&gt;
    target_attendance = (ave_attendance * 130) / 100;&lt;br /&gt;
else&lt;br /&gt;
    target_attendance = (fans_current * 130) / 100;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the current size of the stadium is smaller than the target attendance then seat capacity will be added somewhere between the current size and the target. Note, this will not happen if the number of new seats to be added is less than 200.  &lt;br /&gt;
See the formula below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int new_size = stadium_size_current;&lt;br /&gt;
int increase = 0;&lt;br /&gt;
&lt;br /&gt;
if (stadium_size_current &amp;lt; target_attendance)&lt;br /&gt;
{&lt;br /&gt;
    const int max_inc = target_attendance - stadium_size_current;&lt;br /&gt;
    const int min_inc = max_inc / 2;&lt;br /&gt;
&lt;br /&gt;
    increase = min_inc + rand_get_mod(max_inc - min_inc);&lt;br /&gt;
&lt;br /&gt;
    if (increase &amp;gt; 200)&lt;br /&gt;
    {&lt;br /&gt;
        new_size = stadium_size_current + increase;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example:  &lt;br /&gt;
This means that all clubs in the lower leagues have the potential to have a stadium size sufficient enough to hold the average number of fans in the top league + 30%, if they got into that league and stayed in there, allowing them to compete on a more even basis.&lt;br /&gt;
&lt;br /&gt;
Under certain circumstances, at the start of each season, the fan base can rise and fall depending on if the club has been promoted or relegated.&lt;br /&gt;
&lt;br /&gt;
If the club is currently in the division that it started in then its fanbase can rise, tending towards either the league&#039;s average attendance or the fanbase it started the game with, whichever is greater.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if (club_division == division_start)&lt;br /&gt;
{&lt;br /&gt;
    //move to league average or start fanbase (whichever is bigger)&lt;br /&gt;
&lt;br /&gt;
    if (fans_start &amp;gt; ave_attendance)&lt;br /&gt;
        target_fanbase = fans_start;&lt;br /&gt;
    else&lt;br /&gt;
        target_fanbase = ave_attendance;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the club is not in the division that it started in, then it has either been promoted or relegated and its target fanbase will change accordingly.  &lt;br /&gt;
See the formula below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
else  //In non-starting league&lt;br /&gt;
{&lt;br /&gt;
    if (fans_start &amp;gt; ave_attendance)&lt;br /&gt;
        target_fanbase = fans_start - (fans_start - ave_attendance) / 2;&lt;br /&gt;
    else&lt;br /&gt;
        target_fanbase = ave_attendance;&lt;br /&gt;
&lt;br /&gt;
    if (club_division &amp;gt; division_start)&lt;br /&gt;
    {&lt;br /&gt;
        //got relegated&lt;br /&gt;
    }&lt;br /&gt;
    else if (club_division &amp;lt; division_start)&lt;br /&gt;
    {&lt;br /&gt;
        if (target_fanbase &amp;lt; fans_start)&lt;br /&gt;
            target_fanbase = fans_start;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each season the fan base will tend from its current fan base towards its target by 50%.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int new_attendance = fans_current;&lt;br /&gt;
if (fans_current &amp;gt; target_fanbase)  //shrink it&lt;br /&gt;
    new_attendance = fans_current - (fans_current - target_fanbase) / 2;&lt;br /&gt;
if (fans_current &amp;lt; target_fanbase)  //grow it&lt;br /&gt;
    new_attendance = fans_current + (target_fanbase - fans_current) / 2;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example:  &lt;br /&gt;
If a club had a fanbase of 1000 and got promoted, its fanbase would slowly rise each season until it was at the average fanbase of the league that it is now in. An English division 10 club with a 1000 fanbase could eventually have a fanbase of over 35,000 if it got into and stayed in the English division 1.&lt;br /&gt;
&lt;br /&gt;
As mentioned before, the stadium would also gradually increase its capacity, alongside the fanbase.&lt;br /&gt;
&lt;br /&gt;
==Fitness==&lt;br /&gt;
&lt;br /&gt;
On each matchday, fitness is reduced for each player during the match.&lt;br /&gt;
&lt;br /&gt;
It uses the formula below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
reduce_level = (1 * time_played) / 15;&lt;br /&gt;
new_fitness = start_fitness - reduce_level - rand_get_mod(6);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Basically if he played 90 minutes he would lose (randomly) between 24 and 29 fitness points, which is on average 26/27 a match.  &lt;br /&gt;
Of course if he played less, say 45 minutes, then he would lose half of that, on average.&lt;br /&gt;
&lt;br /&gt;
Then each day at 3am UTC time, fitness increases with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
new_fitness = fitness + 5 + rand_get_mod(5);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So it goes up between 5 and 9 points each day, which is on average 7 a day.&lt;br /&gt;
&lt;br /&gt;
As an example:  &lt;br /&gt;
If a player&#039;s fitness was 100% and he played two league games a week, say Saturday and Wednesday, he would go down 53 points on average (e.g. 26+27) and up 49 a week on average (e.g. plus 7 for 7 days).&lt;br /&gt;
&lt;br /&gt;
Gradually over a season the player will reduce and will need to be rotated. If the club plays in cup games too then they will reduce even faster, so squad rotation is even more important if the club is also aiming to win cups.&lt;br /&gt;
&lt;br /&gt;
Note: A player&#039;s fitness will increase more slowly if he is injured but back in the next two weeks.  &lt;br /&gt;
See below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if (injured &amp;gt; timestamp)&lt;br /&gt;
{&lt;br /&gt;
    fitness += 3 + rand_get_mod(5);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the player is injured for two weeks or more then his fitness will not increase.&lt;br /&gt;
&lt;br /&gt;
==Transfers - Unmanaged Club==&lt;br /&gt;
&lt;br /&gt;
There is logic that runs each day that allows unmanaged clubs to join in the transfer market. &lt;br /&gt;
* Each unmanaged club will have an attempt to either buy or sell 6 times, distributed over a season&lt;br /&gt;
* A club will not make an attempt if it is managed or used its seasons in/out limits&lt;br /&gt;
* The 6 attempts are configurable in a parameter and can even be turned off by setting it at 0.&lt;br /&gt;
		&lt;br /&gt;
&lt;br /&gt;
First, find what the target average rating is that we want a club’s starting 11 players to be (‘target rating’).&lt;br /&gt;
&lt;br /&gt;
This could either be the value that the club started at or the average of the division the club is currently in.  If the club is currently in the division it started in then we use the former, otherwise we use the latter.&lt;br /&gt;
&lt;br /&gt;
Note: This works the same as the target ‘fan base’ used for attendance as clubs are promoted and relegated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Buy Decision===&lt;br /&gt;
&lt;br /&gt;
Find what player position is the most required for the club.&lt;br /&gt;
* prioritise position if below any min position thresholds&lt;br /&gt;
* then prioritise position if below any ideal position thresholds&lt;br /&gt;
* otherwise go for any position other than another GK&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
- is the club&#039;s current average rating less than the ‘target rating’?&lt;br /&gt;
YES&lt;br /&gt;
   bid for player, (‘target rating’ to ‘target rating + 5’), (age 23+)&lt;br /&gt;
&lt;br /&gt;
- has there been a player bid yet?&lt;br /&gt;
NO&lt;br /&gt;
   - is the squad small / below min position limits?&lt;br /&gt;
   YES&lt;br /&gt;
      bid for squad player in required positions (‘target rating’ to ‘target rating - 5’)  (any age)&lt;br /&gt;
   NO&lt;br /&gt;
      bid for squad player in required positions (‘target rating’ to ‘target rating - 5’)  (age &amp;lt; 23) - since the squad is not small we can go for a youth player&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: All bids need to meet the following before being placed:&lt;br /&gt;
* A suitable player is on the market&lt;br /&gt;
* The club has funds to make a bid&lt;br /&gt;
* The clubs squad is not full&lt;br /&gt;
* The club has no current outstanding bids&lt;br /&gt;
* The chosen player has been on the market for at least 1 day  (not implemented)&lt;br /&gt;
&lt;br /&gt;
===Sell Decision===&lt;br /&gt;
&lt;br /&gt;
Find what player positions are above the ideal size for each position then prioritise this position if above any ideal position thresholds&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
- is the club&#039;s current average rating above the ‘target rating’?&lt;br /&gt;
YES&lt;br /&gt;
   List a player, (‘target rating’ to ‘target rating + 5’), (age 23+)&lt;br /&gt;
&lt;br /&gt;
- has there been a player listed yet?&lt;br /&gt;
NO&lt;br /&gt;
   - is the squad large / above all the ideal position thresholds?&lt;br /&gt;
   YES&lt;br /&gt;
      List a squad player from a chosen position (‘target rating’ to ‘target rating - 5’)  (any age)&lt;br /&gt;
   NO&lt;br /&gt;
      List a squad player from a chosen position (‘target rating’ to ‘target rating - 5’)  (age 30+) - since the squad is not large we can go for an older&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: All transfer listings need to meet the following before being placed:&lt;br /&gt;
* The clubs squad is not below the minimum allowed squad size&lt;br /&gt;
* The club has not currently listed any players for sale&lt;br /&gt;
&lt;br /&gt;
==Matchday==&lt;br /&gt;
&lt;br /&gt;
All the fixtures that have not yet played are identified and prepared for processing their matchdays.&lt;br /&gt;
&lt;br /&gt;
For each fixture, the tactics and teamsheets for both teams are processed and validated before the match.&lt;br /&gt;
&lt;br /&gt;
If any player is unhappy then they lose 10% of their rating and if a player is injured or banned then he is considered to be a &amp;quot;dud player&amp;quot; and will not take part in the match.&lt;br /&gt;
&lt;br /&gt;
If the match is a continental competition then the ticket price and TV revenue numbers that are specific to that competition are used. Domestic cups use the ticket price and TV revenue numbers that the home team uses for its domestic league games. Each domestic league has its own ticket price and TV revenue that all clubs in that league use.&lt;br /&gt;
&lt;br /&gt;
==Attendance==&lt;br /&gt;
&lt;br /&gt;
The number of fans that turn up for matches are as follows:&lt;br /&gt;
&lt;br /&gt;
Domestic league and cup games will use the home club&#039;s fanbase, assuming they fit into the home club&#039;s stadium, as the number of fans that will turn up on matchday.&lt;br /&gt;
&lt;br /&gt;
The fanbase does not grow or shrink if you win or lose games; however, after the sixth domestic league game in the season, the attendance for domestic games can increase by up to 30% from its fanbase depending on how high in the table the club is above the middle of the table, and up to 30% less depending on how low the club is from the middle of the table.  &lt;br /&gt;
See the formula below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//change the attendance based on the club&#039;s domestic league position&lt;br /&gt;
if (games_played &amp;gt; 6)&lt;br /&gt;
{&lt;br /&gt;
  int mid_table = num_teams / 2; //Get the league table size and half it.&lt;br /&gt;
&lt;br /&gt;
  //if in top half of table means more fans&lt;br /&gt;
  if (new_position &amp;lt; mid_table)&lt;br /&gt;
  {&lt;br /&gt;
    int units_of_fans = mid_table - new_position;&lt;br /&gt;
    c-&amp;gt;fans = c-&amp;gt;fans + ((c-&amp;gt;fans / 30) * units_of_fans);&lt;br /&gt;
  }&lt;br /&gt;
  else if(new_position &amp;gt; mid_table)  //bottom half of the table means less fans&lt;br /&gt;
  {&lt;br /&gt;
    int units_of_fans = new_position - mid_table;&lt;br /&gt;
    c-&amp;gt;fans = c-&amp;gt;fans - ((c-&amp;gt;fans / 30) * units_of_fans);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If it&#039;s a domestic cup or shield game then they usually get more fans than a league game, so it looks to use either the fan base (with the 30% modifier if applicable) or 75% of the stadium size, whichever is bigger.  &lt;br /&gt;
See the formula below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if((comp_type == COMP_TYPE_NATIONAL_CUP) ||&lt;br /&gt;
   (comp_type == COMP_TYPE_NATIONAL_SHIELD))&lt;br /&gt;
{&lt;br /&gt;
  int minimum_fans = (c-&amp;gt;stadium_size / 4) * 3;&lt;br /&gt;
&lt;br /&gt;
  if (c-&amp;gt;fans &amp;lt; minimum_fans)&lt;br /&gt;
  {&lt;br /&gt;
    c-&amp;gt;fans = minimum_fans - rand_get_mod(100);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Continental and world club cup games almost always have full stadium attendances.&lt;br /&gt;
&lt;br /&gt;
==Tactics Autopick==&lt;br /&gt;
&lt;br /&gt;
If the club has no manager or it has a manager who has submitted invalid tactics, then the autopick will kick in.&lt;br /&gt;
&lt;br /&gt;
Invalid tactics are:&lt;br /&gt;
* Contains at least one player who is injured or match banned.&lt;br /&gt;
* Has no goalkeeper in the goalkeeper position – unless there is a good reason like all the goalkeepers in the squad are injured or banned.&lt;br /&gt;
&lt;br /&gt;
The autopick will randomly choose one of the following formations: 4-4-2, 4-3-3 or 4-5-1 and then find the best possible player for each of the positions in the chosen formation. The player&#039;s fitness will also be taken into consideration when choosing the best players for each position.&lt;br /&gt;
&lt;br /&gt;
==Player Rating Adjustments==&lt;br /&gt;
&lt;br /&gt;
Each player is checked if it is being played in the correct position that it is meant to be played in; for example, a DC in a DC position.&lt;br /&gt;
&lt;br /&gt;
If the player is not in the correct position then he is penalized. The further out of position a player is the more he is penalized. The grid below shows what percentage should be knocked off the player&#039;s goalkeeping, tackling, passing and shooting rating, should he be out of position.  &lt;br /&gt;
See: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
const int g_grid_outta_pos_multi[16][9][7] = {&lt;br /&gt;
{&lt;br /&gt;
    {0, 0, 0, 0, 0, 0, 0}, //G&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40},&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40},&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40},&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40},&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40},&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40},&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40},&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}, //LB&lt;br /&gt;
    {3, 3, 5, 5, 5, 0, 0},&lt;br /&gt;
    {3, 3, 5, 5, 5, 0, 0},&lt;br /&gt;
    {3, 3, 5, 5, 5, 0, 0},&lt;br /&gt;
    {5, 5, 10, 10, 10, 0, 0},&lt;br /&gt;
    {10, 15, 15, 15, 15, 10, 5},&lt;br /&gt;
    {25, 25, 25, 25, 25, 25, 20},&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35}&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}, //CB&lt;br /&gt;
    {5, 0, 0, 0, 0, 0, 5},&lt;br /&gt;
    {5, 0, 0, 0, 0, 0, 5},&lt;br /&gt;
    {10, 10, 5, 5, 5, 10, 10},&lt;br /&gt;
    {10, 10, 5, 5, 5, 10, 10},&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 15},&lt;br /&gt;
    {25, 25, 25, 25, 25, 25, 25},&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35}&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}, //RB&lt;br /&gt;
    {0, 0, 5, 5, 5, 3, 3},&lt;br /&gt;
    {0, 0, 5, 5, 5, 3, 3},&lt;br /&gt;
    {0, 0, 5, 5, 5, 3, 3},&lt;br /&gt;
    {0, 0, 10, 10, 10, 5, 5},&lt;br /&gt;
    {5, 10, 15, 15, 15, 15, 10},&lt;br /&gt;
    {20, 25, 25, 25, 25, 25, 25},&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35}&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}, //DML&lt;br /&gt;
    {10, 10, 15, 15, 15, 5, 5},&lt;br /&gt;
    {10, 10, 15, 15, 15, 5, 5},&lt;br /&gt;
    {2, 2, 2, 2, 1, 0, 0},&lt;br /&gt;
    {2, 2, 2, 2, 1, 0, 0},&lt;br /&gt;
    {3, 3, 3, 3, 2, 0, 0},&lt;br /&gt;
    {15, 15, 15, 15, 10, 5, 5},&lt;br /&gt;
    {25, 25, 25, 25, 25, 25, 25},&lt;br /&gt;
    {25, 25, 25, 25, 25, 25, 25}&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}, //DMC&lt;br /&gt;
    {15, 15, 10, 10, 10, 15, 15},&lt;br /&gt;
    {15, 15, 10, 10, 10, 15, 15},&lt;br /&gt;
    {3, 0, 0, 0, 0, 0, 3},&lt;br /&gt;
    {3, 0, 0, 0, 0, 0, 3},&lt;br /&gt;
    {3, 0, 0, 0, 0, 0, 3},&lt;br /&gt;
    {15, 15, 10, 10, 10, 15, 15},&lt;br /&gt;
    {25, 15, 15, 15, 15, 15, 25},&lt;br /&gt;
    {25, 25, 25, 25, 25, 25, 25}&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}, //DMR&lt;br /&gt;
    {5, 5, 15, 15, 15, 10, 10},&lt;br /&gt;
    {5, 5, 15, 15, 15, 10, 10},&lt;br /&gt;
    {0, 0, 1, 2, 2, 2, 2},&lt;br /&gt;
    {0, 0, 1, 2, 2, 2, 2},&lt;br /&gt;
    {0, 0, 2, 3, 3, 3, 3},&lt;br /&gt;
    {5, 5, 10, 15, 15, 15, 15},&lt;br /&gt;
    {25, 25, 25, 25, 25, 25, 25},&lt;br /&gt;
    {25, 25, 25, 25, 25, 25, 25}&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}, //LM&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 15},&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 15},&lt;br /&gt;
    {5, 5, 5, 5, 4, 0, 0},&lt;br /&gt;
    {3, 3, 3, 3, 2, 0, 0},&lt;br /&gt;
    {1, 1, 1, 1, 1, 0, 0},&lt;br /&gt;
    {3, 3, 3, 3, 2, 0, 0},&lt;br /&gt;
    {10, 10, 10, 10, 10, 10, 10},&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 15}&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}, //CM&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 15},&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 15},&lt;br /&gt;
    {5, 5, 1, 1, 1, 5, 5},&lt;br /&gt;
    {3, 3, 0, 0, 0, 3, 3},&lt;br /&gt;
    {3, 0, 0, 0, 0, 0, 3},&lt;br /&gt;
    {3, 1, 0, 0, 0, 1, 3},&lt;br /&gt;
    {15, 5, 5, 5, 5, 5, 15},&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 15}&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}, //RM&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 15},&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 15},&lt;br /&gt;
    {0, 0, 4, 5, 5, 5, 5},&lt;br /&gt;
    {0, 0, 2, 3, 3, 3, 3},&lt;br /&gt;
    {0, 0, 1, 1, 1, 1, 1},&lt;br /&gt;
    {0, 0, 2, 3, 3, 3, 3},&lt;br /&gt;
    {10, 10, 10, 10, 10, 10, 10},&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 15}&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}, //AML&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {25, 25, 35, 25, 25, 25, 25},&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 10},&lt;br /&gt;
    {5, 5, 5, 5, 5, 0, 0},&lt;br /&gt;
    {5, 5, 3, 3, 1, 0, 0},&lt;br /&gt;
    {5, 5, 3, 3, 1, 0, 0},&lt;br /&gt;
    {10, 10, 10, 10, 5, 3, 3}&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}, //AM&lt;br /&gt;
    {25, 25, 25, 25, 25, 25, 25},&lt;br /&gt;
    {25, 25, 25, 25, 25, 25, 25},&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 15},&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 15},&lt;br /&gt;
    {3, 0, 0, 0, 0, 0, 3},&lt;br /&gt;
    {3, 0, 0, 0, 0, 0, 3},&lt;br /&gt;
    {3, 0, 0, 0, 0, 0, 3},&lt;br /&gt;
    {10, 10, 10, 10, 10, 10, 10}&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}, //AMR&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {25, 25, 35, 25, 25, 25, 25},&lt;br /&gt;
    {10, 15, 15, 15, 15, 15, 15},&lt;br /&gt;
    {0, 0, 5, 5, 5, 5, 5},&lt;br /&gt;
    {0, 0, 1, 3, 3, 5, 5},&lt;br /&gt;
    {0, 0, 1, 3, 3, 5, 5},&lt;br /&gt;
    {3, 3, 5, 10, 10, 10, 10}&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}, //FL&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {25, 25, 25, 25, 25, 25, 25},&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 15},&lt;br /&gt;
    {5, 5, 5, 5, 5, 5, 5},&lt;br /&gt;
    {3, 2, 2, 1, 1, 0, 0},&lt;br /&gt;
    {3, 2, 2, 1, 1, 0, 0}&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}, //FC&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {25, 25, 25, 25, 25, 25, 25},&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 15},&lt;br /&gt;
    {5, 5, 5, 5, 5, 5, 5},&lt;br /&gt;
    {3, 1, 0, 0, 0, 1, 3},&lt;br /&gt;
    {3, 1, 0, 0, 0, 1, 3}&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}, //FR&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {25, 25, 25, 25, 25, 25, 25},&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 15},&lt;br /&gt;
    {5, 5, 5, 5, 5, 5, 5},&lt;br /&gt;
    {0, 0, 1, 1, 2, 3, 3},&lt;br /&gt;
    {0, 0, 1, 1, 2, 3, 3}&lt;br /&gt;
}&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Player ratings are also adjusted when taking into consideration each player&#039;s tempo, tackling style and morale.&lt;br /&gt;
&lt;br /&gt;
The tackling style can be set to be more aggressive, which means they will tackle better but also increase their chances of getting a yellow or red card.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
const int tackling_style_adjuster = 2000;&lt;br /&gt;
&lt;br /&gt;
if(tackling_style == 0)&lt;br /&gt;
{&lt;br /&gt;
    c-&amp;gt;ply[ply_off].rating_aggression = c-&amp;gt;ply[ply_off].rating_aggression - ((c-&amp;gt;ply[ply_off].rating_aggression * tackling_style_adjuster) / 10000);&lt;br /&gt;
    if(c-&amp;gt;ply[ply_off].rating_aggression &amp;lt; 10)&lt;br /&gt;
        c-&amp;gt;ply[ply_off].rating_aggression = 10;&lt;br /&gt;
}&lt;br /&gt;
else if(tackling_style == 2)&lt;br /&gt;
{&lt;br /&gt;
    c-&amp;gt;ply[ply_off].rating_aggression = c-&amp;gt;ply[ply_off].rating_aggression + ((c-&amp;gt;ply[ply_off].rating_aggression * tackling_style_adjuster) / 10000);&lt;br /&gt;
    if(c-&amp;gt;ply[ply_off].rating_aggression &amp;gt; 99)&lt;br /&gt;
        c-&amp;gt;ply[ply_off].rating_aggression = 99;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The tempo sets the player&#039;s rating and stamina. A higher tempo means that the player plays better although his fitness will drop more and faster. A lower tempo does the opposite on the ratings and stamina.&lt;br /&gt;
&lt;br /&gt;
Morale when it is set to &amp;quot;unhappy&amp;quot; will knock 10% off the player&#039;s ratings.&lt;br /&gt;
&lt;br /&gt;
==Match Results==&lt;br /&gt;
&lt;br /&gt;
After the match has been played, certain calculations are made and stored.&lt;br /&gt;
&lt;br /&gt;
Manager (veteran) points are awarded; 3 for a win and 1 for a draw.&lt;br /&gt;
&lt;br /&gt;
===Gate Receipts===&lt;br /&gt;
&lt;br /&gt;
For visual effects, the gate receipts are distributed between gate receipts, sponsorship and merchandise, with the combined total actually going 20% over. This extra 20% is then taken off through ground maintenance.  &lt;br /&gt;
See below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AmountT gate_receipts = (AmountT)((c[0].fans * c[0].ticket_cost) * 0.8);&lt;br /&gt;
const AmountT sponsor = (AmountT)((c[0].fans * c[0].ticket_cost) * 0.3);&lt;br /&gt;
const AmountT merchandise = (AmountT)((c[0].fans * c[0].ticket_cost) * 0.1);&lt;br /&gt;
&lt;br /&gt;
const AmountT ground_maintenance = (AmountT)((c[0].fans * c[0].ticket_cost) * 0.2);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the domestic cup games, continental knockouts and world club cup, the gate receipts are split evenly between the home team and the away team.  &lt;br /&gt;
There is only TV money for the continental knockout games and it is the same amount for both the home and away team.&lt;br /&gt;
&lt;br /&gt;
===Payouts===&lt;br /&gt;
&lt;br /&gt;
Payouts to users are made for the club/player influencers and the manager and agent wages.&lt;br /&gt;
&lt;br /&gt;
If it was a domestic league game then:&lt;br /&gt;
&lt;br /&gt;
* 0.2% of the player&#039;s wage is paid out between its influencers.&lt;br /&gt;
* 0.002% of the player&#039;s wage is paid out to the agent (if the player has one).&lt;br /&gt;
* If the club has a manager that is not locked and is active, then it gets paid a wage of 0.0004% of the club&#039;s TV income.&lt;br /&gt;
* If the club is not in debt before the game then 1% of the club&#039;s income is paid out between its influencers. This comes out of the club&#039;s balance.&lt;br /&gt;
&lt;br /&gt;
If it was a domestic cup, continental game or world club cup then:&lt;br /&gt;
&lt;br /&gt;
* If the club is not in debt before the game then 1% of the club&#039;s income is paid out between its influencers. This comes out of the club&#039;s balance.&lt;br /&gt;
&lt;br /&gt;
====Bonuses====&lt;br /&gt;
&lt;br /&gt;
* If the player starts the match then a starting lineup bonus of 0.05% of the player&#039;s wage is passed onto his influencers. A minimum of 45 minutes need to be played.&lt;br /&gt;
&lt;br /&gt;
* If the player scored then a goal bonus of 0.1% of the player&#039;s wage is passed onto his influencers for each goal scored.&lt;br /&gt;
&lt;br /&gt;
* If the player assists then an assist bonus of 0.1% of the player&#039;s wage is passed onto his influencers for each assist.&lt;br /&gt;
&lt;br /&gt;
* If there was a clean sheet then the players who played in goals and defence who were in the starting eleven get a clean sheet bonus of 0.1% of the player&#039;s wage.  &lt;br /&gt;
The player needs to have played at least 75 minutes of the game.&lt;br /&gt;
&lt;br /&gt;
===Fitness===&lt;br /&gt;
&lt;br /&gt;
Fitness is reduced for all players that played in the match. The more minutes they play the more fitness they lose. Goalkeepers lose a lot less, currently four times less, than outfield players.  &lt;br /&gt;
See below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int reduce_level;&lt;br /&gt;
if (ic2 &amp;gt; 0)&lt;br /&gt;
    reduce_level = (4 * time_played) / 15;&lt;br /&gt;
else&lt;br /&gt;
    reduce_level = (1 * time_played) / 15;&lt;br /&gt;
&lt;br /&gt;
fitness = (fitness &amp;lt; 35 ? 1 : fitness - reduce_level - rand_get_mod(6));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Players can get injured for between 2 and 160 days, although it is weighted with more chance towards the lower end.  &lt;br /&gt;
See below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
injury_days = rand_get_mod( rand_get_mod (rand_get_mod (rand_get_mod (159) + 1) + 1) + 1) + 2;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The more days a player has been injured, the more fitness he will lose.  &lt;br /&gt;
See:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if (injury_days &amp;gt; 120)&lt;br /&gt;
{&lt;br /&gt;
    reduce_level = 40 + rand_get_mod(5);&lt;br /&gt;
}&lt;br /&gt;
else if (injury_days &amp;gt; 80)&lt;br /&gt;
{&lt;br /&gt;
    reduce_level += 30 + rand_get_mod(5);&lt;br /&gt;
}&lt;br /&gt;
else if (injury_days &amp;gt; 40)&lt;br /&gt;
{&lt;br /&gt;
    reduce_level += 10 + rand_get_mod(5);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Cup Final Prize Monday and Payouts==&lt;br /&gt;
&lt;br /&gt;
During the season, cup finals are played for domestic, continental and world tournaments that result in prize money for the clubs and payouts for the influence holders.&lt;br /&gt;
&lt;br /&gt;
* The cup prize pots are calculated at the start of the game by taking the average starting balance of the 10 clubs in the cup that have the biggest starting balance. This value is then used for that cup&#039;s prize pot for all future seasons.&lt;br /&gt;
&lt;br /&gt;
* From the cup prize pot, the club gets 25% if it is the winner and 12.5% if it is the runner up.&lt;br /&gt;
&lt;br /&gt;
* Club influence holders get paid 10% of what a club receives from cup prize money (if any).&lt;br /&gt;
** This 10% is split between all the club influence holders and the more influence a user holds in the club, the bigger portion of the 10% that influencer receives.&lt;br /&gt;
** Note: Some or even all of this will go to the club if the club has a debt&lt;br /&gt;
&lt;br /&gt;
* Each player in the club gets a bonus that equates to 0.1% of a club&#039;s cup prize money&lt;br /&gt;
** The more influence a user holds in the player, the bigger portion of the 0.1% that influence holder will receive.&lt;br /&gt;
** Note: The players rating is further used to determine the payout; e.g. a 50 rated player will get half of that 0,1%&lt;br /&gt;
&lt;br /&gt;
* The manager who wins the cup gets 10 manager points and the manager who is the runner up gets 5 manager points.&lt;br /&gt;
&lt;br /&gt;
==End of Season==&lt;br /&gt;
&lt;br /&gt;
When the last fixture of the season has been played, prize money is paid out to each of the clubs in all of the domestic leagues.&lt;br /&gt;
&lt;br /&gt;
Manager points are awarded; 10 for 1st place in a league and 5 for second place.&lt;br /&gt;
&lt;br /&gt;
The first 50% of the league prize money pot is split equally between the clubs.&lt;br /&gt;
&lt;br /&gt;
The other 50% of the total league prize money pot is then split in a linear way with the 1st placed club getting the most and the last placed club getting the least. For example, a league with 20 clubs would have the percentage split as follows: 1st: 9.5%......10th: 5%.......20th: 0.5%.  &lt;br /&gt;
See the formula below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
const int equal = 100 / num_teams;&lt;br /&gt;
int percdue = (num_teams - position) * equal;&lt;br /&gt;
int potperc = ((percdue &amp;lt;&amp;lt; 8) / 100) * (2 * equal);&lt;br /&gt;
&lt;br /&gt;
if (potperc == 0)&lt;br /&gt;
{&lt;br /&gt;
    percdue = 100 - (num_teams - 1) * equal;&lt;br /&gt;
    potperc = ((percdue &amp;lt;&amp;lt; 8) / 100) * (2 * equal);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
AmountT prize_money = (potperc / 100) * prize_money_pot;&lt;br /&gt;
&lt;br /&gt;
prize_money = ((prize_money &amp;gt;&amp;gt; 8));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
clubs_amount = (prize_money * 5000) / 10000;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
10% of a club&#039;s league prize money is split between all club influencers, provided the club isn&#039;t in debt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
shareholders_amount = prize_money - clubs_amount;&lt;br /&gt;
shareholders_amount = (shareholders_amount * 1000) / 10000;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
0.1% of a club&#039;s league prize money is for the influencers of each player, discounted with the player&#039;s rating.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
const AmountT the_prize_share = (prize_money * 5) / 10000;   &lt;br /&gt;
AmountT sent_prize_share = (the_prize_share * player_rating) / 100;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The season then remains the current season for a few more days, before a new season is created.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Events Between Seasons===&lt;br /&gt;
&lt;br /&gt;
All the other end of season events (such as contracts, auctioning players) is done only at the point when the new season is created and the old season is replaced by it.&lt;br /&gt;
&lt;br /&gt;
A ProcessSeasonEnd script is run&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   void ProcessSeasonEnd (DbHandleData&amp;amp; db, const IdT seasonId)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Taking each of the events within it in turn:&lt;br /&gt;
&lt;br /&gt;
===Updating the player data===&lt;br /&gt;
&lt;br /&gt;
The players database is updated at the end of each season, just before the new season is created.&lt;br /&gt;
&lt;br /&gt;
New players are added, existing players updated and some players retire.&lt;br /&gt;
&lt;br /&gt;
Adding new players:&lt;br /&gt;
* If a player in real life has been playing for one of the 5350 clubs in Soccerverse, is not yet in the game and the data from the api is correctly updated, then he will get added to the game and to the free bench.&lt;br /&gt;
&lt;br /&gt;
Updating players:&lt;br /&gt;
* Some of the current players will have their rating, position, side and influence price adjusted, all depending on how they have been performing in real life since the last update. Players that didn&#039;t have a date of birth set previously might get it added.&lt;br /&gt;
&lt;br /&gt;
Retiring players:&lt;br /&gt;
* When a player retires he leaves his current club and he goes on the freebench, however, he can not be bought by anyone.&lt;br /&gt;
* All transfer auctions involving the player are cancelled.&lt;br /&gt;
* Users are no longer able to buy influence from the game for this player.  &lt;br /&gt;
* However, users can trade any existing influence in this player between themselves.&lt;br /&gt;
* Since the player can not play for any club, he will not generate any influence payouts.&lt;br /&gt;
&lt;br /&gt;
All players will also have their value (and wage if on the free bench and not on an active contract) recalculated, as they are now a bit older and potentially worth a little less, and also the ratings will have changed.&lt;br /&gt;
&lt;br /&gt;
===Player Contracts===&lt;br /&gt;
&lt;br /&gt;
* Every player who is at a club has his contract reduced by one season.&lt;br /&gt;
* If the contract runs out then the player gets moved to the free bench.&lt;br /&gt;
* However, under certain conditions the contract will get auto-renewed for one season:&lt;br /&gt;
** Players set to &amp;quot;do not renew&amp;quot; by the agent will never be auto-renewed and will definitely leave.&lt;br /&gt;
** If the club is not actively managed or the manager is locked, then all other player contracts are auto-renewed.&lt;br /&gt;
** If the manager is active, up to 2 players may leave, and all others get auto-renewed.&lt;br /&gt;
** Worst players are released first, and only players may leave in whose position the squad has enough other players.&lt;br /&gt;
&lt;br /&gt;
===Clubs in Debt - Auto Auction===&lt;br /&gt;
&lt;br /&gt;
If a club is in debt then it will attempt to sell off the club&#039;s best player not already in an active auction by putting him on the transfer market auction with a minimum bid of 1 SVC.  In the very unlikely event that no player is available (e.g. because all players in the club retired or had their contracts run out) nothing happens.&lt;br /&gt;
&lt;br /&gt;
This auction is started immediately (ending in a week, not started only when a bid is made).  If no bid is made within the week, then the player leaves to the free bench.&lt;br /&gt;
&lt;br /&gt;
There are three reasons for this:&lt;br /&gt;
* It will reduce the club&#039;s wage bill so that its costs are lower in the future.&lt;br /&gt;
* Other clubs may decide to bid and buy the player on the auction system, potentially getting some money into the club.&lt;br /&gt;
* Losing the best player is an incentive to manage the club&#039;s finances properly.&lt;br /&gt;
&lt;br /&gt;
===Fixing Squads===&lt;br /&gt;
&lt;br /&gt;
For all clubs, the overall squad size and structure (minimum players for each position) is fixed.&lt;br /&gt;
&lt;br /&gt;
The minimum parameters can be seen below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
const unsigned MIN_TEAM_SIZE = 21;&lt;br /&gt;
&lt;br /&gt;
const std::map&amp;lt;RequiredSquadPosition, unsigned&amp;gt; MIN_TEAM_PER_POS = {&lt;br /&gt;
  {RequiredSquadPosition::GK, 2},&lt;br /&gt;
  {RequiredSquadPosition::DEFENDER, 5},&lt;br /&gt;
  {RequiredSquadPosition::MIDFIELD, 5},&lt;br /&gt;
  {RequiredSquadPosition::ATTACKER, 3},&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The worst players on the freebench are chosen as long as no other club are bidding for them.  They are transferred for free to the club.&lt;br /&gt;
&lt;br /&gt;
===Players wages and values===&lt;br /&gt;
&lt;br /&gt;
* The values for all players are recalculated, based on possible rating changes and their changes in age for the current season.&lt;br /&gt;
* The wages for all players on the free bench are calculated.  &lt;br /&gt;
&lt;br /&gt;
(Players at a club have their wages fixed until a new contract gets signed.)&lt;br /&gt;
&lt;br /&gt;
===Club Dilution Events (Cash Injection)===&lt;br /&gt;
&lt;br /&gt;
Club dilutions are implemented but not active yet in the code!  This is how they will work once activated:&lt;br /&gt;
&lt;br /&gt;
* When a club is in debt at a season end a dilution event to raise SVC for the club is started immediately.  &lt;br /&gt;
* When not in debt, a dilution proposal is created, and club influence holders can vote it down.  This ensures that lost wallet keys won&#039;t make clubs permanently lost.&lt;br /&gt;
* The amount of new influence to be created in an event or proposal is 5%&lt;br /&gt;
* The amount of SVC raised is whatever users of the game bid for that 5% (put into the dilution pool).  For these end-of-season dilutions, there is no minimum raise specified.  It could be that one user gets all the 5% for just 1 SVC, but market forces will prevent that (and ensure a &amp;quot;fair value&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
===A new season is created.===&lt;/div&gt;</summary>
		<author><name>Tyki</name></author>
	</entry>
	<entry>
		<id>https://wiki.soccerverse.com/index.php?title=Backend_Game_Logic&amp;diff=64</id>
		<title>Backend Game Logic</title>
		<link rel="alternate" type="text/html" href="https://wiki.soccerverse.com/index.php?title=Backend_Game_Logic&amp;diff=64"/>
		<updated>2025-03-24T22:40:52Z</updated>

		<summary type="html">&lt;p&gt;Tyki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki walks through all of the backend game logic (GSP), starting at the game world&#039;s creation and the creation of its first season, all the way through a season&#039;s worth of fixtures, the end of season event and then the creation of a new season.&lt;br /&gt;
&lt;br /&gt;
The match day process flow of pre‑match, match and post match is walked through as well as the daily player fitness increases.&lt;br /&gt;
&lt;br /&gt;
Some source code snippets are provided in certain places to help explain the formulas that are used.&lt;br /&gt;
&lt;br /&gt;
==When the game world is created==&lt;br /&gt;
&lt;br /&gt;
For each club, the average rating of the best 11 players is calculated and stored.  &lt;br /&gt;
This value is immutable and later used for things such as calculating the average player rating of the league, which is also immutable.&lt;br /&gt;
&lt;br /&gt;
It&#039;s stored as:&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;clubs.rating_start&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Then the first season is created.&lt;br /&gt;
&lt;br /&gt;
==Creating a new season==&lt;br /&gt;
&lt;br /&gt;
* Each club&#039;s transfer limits are reset for transfer in and transfer out.&lt;br /&gt;
* Each club&#039;s form is reset.&lt;br /&gt;
* Players&#039; form, yellow cards, red cards, yellow/red cards, banned and stamina are all reset.&lt;br /&gt;
* A player&#039;s wage for the season is calculated based on his current rating.  &lt;br /&gt;
If the player rating is below 60 then the wage is calculated using the formula below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if (rating &amp;lt; 60)&lt;br /&gt;
    return (5 * rating) * moneybase_multiplier;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where &#039;&#039;moneybase_multiplier&#039;&#039; is set to be 50,000 when the game world is created.&lt;br /&gt;
&lt;br /&gt;
If the player value is 60 rated or above then it uses the formula below, basically starting at 1500 then increasing by 20% more than the previous rating.  &lt;br /&gt;
It uses the formula below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AmountT wage = 300;&lt;br /&gt;
&lt;br /&gt;
for(int ic1 = 1; ic1 &amp;lt;= (rating-60); ic1++)&lt;br /&gt;
{&lt;br /&gt;
    wage = ((wage * 12 ) / 10);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
return wage * moneybase_multiplier;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A grid of all the wages to ratings can be seen in the table below:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Rating !! Wage&lt;br /&gt;
|-&lt;br /&gt;
| 50 || 1,250&lt;br /&gt;
|-&lt;br /&gt;
| 51 || 1,275&lt;br /&gt;
|-&lt;br /&gt;
| 52 || 1,300&lt;br /&gt;
|-&lt;br /&gt;
| 53 || 1,325&lt;br /&gt;
|-&lt;br /&gt;
| 54 || 1,350&lt;br /&gt;
|-&lt;br /&gt;
| 55 || 1,375&lt;br /&gt;
|-&lt;br /&gt;
| 56 || 1,400&lt;br /&gt;
|-&lt;br /&gt;
| 57 || 1,425&lt;br /&gt;
|-&lt;br /&gt;
| 58 || 1,450&lt;br /&gt;
|-&lt;br /&gt;
| 59 || 1,475&lt;br /&gt;
|-&lt;br /&gt;
| 60 || 1,500&lt;br /&gt;
|-&lt;br /&gt;
| 61 || 1,800&lt;br /&gt;
|-&lt;br /&gt;
| 62 || 2,160&lt;br /&gt;
|-&lt;br /&gt;
| 63 || 2,592&lt;br /&gt;
|-&lt;br /&gt;
| 64 || 3,110&lt;br /&gt;
|-&lt;br /&gt;
| 65 || 3,732&lt;br /&gt;
|-&lt;br /&gt;
| 66 || 4,479&lt;br /&gt;
|-&lt;br /&gt;
| 67 || 5,375&lt;br /&gt;
|-&lt;br /&gt;
| 68 || 6,450&lt;br /&gt;
|-&lt;br /&gt;
| 69 || 7,740&lt;br /&gt;
|-&lt;br /&gt;
| 70 || 9,288&lt;br /&gt;
|-&lt;br /&gt;
| 71 || 11,145&lt;br /&gt;
|-&lt;br /&gt;
| 72 || 13,374&lt;br /&gt;
|-&lt;br /&gt;
| 73 || 16,049&lt;br /&gt;
|-&lt;br /&gt;
| 74 || 19,259&lt;br /&gt;
|-&lt;br /&gt;
| 75 || 23,111&lt;br /&gt;
|-&lt;br /&gt;
| 76 || 27,733&lt;br /&gt;
|-&lt;br /&gt;
| 77 || 33,279&lt;br /&gt;
|-&lt;br /&gt;
| 78 || 39,935&lt;br /&gt;
|-&lt;br /&gt;
| 79 || 47,922&lt;br /&gt;
|-&lt;br /&gt;
| 80 || 57,506&lt;br /&gt;
|-&lt;br /&gt;
| 81 || 69,008&lt;br /&gt;
|-&lt;br /&gt;
| 82 || 82,809&lt;br /&gt;
|-&lt;br /&gt;
| 83 || 99,371&lt;br /&gt;
|-&lt;br /&gt;
| 84 || 119,245&lt;br /&gt;
|-&lt;br /&gt;
| 85 || 143,094&lt;br /&gt;
|-&lt;br /&gt;
| 86 || 171,713&lt;br /&gt;
|-&lt;br /&gt;
| 87 || 206,056&lt;br /&gt;
|-&lt;br /&gt;
| 88 || 247,267&lt;br /&gt;
|-&lt;br /&gt;
| 89 || 296,720&lt;br /&gt;
|-&lt;br /&gt;
| 90 || 356,064&lt;br /&gt;
|-&lt;br /&gt;
| 91 || 427,277&lt;br /&gt;
|-&lt;br /&gt;
| 92 || 512,733&lt;br /&gt;
|-&lt;br /&gt;
| 93 || 615,279&lt;br /&gt;
|-&lt;br /&gt;
| 94 || 738,335&lt;br /&gt;
|-&lt;br /&gt;
| 95 || 886,002&lt;br /&gt;
|-&lt;br /&gt;
| 96 || 1,063,203&lt;br /&gt;
|-&lt;br /&gt;
| 97 || 1,275,843&lt;br /&gt;
|-&lt;br /&gt;
| 98 || 1,531,012&lt;br /&gt;
|-&lt;br /&gt;
| 99 || 1,837,214&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* Each player&#039;s value is calculated and updated at the start of each season.&lt;br /&gt;
&lt;br /&gt;
It uses the formula below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AmountT players_value = wage * multiplier;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where &#039;&#039;multiplier&#039;&#039; is set to be 75.  &lt;br /&gt;
So the value of a player is 75 weeks of his wages.&lt;br /&gt;
&lt;br /&gt;
If the player is over 22 years old, then for each year of his age he loses 10% of his value compared to the previous year.&lt;br /&gt;
&lt;br /&gt;
This stops when a player reaches 40 years of age, then players aged 40 and above are all valued the same as a 40 year old player.  &lt;br /&gt;
See the formula below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if(players_age &amp;gt; 22)&lt;br /&gt;
{&lt;br /&gt;
    if(players_age &amp;gt; 40)&lt;br /&gt;
        players_age = 40;&lt;br /&gt;
  &lt;br /&gt;
    for(int ic1 = 23; ic1 &amp;lt;= (players_age); ic1++)&lt;br /&gt;
    {&lt;br /&gt;
        players_value = (players_value * 9) / 10;&lt;br /&gt;
    }             &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Players&#039; fitness is reset to be between 85–100, using the formula below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
const int fitness = 85 + rand_get_mod(15);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Creating all the competitions==&lt;br /&gt;
&lt;br /&gt;
The competitions are created for the domestic, continental and world tournaments.&lt;br /&gt;
&lt;br /&gt;
Each country has a domestic cup and every club in the country is put into the cup. For the first round it is possible that the number of teams in the cup are not a power of 2, which means some clubs will not have an opponent and will need a bye to the next round.  &lt;br /&gt;
See the formula below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int num_dummy_teams = 0;&lt;br /&gt;
if (round == 1)&lt;br /&gt;
{&lt;br /&gt;
    const int num_teams_needed = (1 &amp;lt;&amp;lt; num_rounds);&lt;br /&gt;
    num_dummy_teams = num_teams_needed - num_teams;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The leagues are created and the correct teams are put into them for each domestic league and the continental group stages.&lt;br /&gt;
&lt;br /&gt;
If it is the first season then the clubs that go into all the domestic leagues, continental groups and the world club cup are pre‑defined and provided in a data file.&lt;br /&gt;
&lt;br /&gt;
If it is not the first season then the clubs that go into the domestic leagues are based upon the previous seasons with any promotion and relegations factored in.&lt;br /&gt;
&lt;br /&gt;
The continental groups will have the winners of all the previous season&#039;s domestic leagues put into the group stage. One spot is allocated for each country apart from ENG, GER, ESP, RUS, JPN and SK who each get 2 spots.&lt;br /&gt;
&lt;br /&gt;
The world club cup will have the winners of the previous season&#039;s four continental competitions placed in it.&lt;br /&gt;
&lt;br /&gt;
==Setup the Economies for the Domestic Leagues and the Continental Competitions==&lt;br /&gt;
&lt;br /&gt;
The average league attendance for each league and the average player rating of the clubs in the league are both stored.  &lt;br /&gt;
See the formula below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int ave_league_attendance;&lt;br /&gt;
int ave_club_rating_start;&lt;br /&gt;
&lt;br /&gt;
const int ave_league_attendance = league_attendance / num_teams;&lt;br /&gt;
const int ave_club_rating_start = league_rating / num_teams;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These values are immutable and all future seasons use the same values.&lt;br /&gt;
&lt;br /&gt;
At the start of the first season, each club starts off with a balance that would be enough to pay half a season&#039;s worth of its wages.  &lt;br /&gt;
See the formula below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int num_gameweek_wages_for_club_balance = (num_rounds * 5000 / 10000;&lt;br /&gt;
AmountT start_balance = club_wages * num_gameweek_wages_for_club_balance;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When the first season is created, the following values are calculated for each domestic league and continental competition: ticket cost, TV money and prize money pot. As below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AmountT ticket_cost;&lt;br /&gt;
AmountT tv_money;&lt;br /&gt;
AmountT prize_money_pot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These values are immutable and all future seasons use the same values.&lt;br /&gt;
&lt;br /&gt;
A season&#039;s worth of income for each domestic league is calculated by adding up a season&#039;s worth of outgoings for all the clubs in the league, which is the league&#039;s wage bill.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
league_wages += (league_wages * 500) / 10000;   //inflation rate&lt;br /&gt;
&lt;br /&gt;
AmountT weekly_ticket_pot = (league_wages * gate_reciepts_percentage) / 10000;&lt;br /&gt;
AmountT weekly_tv_pot = (league_wages * tv_percentage) / 10000;&lt;br /&gt;
int weekly_tickets_sold = league_attendance / 2; //halve games played at home&lt;br /&gt;
&lt;br /&gt;
const AmountT ticket_price = weekly_ticket_pot / weekly_tickets_sold;&lt;br /&gt;
const AmountT weekly_tv_money = weekly_tv_pot / num_teams;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The income is set to match the outgoings so that by the end of the season if all the clubs&#039; balances were added up, it would be around the same as at the start of a season (assuming no transfers had taken place).&lt;br /&gt;
&lt;br /&gt;
A 5% inflation rate is added to the income so that there is a little extra money for each of the clubs.&lt;br /&gt;
&lt;br /&gt;
The income is split 50/50 between TV revenue and Gate receipts (which is further split into sponsorship, merchandise). The ticket price for the league is calculated based on the number of fans expected to attend all the matches in a season.&lt;br /&gt;
&lt;br /&gt;
The prize money pot for the league, which is distributed at the end of the season, is calculated by taking 12% of a season&#039;s worth of the league&#039;s wages.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int num_gameweek_wages_for_prize_pot = (num_rounds * 1200) / 10000;    &lt;br /&gt;
AmountT season_prize_money_pot = league_wages * num_gameweek_wages_for_prize_pot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the continental competitions, the same income calculation is done for each of the group stage leagues. However, the group with the highest TV Revenue, Ticket Price and Prize Money Pot within a continent is then chosen to be used for all the other groups too.&lt;br /&gt;
&lt;br /&gt;
As previously mentioned, these values are all permanently stored and used for all the future seasons. This means that the season&#039;s income is always the same for each league and anchored around how the leagues&#039; outgoings were (its wage bill) at the start of the game.&lt;br /&gt;
&lt;br /&gt;
==Schedules==&lt;br /&gt;
&lt;br /&gt;
The schedule for the game world as a whole will have 45 gameweeks, each game week falling on Saturdays and Wednesdays.&lt;br /&gt;
&lt;br /&gt;
All leagues play their first game at the same time and their last game at the same date. As leagues all have a different number of clubs in them, they also have different numbers of fixtures during a season. Some leagues will have a few Wednesdays off, to spread the matches evenly.&lt;br /&gt;
&lt;br /&gt;
Some gameweeks will have more than one match played in them as there could be cup games, either domestic, continental or world cup on a Monday.&lt;br /&gt;
&lt;br /&gt;
The schedule can be seen here:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Week !! Date !! Weekday !! Competition !! Match Day !! &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || 15.07.2024 || Monday || &#039;&#039;&#039;BREAK&#039;&#039;&#039; ||  || bye round in code&lt;br /&gt;
|-&lt;br /&gt;
|  || 17.07.2024 || Wednesday || &#039;&#039;&#039;BREAK&#039;&#039;&#039; ||  || bye round in code&lt;br /&gt;
|-&lt;br /&gt;
|  || 20.07.2024 || Saturday || League || 1 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || 22.07.2024 || Monday || Continental 1 ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 24.07.2024 || Wednesday || League || 2 || &lt;br /&gt;
|-&lt;br /&gt;
|  || 27.07.2024 || Saturday || League || 3 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || 29.07.2024 || Monday || Continental 2 ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 31.07.2024 || Wednesday || League || 4 || bye round league&lt;br /&gt;
|-&lt;br /&gt;
|  || 03.08.2024 || Saturday || League || 5 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || 05.08.2024 || Monday || Cup1 ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 07.08.2024 || Wednesday || League || 6 || bye round league&lt;br /&gt;
|-&lt;br /&gt;
|  || 10.08.2024 || Saturday || League || 7 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || 12.08.2024 || Monday || Continental 3 ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 14.08.2024 || Wednesday || League || 8 || bye round league&lt;br /&gt;
|-&lt;br /&gt;
|  || 17.08.2024 || Saturday || League || 9 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || 19.08.2024 || Monday || Continental 4 ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 21.08.2024 || Wednesday || League || 10 || bye round league&lt;br /&gt;
|-&lt;br /&gt;
|  || 24.08.2024 || Saturday || League || 11 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || 26.08.2024 || Monday || Continental 5 ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 28.08.2024 || Wednesday || League || 12 || bye round league&lt;br /&gt;
|-&lt;br /&gt;
|  || 31.08.2024 || Saturday || League || 13 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || 02.09.2024 || Monday || Cup2 ||  || bye round cup&lt;br /&gt;
|-&lt;br /&gt;
|  || 04.09.2024 || Wednesday || League || 14 || bye round league&lt;br /&gt;
|-&lt;br /&gt;
|  || 07.09.2024 || Saturday || League || 15 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || 09.09.2024 || Monday || Continental 6 ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 11.09.2024 || Wednesday || League || 16 || bye round league&lt;br /&gt;
|-&lt;br /&gt;
|  || 14.09.2024 || Saturday || League || 17 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || 16.09.2024 || Monday || Continental 7 ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 18.09.2024 || Wednesday || League || 18 || bye round league&lt;br /&gt;
|-&lt;br /&gt;
|  || 21.09.2024 || Saturday || League || 19 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || 23.09.2024 || Monday || Cup3 ||  || bye round cup&lt;br /&gt;
|-&lt;br /&gt;
|  || 25.09.2024 || Wednesday || League || 20 || &lt;br /&gt;
|-&lt;br /&gt;
|  || 28.09.2024 || Saturday || League || 21 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || 30.09.2024 || Monday || Continental 8 ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 02.10.2024 || Wednesday || League || 22 || bye round league&lt;br /&gt;
|-&lt;br /&gt;
|  || 05.10.2024 || Saturday || League || 23 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || 07.10.2024 || Monday || Cup4 ||  || bye round cup&lt;br /&gt;
|-&lt;br /&gt;
|  || 09.10.2024 || Wednesday || League || 24 || &lt;br /&gt;
|-&lt;br /&gt;
|  || 12.10.2024 || Saturday || League || 25 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || 14.10.2024 || Monday || Continental 9 ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 16.10.2024 || Wednesday || League || 26 || bye round league&lt;br /&gt;
|-&lt;br /&gt;
|  || 19.10.2024 || Saturday || League || 27 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || 21.10.2024 || Monday || Cup5 ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 23.10.2024 || Wednesday || League || 28 || &lt;br /&gt;
|-&lt;br /&gt;
|  || 26.10.2024 || Saturday || League || 29 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || 28.10.2024 || Monday || Continental 10 ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 30.10.2024 || Wednesday || League || 30 || bye round league&lt;br /&gt;
|-&lt;br /&gt;
|  || 02.11.2024 || Saturday || League || 31 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || 04.11.2024 || Monday || Cup6 ||  || bye round cup&lt;br /&gt;
|-&lt;br /&gt;
|  || 06.11.2024 || Wednesday || League || 32 || &lt;br /&gt;
|-&lt;br /&gt;
|  || 09.11.2024 || Saturday || League || 33 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || 11.11.2024 || Monday || Club World 1 ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 13.11.2024 || Wednesday || Club World 2 ||  || bye round league&lt;br /&gt;
|-&lt;br /&gt;
|  || 16.11.2024 || Saturday || League || 34 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || 18.11.2024 || Monday || Cup7 ||  || bye round cup&lt;br /&gt;
|-&lt;br /&gt;
|  || 20.11.2024 || Wednesday || League || 35 || &lt;br /&gt;
|-&lt;br /&gt;
|  || 23.11.2024 || Saturday || League || 36 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || 25.11.2024 || Monday || Continental 1/16 ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 27.10.2024 || Wednesday || League || 37 || &lt;br /&gt;
|-&lt;br /&gt;
|  || 30.11.2024 || Saturday || League || 38 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21&#039;&#039;&#039; || 02.12.2024 || Monday || Cup8 ||  || bye round cup&lt;br /&gt;
|-&lt;br /&gt;
|  || 04.12.2024 || Wednesday || League || 39 || &lt;br /&gt;
|-&lt;br /&gt;
|  || 07.12.2024 || Saturday || League || 40 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;22&#039;&#039;&#039; || 09.12.2024 || Monday || Continental QF ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 11.12.2024 || Wednesday || League || 41 || &lt;br /&gt;
|-&lt;br /&gt;
|  || 14.12.2024 || Saturday || League || 42 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || 16.12.2024 || Monday || Continental SF ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 18.12.2024 || Wednesday || League || 43 || &lt;br /&gt;
|-&lt;br /&gt;
|  || 21.12.2024 || Saturday || League || 44 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24&#039;&#039;&#039; || 23.12.2024 || Monday || Cup9 ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 25.12.2024 || Wednesday || League || 45 || &lt;br /&gt;
|-&lt;br /&gt;
|  || 28.12.2024 || Saturday || Continental F ||  || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || 30.12.2024 || Monday || &#039;&#039;&#039;BREAK&#039;&#039;&#039; ||  || bye round in code&lt;br /&gt;
|-&lt;br /&gt;
|  || 01.01.2025 || Wednesday || &#039;&#039;&#039;BREAK&#039;&#039;&#039; ||  || bye round in code&lt;br /&gt;
|-&lt;br /&gt;
|  || 04.01.2025 || Saturday || &#039;&#039;&#039;BREAK&#039;&#039;&#039; ||  || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1/26&#039;&#039;&#039; || 06.01.2025 || Monday || &#039;&#039;&#039;BREAK&#039;&#039;&#039; ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 08.01.2025 || Wednesday || &#039;&#039;&#039;BREAK&#039;&#039;&#039; ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 11.01.2025 || Saturday || League || 1 || &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each season will start on either the second Saturday of January or the second Saturday of July:  &lt;br /&gt;
See the dates for the first 10 seasons:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Season 1:  &lt;br /&gt;
    start: 2025-1-11 0:0:0 (1736553600)  &lt;br /&gt;
    end:   2025-7-12 0:0:0 (1752278400)  &lt;br /&gt;
    first turn: 2025-1-18 6:0:0 (1737180000)  &lt;br /&gt;
    last turn:  2025-6-29 0:0:0 (1751155200)  &lt;br /&gt;
Season 2:  &lt;br /&gt;
    start: 2025-7-12 0:0:0 (1752278400)  &lt;br /&gt;
    end:   2026-1-10 0:0:0 (1768003200)  &lt;br /&gt;
    first turn: 2025-7-19 6:0:0 (1752904800)  &lt;br /&gt;
    last turn:  2025-12-28 0:0:0 (1766880000)  &lt;br /&gt;
Season 3:  &lt;br /&gt;
    start: 2026-1-10 0:0:0 (1768003200)  &lt;br /&gt;
    end:   2026-7-11 0:0:0 (1783728000)  &lt;br /&gt;
    first turn: 2026-1-17 6:0:0 (1768629600)  &lt;br /&gt;
    last turn:  2026-6-28 0:0:0 (1782604800)  &lt;br /&gt;
Season 4:  &lt;br /&gt;
    start: 2026-7-11 0:0:0 (1783728000)  &lt;br /&gt;
    end:   2027-1-9 0:0:0 (1799452800)  &lt;br /&gt;
    first turn: 2026-7-18 6:0:0 (1784354400)  &lt;br /&gt;
    last turn:  2026-12-27 0:0:0 (1798329600)  &lt;br /&gt;
Season 5:  &lt;br /&gt;
    start: 2027-1-9 0:0:0 (1799452800)  &lt;br /&gt;
    end:   2027-7-10 0:0:0 (1815177600)  &lt;br /&gt;
    first turn: 2027-1-16 6:0:0 (1800079200)  &lt;br /&gt;
    last turn:  2027-6-27 0:0:0 (1814054400)  &lt;br /&gt;
Season 6:  &lt;br /&gt;
    start: 2027-7-10 0:0:0 (1815177600)  &lt;br /&gt;
    end:   2028-1-8 0:0:0 (1830902400)  &lt;br /&gt;
    first turn: 2027-7-17 6:0:0 (1815804000)  &lt;br /&gt;
    last turn:  2027-12-26 0:0:0 (1829779200)  &lt;br /&gt;
Season 7:  &lt;br /&gt;
    start: 2028-1-8 0:0:0 (1830902400)  &lt;br /&gt;
    end:   2028-7-8 0:0:0 (1846627200)  &lt;br /&gt;
    first turn: 2028-1-15 6:0:0 (1831528800)  &lt;br /&gt;
    last turn:  2028-6-25 0:0:0 (1845504000)  &lt;br /&gt;
Season 8:  &lt;br /&gt;
    start: 2028-7-8 0:0:0 (1846627200)  &lt;br /&gt;
    end:   2029-1-6 0:0:0 (1862352000)  &lt;br /&gt;
    first turn: 2028-7-15 6:0:0 (1847253600)  &lt;br /&gt;
    last turn:  2028-12-24 0:0:0 (1861228800)  &lt;br /&gt;
Season 9:  &lt;br /&gt;
    start: 2029-1-6 0:0:0 (1862352000)  &lt;br /&gt;
    end:   2029-7-7 0:0:0 (1878076800)  &lt;br /&gt;
    first turn: 2029-1-13 6:0:0 (1862978400)  &lt;br /&gt;
    last turn:  2029-6-24 0:0:0 (1876953600)  &lt;br /&gt;
Season 10:  &lt;br /&gt;
    start: 2029-7-7 0:0:0 (1878076800)  &lt;br /&gt;
    end:   2030-1-5 0:0:0 (1893801600)  &lt;br /&gt;
    first turn: 2029-7-14 6:0:0 (1878703200)  &lt;br /&gt;
    last turn:  2029-12-23 0:0:0 (1892678400)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Stadium Building and Fanbase Changes==&lt;br /&gt;
&lt;br /&gt;
Under certain circumstances the stadiums will auto build a little bit at the start of each season, aiming to have a stadium capacity target of either the club&#039;s fanbase + 30% or the average attendance of the league + 30%, whichever is smaller.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int target_attendance;&lt;br /&gt;
if (ave_attendance &amp;lt; fans_current)&lt;br /&gt;
    target_attendance = (ave_attendance * 130) / 100;&lt;br /&gt;
else&lt;br /&gt;
    target_attendance = (fans_current * 130) / 100;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the current size of the stadium is smaller than the target attendance then seat capacity will be added somewhere between the current size and the target. Note, this will not happen if the number of new seats to be added is less than 200.  &lt;br /&gt;
See the formula below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int new_size = stadium_size_current;&lt;br /&gt;
int increase = 0;&lt;br /&gt;
&lt;br /&gt;
if (stadium_size_current &amp;lt; target_attendance)&lt;br /&gt;
{&lt;br /&gt;
    const int max_inc = target_attendance - stadium_size_current;&lt;br /&gt;
    const int min_inc = max_inc / 2;&lt;br /&gt;
&lt;br /&gt;
    increase = min_inc + rand_get_mod(max_inc - min_inc);&lt;br /&gt;
&lt;br /&gt;
    if (increase &amp;gt; 200)&lt;br /&gt;
    {&lt;br /&gt;
        new_size = stadium_size_current + increase;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example:  &lt;br /&gt;
This means that all clubs in the lower leagues have the potential to have a stadium size sufficient enough to hold the average number of fans in the top league + 30%, if they got into that league and stayed in there, allowing them to compete on a more even basis.&lt;br /&gt;
&lt;br /&gt;
Under certain circumstances, at the start of each season, the fan base can rise and fall depending on if the club has been promoted or relegated.&lt;br /&gt;
&lt;br /&gt;
If the club is currently in the division that it started in then its fanbase can rise, tending towards either the league&#039;s average attendance or the fanbase it started the game with, whichever is greater.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if (club_division == division_start)&lt;br /&gt;
{&lt;br /&gt;
    //move to league average or start fanbase (whichever is bigger)&lt;br /&gt;
&lt;br /&gt;
    if (fans_start &amp;gt; ave_attendance)&lt;br /&gt;
        target_fanbase = fans_start;&lt;br /&gt;
    else&lt;br /&gt;
        target_fanbase = ave_attendance;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the club is not in the division that it started in, then it has either been promoted or relegated and its target fanbase will change accordingly.  &lt;br /&gt;
See the formula below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
else  //In non-starting league&lt;br /&gt;
{&lt;br /&gt;
    if (fans_start &amp;gt; ave_attendance)&lt;br /&gt;
        target_fanbase = fans_start - (fans_start - ave_attendance) / 2;&lt;br /&gt;
    else&lt;br /&gt;
        target_fanbase = ave_attendance;&lt;br /&gt;
&lt;br /&gt;
    if (club_division &amp;gt; division_start)&lt;br /&gt;
    {&lt;br /&gt;
        //got relegated&lt;br /&gt;
    }&lt;br /&gt;
    else if (club_division &amp;lt; division_start)&lt;br /&gt;
    {&lt;br /&gt;
        if (target_fanbase &amp;lt; fans_start)&lt;br /&gt;
            target_fanbase = fans_start;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each season the fan base will tend from its current fan base towards its target by 50%.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int new_attendance = fans_current;&lt;br /&gt;
if (fans_current &amp;gt; target_fanbase)  //shrink it&lt;br /&gt;
    new_attendance = fans_current - (fans_current - target_fanbase) / 2;&lt;br /&gt;
if (fans_current &amp;lt; target_fanbase)  //grow it&lt;br /&gt;
    new_attendance = fans_current + (target_fanbase - fans_current) / 2;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example:  &lt;br /&gt;
If a club had a fanbase of 1000 and got promoted, its fanbase would slowly rise each season until it was at the average fanbase of the league that it is now in. An English division 10 club with a 1000 fanbase could eventually have a fanbase of over 35,000 if it got into and stayed in the English division 1.&lt;br /&gt;
&lt;br /&gt;
As mentioned before, the stadium would also gradually increase its capacity, alongside the fanbase.&lt;br /&gt;
&lt;br /&gt;
==Fitness==&lt;br /&gt;
&lt;br /&gt;
On each matchday, fitness is reduced for each player during the match.&lt;br /&gt;
&lt;br /&gt;
It uses the formula below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
reduce_level = (1 * time_played) / 15;&lt;br /&gt;
new_fitness = start_fitness - reduce_level - rand_get_mod(6);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Basically if he played 90 minutes he would lose (randomly) between 24 and 29 fitness points, which is on average 26/27 a match.  &lt;br /&gt;
Of course if he played less, say 45 minutes, then he would lose half of that, on average.&lt;br /&gt;
&lt;br /&gt;
Then each day at 3am UTC time, fitness increases with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
new_fitness = fitness + 5 + rand_get_mod(5);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So it goes up between 5 and 9 points each day, which is on average 7 a day.&lt;br /&gt;
&lt;br /&gt;
As an example:  &lt;br /&gt;
If a player&#039;s fitness was 100% and he played two league games a week, say Saturday and Wednesday, he would go down 53 points on average (e.g. 26+27) and up 49 a week on average (e.g. plus 7 for 7 days).&lt;br /&gt;
&lt;br /&gt;
Gradually over a season the player will reduce and will need to be rotated. If the club plays in cup games too then they will reduce even faster, so squad rotation is even more important if the club is also aiming to win cups.&lt;br /&gt;
&lt;br /&gt;
Note: A player&#039;s fitness will increase more slowly if he is injured but back in the next two weeks.  &lt;br /&gt;
See below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if (injured &amp;gt; timestamp)&lt;br /&gt;
{&lt;br /&gt;
    fitness += 3 + rand_get_mod(5);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the player is injured for two weeks or more then his fitness will not increase.&lt;br /&gt;
&lt;br /&gt;
==Transfers - Unmanaged Club==&lt;br /&gt;
&lt;br /&gt;
There is logic that runs each day that allows unmanaged clubs to join in the transfer market. &lt;br /&gt;
* Each unmanaged club will have an attempt to either buy or sell 6 times, distributed over a season&lt;br /&gt;
* A club will not make an attempt if it is managed or used its seasons in/out limits&lt;br /&gt;
* The 6 attempts are configurable in a parameter and can even be turned off by setting it at 0.&lt;br /&gt;
		&lt;br /&gt;
&lt;br /&gt;
First, find what the target average rating is that we want a club’s starting 11 players to be (‘target rating’).&lt;br /&gt;
&lt;br /&gt;
This could either be the value that the club started at or the average of the division the club is currently in.  If the club is currently in the division it started in then we use the former, otherwise we use the latter.&lt;br /&gt;
&lt;br /&gt;
Note: This works the same as the target ‘fan base’ used for attendance as clubs are promoted and relegated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Buy Decision===&lt;br /&gt;
&lt;br /&gt;
Find what player position is the most required for the club.&lt;br /&gt;
* prioritise position if below any min position thresholds&lt;br /&gt;
* then prioritise position if below any ideal position thresholds&lt;br /&gt;
* otherwise go for any position other than another GK&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
- is the club&#039;s current average rating less than the ‘target rating’?&lt;br /&gt;
YES&lt;br /&gt;
   bid for player, (‘target rating’ to ‘target rating + 5’), (age 23+)&lt;br /&gt;
&lt;br /&gt;
- has there been a player bid yet?&lt;br /&gt;
NO&lt;br /&gt;
   - is the squad small / below min position limits?&lt;br /&gt;
   YES&lt;br /&gt;
      bid for squad player in required positions (‘target rating’ to ‘target rating - 5’)  (any age)&lt;br /&gt;
   NO&lt;br /&gt;
      bid for squad player in required positions (‘target rating’ to ‘target rating - 5’)  (age &amp;lt; 23) - since the squad is not small we can go for a youth player&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: All bids need to meet the following before being placed:&lt;br /&gt;
* A suitable player is on the market&lt;br /&gt;
* The club has funds to make a bid&lt;br /&gt;
* The clubs squad is not full&lt;br /&gt;
* The club has no current outstanding bids&lt;br /&gt;
* The chosen player has been on the market for at least 1 day  (not implemented)&lt;br /&gt;
&lt;br /&gt;
===Sell Decision===&lt;br /&gt;
&lt;br /&gt;
Find what player positions are above the ideal size for each position then prioritise this position if above any ideal position thresholds&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
- is the club&#039;s current average rating above the ‘target rating’?&lt;br /&gt;
YES&lt;br /&gt;
   List a player, (‘target rating’ to ‘target rating + 5’), (age 23+)&lt;br /&gt;
&lt;br /&gt;
- has there been a player listed yet?&lt;br /&gt;
NO&lt;br /&gt;
   - is the squad large / above all the ideal position thresholds?&lt;br /&gt;
   YES&lt;br /&gt;
      List a squad player from a chosen position (‘target rating’ to ‘target rating - 5’)  (any age)&lt;br /&gt;
   NO&lt;br /&gt;
      List a squad player from a chosen position (‘target rating’ to ‘target rating - 5’)  (age 30+) - since the squad is not large we can go for an older&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: All transfer listings need to meet the following before being placed:&lt;br /&gt;
* The clubs squad is not below the minimum allowed squad size&lt;br /&gt;
* The club has not currently listed any players for sale&lt;br /&gt;
&lt;br /&gt;
==Matchday==&lt;br /&gt;
&lt;br /&gt;
All the fixtures that have not yet played are identified and prepared for processing their matchdays.&lt;br /&gt;
&lt;br /&gt;
For each fixture, the tactics and teamsheets for both teams are processed and validated before the match.&lt;br /&gt;
&lt;br /&gt;
If any player is unhappy then they lose 10% of their rating and if a player is injured or banned then he is considered to be a &amp;quot;dud player&amp;quot; and will not take part in the match.&lt;br /&gt;
&lt;br /&gt;
If the match is a continental competition then the ticket price and TV revenue numbers that are specific to that competition are used. Domestic cups use the ticket price and TV revenue numbers that the home team uses for its domestic league games. Each domestic league has its own ticket price and TV revenue that all clubs in that league use.&lt;br /&gt;
&lt;br /&gt;
==Attendance==&lt;br /&gt;
&lt;br /&gt;
The number of fans that turn up for matches are as follows:&lt;br /&gt;
&lt;br /&gt;
Domestic league and cup games will use the home club&#039;s fanbase, assuming they fit into the home club&#039;s stadium, as the number of fans that will turn up on matchday.&lt;br /&gt;
&lt;br /&gt;
The fanbase does not grow or shrink if you win or lose games; however, after the sixth domestic league game in the season, the attendance for domestic games can increase by up to 30% from its fanbase depending on how high in the table the club is above the middle of the table, and up to 30% less depending on how low the club is from the middle of the table.  &lt;br /&gt;
See the formula below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//change the attendance based on the club&#039;s domestic league position&lt;br /&gt;
if (games_played &amp;gt; 6)&lt;br /&gt;
{&lt;br /&gt;
  int mid_table = num_teams / 2; //Get the league table size and half it.&lt;br /&gt;
&lt;br /&gt;
  //if in top half of table means more fans&lt;br /&gt;
  if (new_position &amp;lt; mid_table)&lt;br /&gt;
  {&lt;br /&gt;
    int units_of_fans = mid_table - new_position;&lt;br /&gt;
    c-&amp;gt;fans = c-&amp;gt;fans + ((c-&amp;gt;fans / 30) * units_of_fans);&lt;br /&gt;
  }&lt;br /&gt;
  else if(new_position &amp;gt; mid_table)  //bottom half of the table means less fans&lt;br /&gt;
  {&lt;br /&gt;
    int units_of_fans = new_position - mid_table;&lt;br /&gt;
    c-&amp;gt;fans = c-&amp;gt;fans - ((c-&amp;gt;fans / 30) * units_of_fans);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If it&#039;s a domestic cup or shield game then they usually get more fans than a league game, so it looks to use either the fan base (with the 30% modifier if applicable) or 75% of the stadium size, whichever is bigger.  &lt;br /&gt;
See the formula below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if((comp_type == COMP_TYPE_NATIONAL_CUP) ||&lt;br /&gt;
   (comp_type == COMP_TYPE_NATIONAL_SHIELD))&lt;br /&gt;
{&lt;br /&gt;
  int minimum_fans = (c-&amp;gt;stadium_size / 4) * 3;&lt;br /&gt;
&lt;br /&gt;
  if (c-&amp;gt;fans &amp;lt; minimum_fans)&lt;br /&gt;
  {&lt;br /&gt;
    c-&amp;gt;fans = minimum_fans - rand_get_mod(100);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Continental and world club cup games almost always have full stadium attendances.&lt;br /&gt;
&lt;br /&gt;
==Tactics Autopick==&lt;br /&gt;
&lt;br /&gt;
If the club has no manager or it has a manager who has submitted invalid tactics, then the autopick will kick in.&lt;br /&gt;
&lt;br /&gt;
Invalid tactics are:&lt;br /&gt;
* Contains at least one player who is injured or match banned.&lt;br /&gt;
* Has no goalkeeper in the goalkeeper position – unless there is a good reason like all the goalkeepers in the squad are injured or banned.&lt;br /&gt;
&lt;br /&gt;
The autopick will randomly choose one of the following formations: 4-4-2, 4-3-3 or 4-5-1 and then find the best possible player for each of the positions in the chosen formation. The player&#039;s fitness will also be taken into consideration when choosing the best players for each position.&lt;br /&gt;
&lt;br /&gt;
==Player Rating Adjustments==&lt;br /&gt;
&lt;br /&gt;
Each player is checked if it is being played in the correct position that it is meant to be played in; for example, a DC in a DC position.&lt;br /&gt;
&lt;br /&gt;
If the player is not in the correct position then he is penalized. The further out of position a player is the more he is penalized. The grid below shows what percentage should be knocked off the player&#039;s goalkeeping, tackling, passing and shooting rating, should he be out of position.  &lt;br /&gt;
See: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
const int g_grid_outta_pos_multi[16][9][7] = {&lt;br /&gt;
{&lt;br /&gt;
    {0, 0, 0, 0, 0, 0, 0}, //G&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40},&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40},&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40},&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40},&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40},&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40},&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40},&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}, //LB&lt;br /&gt;
    {3, 3, 5, 5, 5, 0, 0},&lt;br /&gt;
    {3, 3, 5, 5, 5, 0, 0},&lt;br /&gt;
    {3, 3, 5, 5, 5, 0, 0},&lt;br /&gt;
    {5, 5, 10, 10, 10, 0, 0},&lt;br /&gt;
    {10, 15, 15, 15, 15, 10, 5},&lt;br /&gt;
    {25, 25, 25, 25, 25, 25, 20},&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35}&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}, //CB&lt;br /&gt;
    {5, 0, 0, 0, 0, 0, 5},&lt;br /&gt;
    {5, 0, 0, 0, 0, 0, 5},&lt;br /&gt;
    {10, 10, 5, 5, 5, 10, 10},&lt;br /&gt;
    {10, 10, 5, 5, 5, 10, 10},&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 15},&lt;br /&gt;
    {25, 25, 25, 25, 25, 25, 25},&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35}&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}, //RB&lt;br /&gt;
    {0, 0, 5, 5, 5, 3, 3},&lt;br /&gt;
    {0, 0, 5, 5, 5, 3, 3},&lt;br /&gt;
    {0, 0, 5, 5, 5, 3, 3},&lt;br /&gt;
    {0, 0, 10, 10, 10, 5, 5},&lt;br /&gt;
    {5, 10, 15, 15, 15, 15, 10},&lt;br /&gt;
    {20, 25, 25, 25, 25, 25, 25},&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35}&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}, //DML&lt;br /&gt;
    {10, 10, 15, 15, 15, 5, 5},&lt;br /&gt;
    {10, 10, 15, 15, 15, 5, 5},&lt;br /&gt;
    {2, 2, 2, 2, 1, 0, 0},&lt;br /&gt;
    {2, 2, 2, 2, 1, 0, 0},&lt;br /&gt;
    {3, 3, 3, 3, 2, 0, 0},&lt;br /&gt;
    {15, 15, 15, 15, 10, 5, 5},&lt;br /&gt;
    {25, 25, 25, 25, 25, 25, 25},&lt;br /&gt;
    {25, 25, 25, 25, 25, 25, 25}&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}, //DMC&lt;br /&gt;
    {15, 15, 10, 10, 10, 15, 15},&lt;br /&gt;
    {15, 15, 10, 10, 10, 15, 15},&lt;br /&gt;
    {3, 0, 0, 0, 0, 0, 3},&lt;br /&gt;
    {3, 0, 0, 0, 0, 0, 3},&lt;br /&gt;
    {3, 0, 0, 0, 0, 0, 3},&lt;br /&gt;
    {15, 15, 10, 10, 10, 15, 15},&lt;br /&gt;
    {25, 15, 15, 15, 15, 15, 25},&lt;br /&gt;
    {25, 25, 25, 25, 25, 25, 25}&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}, //DMR&lt;br /&gt;
    {5, 5, 15, 15, 15, 10, 10},&lt;br /&gt;
    {5, 5, 15, 15, 15, 10, 10},&lt;br /&gt;
    {0, 0, 1, 2, 2, 2, 2},&lt;br /&gt;
    {0, 0, 1, 2, 2, 2, 2},&lt;br /&gt;
    {0, 0, 2, 3, 3, 3, 3},&lt;br /&gt;
    {5, 5, 10, 15, 15, 15, 15},&lt;br /&gt;
    {25, 25, 25, 25, 25, 25, 25},&lt;br /&gt;
    {25, 25, 25, 25, 25, 25, 25}&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}, //LM&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 15},&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 15},&lt;br /&gt;
    {5, 5, 5, 5, 4, 0, 0},&lt;br /&gt;
    {3, 3, 3, 3, 2, 0, 0},&lt;br /&gt;
    {1, 1, 1, 1, 1, 0, 0},&lt;br /&gt;
    {3, 3, 3, 3, 2, 0, 0},&lt;br /&gt;
    {10, 10, 10, 10, 10, 10, 10},&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 15}&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}, //CM&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 15},&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 15},&lt;br /&gt;
    {5, 5, 1, 1, 1, 5, 5},&lt;br /&gt;
    {3, 3, 0, 0, 0, 3, 3},&lt;br /&gt;
    {3, 0, 0, 0, 0, 0, 3},&lt;br /&gt;
    {3, 1, 0, 0, 0, 1, 3},&lt;br /&gt;
    {15, 5, 5, 5, 5, 5, 15},&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 15}&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}, //RM&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 15},&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 15},&lt;br /&gt;
    {0, 0, 4, 5, 5, 5, 5},&lt;br /&gt;
    {0, 0, 2, 3, 3, 3, 3},&lt;br /&gt;
    {0, 0, 1, 1, 1, 1, 1},&lt;br /&gt;
    {0, 0, 2, 3, 3, 3, 3},&lt;br /&gt;
    {10, 10, 10, 10, 10, 10, 10},&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 15}&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}, //AML&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {25, 25, 35, 25, 25, 25, 25},&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 10},&lt;br /&gt;
    {5, 5, 5, 5, 5, 0, 0},&lt;br /&gt;
    {5, 5, 3, 3, 1, 0, 0},&lt;br /&gt;
    {5, 5, 3, 3, 1, 0, 0},&lt;br /&gt;
    {10, 10, 10, 10, 5, 3, 3}&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}, //AM&lt;br /&gt;
    {25, 25, 25, 25, 25, 25, 25},&lt;br /&gt;
    {25, 25, 25, 25, 25, 25, 25},&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 15},&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 15},&lt;br /&gt;
    {3, 0, 0, 0, 0, 0, 3},&lt;br /&gt;
    {3, 0, 0, 0, 0, 0, 3},&lt;br /&gt;
    {3, 0, 0, 0, 0, 0, 3},&lt;br /&gt;
    {10, 10, 10, 10, 10, 10, 10}&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}, //AMR&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {25, 25, 35, 25, 25, 25, 25},&lt;br /&gt;
    {10, 15, 15, 15, 15, 15, 15},&lt;br /&gt;
    {0, 0, 5, 5, 5, 5, 5},&lt;br /&gt;
    {0, 0, 1, 3, 3, 5, 5},&lt;br /&gt;
    {0, 0, 1, 3, 3, 5, 5},&lt;br /&gt;
    {3, 3, 5, 10, 10, 10, 10}&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}, //FL&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {25, 25, 25, 25, 25, 25, 25},&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 15},&lt;br /&gt;
    {5, 5, 5, 5, 5, 5, 5},&lt;br /&gt;
    {3, 2, 2, 1, 1, 0, 0},&lt;br /&gt;
    {3, 2, 2, 1, 1, 0, 0}&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}, //FC&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {25, 25, 25, 25, 25, 25, 25},&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 15},&lt;br /&gt;
    {5, 5, 5, 5, 5, 5, 5},&lt;br /&gt;
    {3, 1, 0, 0, 0, 1, 3},&lt;br /&gt;
    {3, 1, 0, 0, 0, 1, 3}&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}, //FR&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {25, 25, 25, 25, 25, 25, 25},&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 15},&lt;br /&gt;
    {5, 5, 5, 5, 5, 5, 5},&lt;br /&gt;
    {0, 0, 1, 1, 2, 3, 3},&lt;br /&gt;
    {0, 0, 1, 1, 2, 3, 3}&lt;br /&gt;
}&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Player ratings are also adjusted when taking into consideration each player&#039;s tempo, tackling style and morale.&lt;br /&gt;
&lt;br /&gt;
The tackling style can be set to be more aggressive, which means they will tackle better but also increase their chances of getting a yellow or red card.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
const int tackling_style_adjuster = 2000;&lt;br /&gt;
&lt;br /&gt;
if(tackling_style == 0)&lt;br /&gt;
{&lt;br /&gt;
    c-&amp;gt;ply[ply_off].rating_aggression = c-&amp;gt;ply[ply_off].rating_aggression - ((c-&amp;gt;ply[ply_off].rating_aggression * tackling_style_adjuster) / 10000);&lt;br /&gt;
    if(c-&amp;gt;ply[ply_off].rating_aggression &amp;lt; 10)&lt;br /&gt;
        c-&amp;gt;ply[ply_off].rating_aggression = 10;&lt;br /&gt;
}&lt;br /&gt;
else if(tackling_style == 2)&lt;br /&gt;
{&lt;br /&gt;
    c-&amp;gt;ply[ply_off].rating_aggression = c-&amp;gt;ply[ply_off].rating_aggression + ((c-&amp;gt;ply[ply_off].rating_aggression * tackling_style_adjuster) / 10000);&lt;br /&gt;
    if(c-&amp;gt;ply[ply_off].rating_aggression &amp;gt; 99)&lt;br /&gt;
        c-&amp;gt;ply[ply_off].rating_aggression = 99;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The tempo sets the player&#039;s rating and stamina. A higher tempo means that the player plays better although his fitness will drop more and faster. A lower tempo does the opposite on the ratings and stamina.&lt;br /&gt;
&lt;br /&gt;
Morale when it is set to &amp;quot;unhappy&amp;quot; will knock 10% off the player&#039;s ratings.&lt;br /&gt;
&lt;br /&gt;
==Match Results==&lt;br /&gt;
&lt;br /&gt;
After the match has been played, certain calculations are made and stored.&lt;br /&gt;
&lt;br /&gt;
Manager (veteran) points are awarded; 3 for a win and 1 for a draw.&lt;br /&gt;
&lt;br /&gt;
===Gate Receipts===&lt;br /&gt;
&lt;br /&gt;
For visual effects, the gate receipts are distributed between gate receipts, sponsorship and merchandise, with the combined total actually going 20% over. This extra 20% is then taken off through ground maintenance.  &lt;br /&gt;
See below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AmountT gate_receipts = (AmountT)((c[0].fans * c[0].ticket_cost) * 0.8);&lt;br /&gt;
const AmountT sponsor = (AmountT)((c[0].fans * c[0].ticket_cost) * 0.3);&lt;br /&gt;
const AmountT merchandise = (AmountT)((c[0].fans * c[0].ticket_cost) * 0.1);&lt;br /&gt;
&lt;br /&gt;
const AmountT ground_maintenance = (AmountT)((c[0].fans * c[0].ticket_cost) * 0.2);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the domestic cup games, continental knockouts and world club cup, the gate receipts are split evenly between the home team and the away team.  &lt;br /&gt;
There is only TV money for the continental knockout games and it is the same amount for both the home and away team.&lt;br /&gt;
&lt;br /&gt;
===Payouts===&lt;br /&gt;
&lt;br /&gt;
Payouts to users are made for the club/player influencers and the manager and agent wages.&lt;br /&gt;
&lt;br /&gt;
If it was a domestic league game then:&lt;br /&gt;
&lt;br /&gt;
* 0.2% of the player&#039;s wage is paid out between its influencers.&lt;br /&gt;
* 0.002% of the player&#039;s wage is paid out to the agent (if the player has one).&lt;br /&gt;
* If the club has a manager that is not locked and is active, then it gets paid a wage of 0.0004% of the club&#039;s TV income.&lt;br /&gt;
* If the club is not in debt before the game then 1% of the club&#039;s income is paid out between its influencers. This comes out of the club&#039;s balance.&lt;br /&gt;
&lt;br /&gt;
If it was a domestic cup, continental game or world club cup then:&lt;br /&gt;
&lt;br /&gt;
* If the club is not in debt before the game then 1% of the club&#039;s income is paid out between its influencers. This comes out of the club&#039;s balance.&lt;br /&gt;
&lt;br /&gt;
====Bonuses====&lt;br /&gt;
&lt;br /&gt;
* If the player starts the match then a starting lineup bonus of 0.05% of the player&#039;s wage is passed onto his influencers. A minimum of 45 minutes need to be played.&lt;br /&gt;
&lt;br /&gt;
* If the player scored then a goal bonus of 0.1% of the player&#039;s wage is passed onto his influencers for each goal scored.&lt;br /&gt;
&lt;br /&gt;
* If the player assists then an assist bonus of 0.1% of the player&#039;s wage is passed onto his influencers for each assist.&lt;br /&gt;
&lt;br /&gt;
* If there was a clean sheet then the players who played in goals and defence who were in the starting eleven get a clean sheet bonus of 0.1% of the player&#039;s wage.  &lt;br /&gt;
The player needs to have played at least 75 minutes of the game.&lt;br /&gt;
&lt;br /&gt;
===Fitness===&lt;br /&gt;
&lt;br /&gt;
Fitness is reduced for all players that played in the match. The more minutes they play the more fitness they lose. Goalkeepers lose a lot less, currently four times less, than outfield players.  &lt;br /&gt;
See below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int reduce_level;&lt;br /&gt;
if (ic2 &amp;gt; 0)&lt;br /&gt;
    reduce_level = (4 * time_played) / 15;&lt;br /&gt;
else&lt;br /&gt;
    reduce_level = (1 * time_played) / 15;&lt;br /&gt;
&lt;br /&gt;
fitness = (fitness &amp;lt; 35 ? 1 : fitness - reduce_level - rand_get_mod(6));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Players can get injured for between 2 and 160 days, although it is weighted with more chance towards the lower end.  &lt;br /&gt;
See below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
injury_days = rand_get_mod( rand_get_mod (rand_get_mod (rand_get_mod (159) + 1) + 1) + 1) + 2;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The more days a player has been injured, the more fitness he will lose.  &lt;br /&gt;
See:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if (injury_days &amp;gt; 120)&lt;br /&gt;
{&lt;br /&gt;
    reduce_level = 40 + rand_get_mod(5);&lt;br /&gt;
}&lt;br /&gt;
else if (injury_days &amp;gt; 80)&lt;br /&gt;
{&lt;br /&gt;
    reduce_level += 30 + rand_get_mod(5);&lt;br /&gt;
}&lt;br /&gt;
else if (injury_days &amp;gt; 40)&lt;br /&gt;
{&lt;br /&gt;
    reduce_level += 10 + rand_get_mod(5);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Cup Final Prize Monday and Payouts==&lt;br /&gt;
&lt;br /&gt;
During the season, cup finals are played for domestic, continental and world tournaments that result in prize money for the clubs and payouts for the influence holders.&lt;br /&gt;
&lt;br /&gt;
* The cup prize pots are calculated at the start of the game by taking the average starting balance of the 10 clubs in the cup that have the biggest starting balance. This value is then used for that cup&#039;s prize pot for all future seasons.&lt;br /&gt;
&lt;br /&gt;
* From the cup prize pot, the club gets 25% if it is the winner and 12.5% if it is the runner up.&lt;br /&gt;
&lt;br /&gt;
* Club influence holders get paid 10% of what a club receives from cup prize money (if any).&lt;br /&gt;
** This 10% is split between all the club influence holders and the more influence a user holds in the club, the bigger portion of the 10% that influencer receives.&lt;br /&gt;
** Note: Some or even all of this will go to the club if the club has a debt&lt;br /&gt;
&lt;br /&gt;
* Each player in the club gets a bonus that equates to 0.1% of a club&#039;s cup prize money&lt;br /&gt;
** The more influence a user holds in the player, the bigger portion of the 0.1% that influence holder will receive.&lt;br /&gt;
** Note: The players rating is further used to determine the payout; e.g. a 50 rated player will get half of that 0,1%&lt;br /&gt;
&lt;br /&gt;
* The manager who wins the cup gets 10 manager points and the manager who is the runner up gets 5 manager points.&lt;br /&gt;
&lt;br /&gt;
==End of Season==&lt;br /&gt;
&lt;br /&gt;
When the last fixture of the season has been played, prize money is paid out to each of the clubs in all of the domestic leagues.&lt;br /&gt;
&lt;br /&gt;
Manager points are awarded; 10 for 1st place in a league and 5 for second place.&lt;br /&gt;
&lt;br /&gt;
The first 50% of the league prize money pot is split equally between the clubs.&lt;br /&gt;
&lt;br /&gt;
The other 50% of the total league prize money pot is then split in a linear way with the 1st placed club getting the most and the last placed club getting the least. For example, a league with 20 clubs would have the percentage split as follows: 1st: 9.5%......10th: 5%.......20th: 0.5%.  &lt;br /&gt;
See the formula below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
const int equal = 100 / num_teams;&lt;br /&gt;
int percdue = (num_teams - position) * equal;&lt;br /&gt;
int potperc = ((percdue &amp;lt;&amp;lt; 8) / 100) * (2 * equal);&lt;br /&gt;
&lt;br /&gt;
if (potperc == 0)&lt;br /&gt;
{&lt;br /&gt;
    percdue = 100 - (num_teams - 1) * equal;&lt;br /&gt;
    potperc = ((percdue &amp;lt;&amp;lt; 8) / 100) * (2 * equal);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
AmountT prize_money = (potperc / 100) * prize_money_pot;&lt;br /&gt;
&lt;br /&gt;
prize_money = ((prize_money &amp;gt;&amp;gt; 8));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
clubs_amount = (prize_money * 5000) / 10000;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
10% of a club&#039;s league prize money is split between all club influencers, provided the club isn&#039;t in debt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
shareholders_amount = prize_money - clubs_amount;&lt;br /&gt;
shareholders_amount = (shareholders_amount * 1000) / 10000;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
0.1% of a club&#039;s league prize money is for the influencers of each player, discounted with the player&#039;s rating.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
const AmountT the_prize_share = (prize_money * 5) / 10000;   &lt;br /&gt;
AmountT sent_prize_share = (the_prize_share * player_rating) / 100;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The season then remains the current season for a few more days, before a new season is created.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Events Between Seasons===&lt;br /&gt;
&lt;br /&gt;
All the other end of season events (such as contracts, auctioning players) is done only at the point when the new season is created and the old season is replaced by it.&lt;br /&gt;
&lt;br /&gt;
A ProcessSeasonEnd script is run&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   void ProcessSeasonEnd (DbHandleData&amp;amp; db, const IdT seasonId)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Taking each of the events within it in turn:&lt;br /&gt;
&lt;br /&gt;
===Updating the player data===&lt;br /&gt;
&lt;br /&gt;
The players database is updated at the end of each season, just before the new season is created.&lt;br /&gt;
&lt;br /&gt;
New players are added, existing players updated and some players retire.&lt;br /&gt;
&lt;br /&gt;
Adding new players:&lt;br /&gt;
* If a player in real life has been playing for a club, then he will get added to the game and to the free bench.&lt;br /&gt;
&lt;br /&gt;
Updating players:&lt;br /&gt;
* Some of the current players will have their rating, position, side and influence price adjusted, all depending on how they have been performing in real life since the last update. Players that didn&#039;t have a date of birth set previously might get it added.&lt;br /&gt;
&lt;br /&gt;
Retiring players:&lt;br /&gt;
* When a player retires he leaves his current club and he goes on the freebench, however, he can not be bought by anyone.&lt;br /&gt;
* All transfer auctions involving the player are cancelled.&lt;br /&gt;
* Users are no longer able to buy influence from the game for this player.  &lt;br /&gt;
* However, users can trade any existing influence in this player between themselves.&lt;br /&gt;
* Since the player can not play for any club, he will not generate any influence payouts.&lt;br /&gt;
&lt;br /&gt;
All players will also have their value (and wage if on the free bench and not on an active contract) recalculated, as they are now a bit older and potentially worth a little less, and also the ratings will have changed.&lt;br /&gt;
&lt;br /&gt;
===Player Contracts===&lt;br /&gt;
&lt;br /&gt;
* Every player who is at a club has his contract reduced by one season.&lt;br /&gt;
* If the contract runs out then the player gets moved to the free bench.&lt;br /&gt;
* However, under certain conditions the contract will get auto-renewed for one season:&lt;br /&gt;
** Players set to &amp;quot;do not renew&amp;quot; by the agent will never be auto-renewed and will definitely leave.&lt;br /&gt;
** If the club is not actively managed or the manager is locked, then all other player contracts are auto-renewed.&lt;br /&gt;
** If the manager is active, up to 2 players may leave, and all others get auto-renewed.&lt;br /&gt;
** Worst players are released first, and only players may leave in whose position the squad has enough other players.&lt;br /&gt;
&lt;br /&gt;
===Clubs in Debt - Auto Auction===&lt;br /&gt;
&lt;br /&gt;
If a club is in debt then it will attempt to sell off the club&#039;s best player not already in an active auction by putting him on the transfer market auction with a minimum bid of 1 SVC.  In the very unlikely event that no player is available (e.g. because all players in the club retired or had their contracts run out) nothing happens.&lt;br /&gt;
&lt;br /&gt;
This auction is started immediately (ending in a week, not started only when a bid is made).  If no bid is made within the week, then the player leaves to the free bench.&lt;br /&gt;
&lt;br /&gt;
There are three reasons for this:&lt;br /&gt;
* It will reduce the club&#039;s wage bill so that its costs are lower in the future.&lt;br /&gt;
* Other clubs may decide to bid and buy the player on the auction system, potentially getting some money into the club.&lt;br /&gt;
* Losing the best player is an incentive to manage the club&#039;s finances properly.&lt;br /&gt;
&lt;br /&gt;
===Fixing Squads===&lt;br /&gt;
&lt;br /&gt;
For all clubs, the overall squad size and structure (minimum players for each position) is fixed.&lt;br /&gt;
&lt;br /&gt;
The minimum parameters can be seen below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
const unsigned MIN_TEAM_SIZE = 21;&lt;br /&gt;
&lt;br /&gt;
const std::map&amp;lt;RequiredSquadPosition, unsigned&amp;gt; MIN_TEAM_PER_POS = {&lt;br /&gt;
  {RequiredSquadPosition::GK, 2},&lt;br /&gt;
  {RequiredSquadPosition::DEFENDER, 5},&lt;br /&gt;
  {RequiredSquadPosition::MIDFIELD, 5},&lt;br /&gt;
  {RequiredSquadPosition::ATTACKER, 3},&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The worst players on the freebench are chosen as long as no other club are bidding for them.  They are transferred for free to the club.&lt;br /&gt;
&lt;br /&gt;
===Players wages and values===&lt;br /&gt;
&lt;br /&gt;
* The values for all players are recalculated, based on possible rating changes and their changes in age for the current season.&lt;br /&gt;
* The wages for all players on the free bench are calculated.  &lt;br /&gt;
&lt;br /&gt;
(Players at a club have their wages fixed until a new contract gets signed.)&lt;br /&gt;
&lt;br /&gt;
===Club Dilution Events (Cash Injection)===&lt;br /&gt;
&lt;br /&gt;
Club dilutions are implemented but not active yet in the code!  This is how they will work once activated:&lt;br /&gt;
&lt;br /&gt;
* When a club is in debt at a season end a dilution event to raise SVC for the club is started immediately.  &lt;br /&gt;
* When not in debt, a dilution proposal is created, and club influence holders can vote it down.  This ensures that lost wallet keys won&#039;t make clubs permanently lost.&lt;br /&gt;
* The amount of new influence to be created in an event or proposal is 5%&lt;br /&gt;
* The amount of SVC raised is whatever users of the game bid for that 5% (put into the dilution pool).  For these end-of-season dilutions, there is no minimum raise specified.  It could be that one user gets all the 5% for just 1 SVC, but market forces will prevent that (and ensure a &amp;quot;fair value&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
===A new season is created.===&lt;/div&gt;</summary>
		<author><name>Tyki</name></author>
	</entry>
	<entry>
		<id>https://wiki.soccerverse.com/index.php?title=Trading,_Economy_and_Gameplay&amp;diff=63</id>
		<title>Trading, Economy and Gameplay</title>
		<link rel="alternate" type="text/html" href="https://wiki.soccerverse.com/index.php?title=Trading,_Economy_and_Gameplay&amp;diff=63"/>
		<updated>2025-03-24T22:38:26Z</updated>

		<summary type="html">&lt;p&gt;Tyki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Trading, Economy and Gameplay =&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
&lt;br /&gt;
This article puts the management side of the game into the background as it will purely look through the lens of playing as a trader.&lt;br /&gt;
&lt;br /&gt;
In this game, users can accumulate digital assets by making trading decisions on club and player influence.  &lt;br /&gt;
&lt;br /&gt;
Clubs and players will experience varying levels of success in the game, which will affect their value and the amount of SVC (the in-game currency) payouts that they make.&lt;br /&gt;
&lt;br /&gt;
== Real Life Player Prediction Game ==&lt;br /&gt;
&lt;br /&gt;
The essence of the game is predicting how football players are going to perform in the real world. &lt;br /&gt;
Linking the real life performance of football players with their in game ratings is a key element of the game.&lt;br /&gt;
The biggest rewards will be from scouting youngsters before they become known future stars and from correctly predicting current stars who have an extended career.&lt;br /&gt;
Users can scout and research players in the real world as little or as much as they like, adding immense depth to the game without the need to add complexity to the product.&lt;br /&gt;
&lt;br /&gt;
== In Game Social Interaction ==&lt;br /&gt;
&lt;br /&gt;
In order to benefit from these predictions, users then need to focus inwards into the game world and what&#039;s going on within it.&lt;br /&gt;
This will require interacting with other users in what effectively boils down to &#039;getting the right player to the right club&#039;.&lt;br /&gt;
This is the case for the club&#039;s influence holders and managers who want to build and maintain the best squads they can, allowing them to win more games and tournaments.&lt;br /&gt;
Also the case for player influence holders who wish to maximize their SVC payouts, and they can appoint agents to be their spokesperson.&lt;br /&gt;
The transfer market and player contracts are the tools for this.  &lt;br /&gt;
 &lt;br /&gt;
== The Trading Side - How it Works ==&lt;br /&gt;
&lt;br /&gt;
Users can yield SVC from influence and sell it to other users.  This is creating a supply side for SVC.&lt;br /&gt;
&lt;br /&gt;
Traders can purchase influence in clubs and players and receive an SVC yield payout from them each matchday. There is also an SVC payout to the club and player influence holders at the end of each tournament, with the amount based on how well the club did in that tournament.&lt;br /&gt;
&lt;br /&gt;
The club and player influence can be sold to other users for an agreed price and from then on the new owner will yield its SVC.&lt;br /&gt;
&lt;br /&gt;
If you purchased club influence, the payout is based on a fixed percentage of the club&#039;s matchday income. This income will increase the better a club performs - more fans, higher incomes in higher leagues and more club prize money.  The income can also decrease from bad performance - less fans, relegation and less prize money.  This is why it is important for the club to appoint a good manager.&lt;br /&gt;
&lt;br /&gt;
The price of the club influence will be priced by the free market and usually on its projected SVC payout over a season.  Future prospects of the club can also come into price consideration, for example looking at its squad - is it full of young and up and coming players?&lt;br /&gt;
&lt;br /&gt;
If you purchased player influence, the payout is a fixed percentage of the player&#039;s current wage.  There will also be payouts every time the player plays in a match, scores, assists or clean sheets (GK &amp;amp; DF), again a fixed percentage of the wage.  &lt;br /&gt;
The players wage will increase as the players rating increases (although only when a new contract is signed).  The player&#039;s rating is linked to his real life performance. The opposite happens if the player&#039;s rating drops. Is this player on the up or going down in real life?&lt;br /&gt;
&lt;br /&gt;
Player influence can be bought from the game with the price set in SVC.  The price is a calculation of what the player can be expected to payout over the remainder of his career plus the yield.  This yield can be negative or positive and is determined if the player plays and gets the playing bonuses.&lt;br /&gt;
&lt;br /&gt;
Player influence can also be bought from other users and when doing so the real life future prospects of the player can also come into the price consideration, as everyone will have a different opinion on the prospects of each player. &lt;br /&gt;
&lt;br /&gt;
There is a fixed maximum amount of SVC that can be yielded from all the club and player influence in a season (note: it can fluctuate slightly).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Users can buy SVC off other users.  This is creating a buy side for SVC.&lt;br /&gt;
&lt;br /&gt;
The main reason to buy SVC is to inject it into clubs to improve their balance. With that the club owners (influence holders) can use it to buy better players.  The motive for this will be to improve the performance of the club in the tournaments, which will increase its income and hence the SVC payouts to the club influence holders.&lt;br /&gt;
&lt;br /&gt;
The game economy and also the core loop of the trading is in effect a farmer consumer model.  The influence holders in clubs and players are farming (yielding SVC) and some of the club owners (also influence holders) will consume SVC by buying it and putting it into clubs.&lt;br /&gt;
&lt;br /&gt;
== Game Economy - How it Works (three views) ==&lt;br /&gt;
&lt;br /&gt;
One way to understand the overall game economy is to view it through the lens of the three sources of a club&#039;s income; matchday, prize money and cash injections.&lt;br /&gt;
&lt;br /&gt;
=== Matchday Income ===&lt;br /&gt;
&lt;br /&gt;
In a season, the new money going into each league is equal to the amount of player wages going out of that league.&lt;br /&gt;
&lt;br /&gt;
The new money is created through club gate receipts and tv revenue.&lt;br /&gt;
&lt;br /&gt;
The money going out is through player wages.&lt;br /&gt;
&lt;br /&gt;
However, the overall amount of money within the game world (and indeed within each club) can fluctuate both up and down over time depending on how the users manage their clubs finances.&lt;br /&gt;
&lt;br /&gt;
The intention is to keep the amount of money in circulation in the clubs more or less the same from season to season, whilst allowing enough liquidity for clubs to operate.&lt;br /&gt;
&lt;br /&gt;
=== Club Prize Money ===&lt;br /&gt;
&lt;br /&gt;
All clubs receive league prize money at the end of the season.&lt;br /&gt;
The amount depends on the quality of the domestic league that the club is in and the position it finished within it.&lt;br /&gt;
There is also cup prize money for winners and second place.  This is for domestic cups, continental cups and the world club cup.&lt;br /&gt;
For most clubs the prize money is not required for it to operate on a week to week basis, such as paying wages.  This access money is not inflationary because all players eventually retire and the clubs therefore will use this money to buy replacements.  The amount of prize money entering the game world is in effect setting the price of the players as there is nothing else for the clubs to spend it on. &lt;br /&gt;
The access money is eventually burnt away as it circulates around the transfer market because of a 5% burning fee on each player deal between clubs and a 100% burning fee when buying from the free bench. &lt;br /&gt;
&lt;br /&gt;
=== User Payouts and Cash Injections ===&lt;br /&gt;
&lt;br /&gt;
Users receive SVC payouts by owning influence in clubs and players.&lt;br /&gt;
&lt;br /&gt;
There is a maximum cap on how much total SVC can be paid out in a season.&lt;br /&gt;
This can be used to buy more influence in clubs and players from other users, put into a club or sold to another user who may wish to put it into his club. &lt;br /&gt;
It is not exactly inflationary because ultimately it will find its way into the clubs and eventually be burnt in transfer deals.&lt;br /&gt;
Jack Walker scenario.  One possibility of this is a user buying a club, buying a lot of SVC that other people have yielded, then putting it all into his club to buy better players. &lt;br /&gt;
There will always be a demand from clubs and their influence holders to have more SVC in their clubs to buy better players.&lt;br /&gt;
&lt;br /&gt;
== User SVC Payout Numbers ==&lt;br /&gt;
&lt;br /&gt;
=== Trader ===&lt;br /&gt;
Selling Influence&lt;br /&gt;
The value of influence in clubs and players can increase (or decrease) based on the demand for that influence in the market. You can make SVC buying and selling influence.&lt;br /&gt;
&lt;br /&gt;
=== Club Influence Payouts ===&lt;br /&gt;
==== Matchday Income ====&lt;br /&gt;
* Club influence holders get paid 1% of the matchday income&lt;br /&gt;
* This 1% is split between all influence holders&lt;br /&gt;
* The more influence you hold in the club, the bigger portion of the 1% you receive&lt;br /&gt;
(applies to domestic league/cup, continental and world club cup games)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;* This comes out of the club&#039;s balance&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;** If the club is in debt before the game then this payout does not happen&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Domestic League Prizes  [Inflation] ====&lt;br /&gt;
* Club influence holders get paid 10% of a club&#039;s league prize money&lt;br /&gt;
* This 10% is split between all influence holders&lt;br /&gt;
* The more influence you hold in the club, the bigger portion of the 10% you receive&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;* Some or even all of this will go to the club if the club has a debt&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;** The clubs % size of the league prize pot depends on where it finished in the league&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== All Cup Prizes  [Inflation] ====&lt;br /&gt;
* Prize money is paid to a club if it either wins the cup or comes second&lt;br /&gt;
* Club influence holders get paid 10% of what a club receives from cup prize money (if any)&lt;br /&gt;
* This 10% is split between all influence holders&lt;br /&gt;
* The more influence you hold in the club, the bigger portion of the 10% you receive&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;* Some or even all of this will go to the club if the club has a debt&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;** From the cup prize pot, the club gets 25% if the winner; 12.5% if the runner up&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Player Influence Payouts ===&lt;br /&gt;
Player influence holders have 4 ways to receive payouts:&lt;br /&gt;
* Matchday player wages&lt;br /&gt;
* Matchday bonuses&lt;br /&gt;
* Domestic league prizes&lt;br /&gt;
* All cup prizes&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;* If a player is not at a club it will not receive a wage (or prize money), and therefore there will be no payouts for that player&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Wages ====&lt;br /&gt;
* Player influence holders get paid 0.2% of the player&#039;s weekly wage&lt;br /&gt;
* This 0.2% is split between all influence holders&lt;br /&gt;
* The more influence you hold in the player, the bigger portion of the 0.2% you receive&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;* The wage is directly linked to the player&#039;s rating and the player&#039;s rating is linked to that player&#039;s real life performance. Therefore players&#039; wages can go up/down (and as a result so can the player influence holder payouts&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Player Bonuses [Inflation] ====&lt;br /&gt;
* Player influence holders receive bonus payouts if their players play, score, assist or have a clean sheet. (applies to all types of fixtures)&lt;br /&gt;
&lt;br /&gt;
* Influence holders receive an additional 0.05% of the player&#039;s weekly wage if that player is in the starting lineup&lt;br /&gt;
(A minimum of 45 minutes needs to be played)&lt;br /&gt;
&lt;br /&gt;
* Player influence holders get paid 0.1% of a players weekly wage for each goal &lt;br /&gt;
* Player influence holders get paid 0.1% of a players weekly wage for each assist&lt;br /&gt;
* Player influence holders get paid 0.1% of a players weekly wage for the goalkeeper and defenders if there was a clean sheet.&lt;br /&gt;
(The player needs to have played at least 75 minutes of the game for a clean sheet bonus)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;* All these bonuses apply to domestic league/cup, continental and world club cup games&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== League Prizes [Inflation] ====&lt;br /&gt;
* Each player in the club gets a bonus that equates to 0.1% of the clubs prize money&lt;br /&gt;
* This 0.1% is split between all influence holders of that player&lt;br /&gt;
* The more influence you hold in the player, the bigger portion of the 0.1% you receive&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;* The players rating is further used to discount the payout; e.g. a 50 rated player will get half of that 0,1%&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;** The clubs % size of the league prize pot depends on where it finished in the league&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Cup/Shield Prizes [Inflation] ====&lt;br /&gt;
* Prize money is paid to a club if it either wins the cup or comes second&lt;br /&gt;
* Each player in the club gets a bonus that equates to 0.1% of a club&#039;s cup prize money&lt;br /&gt;
* This 0.1% is split between all player influence holders&lt;br /&gt;
* The more influence you hold in the player, the bigger portion of the 0.1% you receive&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;* The players rating is further used to determine the payout; e.g. a 50 rated player will get half of that 0,1%&#039;&#039;&amp;lt;br&amp;gt;&lt;br /&gt;
&#039;&#039;** From the cup prize pot, the club gets 25% if the winner; 12.5% if the runner up&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Workers ===&lt;br /&gt;
==== Club Manager ====&lt;br /&gt;
* Managers get paid 0.0004% of the club&#039;s weekly TV money (it&#039;s about 0.0002% of the club&#039;s matchday income on average)&lt;br /&gt;
* You can only be a manager for one club at a time&lt;br /&gt;
* Managers are appointed (and fired) by the club influence holders&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;* If the club&#039;s manager is locked or not active then this payout does not happen&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Player Agent   [Inflation] ====&lt;br /&gt;
* Agents get paid 0.002% of the player&#039;s weekly wage&lt;br /&gt;
* You can be an agent for one or more players at any time&lt;br /&gt;
* Agents are appointed (and replaced) by the player influence holders&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;* If the agent is not active then this payout does not happen&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note: If the user is not active in the game, then he/she will not receive any of these payouts&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Game Theory - Social interaction ==&lt;br /&gt;
&lt;br /&gt;
The basis of being the most successful trader in the game is:&lt;br /&gt;
&lt;br /&gt;
Firstly know your real life football players and who is good or will become good in real life.&lt;br /&gt;
&lt;br /&gt;
Then you need to research into the clubs and player in the game; what clubs are the players at, what are the prospects of those clubs and the players at those clubs.&lt;br /&gt;
&lt;br /&gt;
Finally you need to socially interact with other users in the game to ensure that your best interest is what&#039;s going on with the clubs and players that you hold influence in, to maximize your payouts.&lt;br /&gt;
&lt;br /&gt;
=== Club influence holders will maximise their SVC payouts if: ===&lt;br /&gt;
&lt;br /&gt;
* The club is in a higher division and ends the season as high in the league as possible.&lt;br /&gt;
* Wins a cup or shield&lt;br /&gt;
* Does not go in debt (as a club in debt does not pay its influence holders)&lt;br /&gt;
* Buys and sells players at the right time&lt;br /&gt;
* The club keeps its players happy on the right contracts and playing enough to satisfy agents&lt;br /&gt;
&lt;br /&gt;
=== Player influence holders will maximise their SVC payouts if: ===&lt;br /&gt;
&lt;br /&gt;
* Their player is playing regularly&lt;br /&gt;
* At a club that ends higher in the league&lt;br /&gt;
* Wins cups or shields&lt;br /&gt;
* Players rating goes up (as the wage on a new contract will eventually follow up)&lt;br /&gt;
&lt;br /&gt;
The influence holders can hire people (by voting in managers and agents), to help them manage their interests in their clubs and players.  These are in the form of manager and agent roles.  It is important to hire good people for these roles.&lt;br /&gt;
&lt;br /&gt;
The club&#039;s influence holders can hire managers to run the day to day operations of the club in their best interest; win games, build/maintain the squads, transfer market etc.&lt;br /&gt;
&lt;br /&gt;
The player influence holders can hire agents to ensure the player is at the club that they consider to be in their best interest; on the right contract, playing regularly, in the big tournaments.&lt;br /&gt;
&lt;br /&gt;
=== Managers will maximise their SVC payouts if: ===&lt;br /&gt;
* Manage a club in a higher division or higher paying country&lt;br /&gt;
&lt;br /&gt;
=== Agents will maximise their SVC payouts if: ===&lt;br /&gt;
* Players rating goes up (as the wage on a new contract will follow up)&lt;br /&gt;
&lt;br /&gt;
Below is a link to a video with an interesting explanation on what is game theory:&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=YxmI8QqiQfI What Game Theory Reveals About Life, The Universe, and Everything]&lt;br /&gt;
&lt;br /&gt;
== The Core Transaction ==&lt;br /&gt;
&lt;br /&gt;
If there was one core transaction in the game that affects everything then it is the in-game player transfer market.&lt;br /&gt;
&lt;br /&gt;
All users in the game who hold influence have an interest in having the football players at, what they consider to be, &amp;quot;the right club&amp;quot;.&lt;br /&gt;
  &lt;br /&gt;
Clubs (and their influence holders) want the best players and best young players that they can afford. This will help them do better in tournaments.&lt;br /&gt;
&lt;br /&gt;
Player influence holders will want their players at what they consider to be the best club for the player; which is playing regularly, the club ends up high in the league and wins tournaments (higher payouts).&lt;br /&gt;
&lt;br /&gt;
== Adding Value to the Game Assets ==&lt;br /&gt;
&lt;br /&gt;
The users, or most users, will not be fully aware that the game in its current state (or Era) is just the first phase and it will evolve into a different state (Era) over time. &lt;br /&gt;
&lt;br /&gt;
The economy and the user payouts will be tuned up to &#039;correct&#039; numbers.&lt;br /&gt;
The soccerverse team currently has the control to change game parameters (payouts, inflation rate, prize money). Once the team is happy that all these numbers are balanced and correct, it will give up this control.&lt;br /&gt;
&lt;br /&gt;
Clubs will eventually be able to raise SVC into the clubs by creating and selling influence, creating a stronger demand for SVC.&lt;br /&gt;
&lt;br /&gt;
Restrictions on the transfer market will aim to be removed; e.g. transfers per season, price caps etc, once cheating is harder due to more people playing the game.&lt;br /&gt;
&lt;br /&gt;
All the source code required to run the game will be fully open sourced.&lt;br /&gt;
&lt;br /&gt;
Setup instructions so people can run their own node of the game will be made and released.&lt;br /&gt;
&lt;br /&gt;
This focus on first tuning up the gameplay and economy numbers, then giving up control of the game, passing it to the community through decentralization and open source, will make it all more robust and add more value to their game assets (influence, SVC and user profiles). &lt;br /&gt;
&lt;br /&gt;
The game is also built from the ground up to be fully on-chain, ensuring that the game can not be turned off, ensuring the games assets maintain value.&lt;br /&gt;
&lt;br /&gt;
This state or Era is &#039;Nirvana&#039; for the game and what we are aiming to achieve in the coming seasons.&lt;/div&gt;</summary>
		<author><name>Tyki</name></author>
	</entry>
	<entry>
		<id>https://wiki.soccerverse.com/index.php?title=Backend_Game_Logic&amp;diff=62</id>
		<title>Backend Game Logic</title>
		<link rel="alternate" type="text/html" href="https://wiki.soccerverse.com/index.php?title=Backend_Game_Logic&amp;diff=62"/>
		<updated>2025-03-24T22:37:35Z</updated>

		<summary type="html">&lt;p&gt;Tyki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This wiki walks through all of the backend game logic (GSP), starting at the game world&#039;s creation and the creation of its first season, all the way through a season&#039;s worth of fixtures, the end of season event and then the creation of a new season.&lt;br /&gt;
&lt;br /&gt;
The match day process flow of pre‑match, match and post match is walked through as well as the daily player fitness increases.&lt;br /&gt;
&lt;br /&gt;
Some source code snippets are provided in certain places to help explain the formulas that are used.&lt;br /&gt;
&lt;br /&gt;
==When the game world is created==&lt;br /&gt;
&lt;br /&gt;
For each club, the average rating of the best 11 players is calculated and stored.  &lt;br /&gt;
This value is immutable and later used for things such as calculating the average player rating of the league, which is also immutable.&lt;br /&gt;
&lt;br /&gt;
It&#039;s stored as:&lt;br /&gt;
&lt;br /&gt;
:&#039;&#039;clubs.rating_start&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Then the first season is created.&lt;br /&gt;
&lt;br /&gt;
==Creating a new season==&lt;br /&gt;
&lt;br /&gt;
* Each club&#039;s transfer limits are reset for transfer in and transfer out.&lt;br /&gt;
* Each club&#039;s form is reset.&lt;br /&gt;
* Players&#039; form, yellow cards, red cards, yellow/red cards, banned and stamina are all reset.&lt;br /&gt;
* A player&#039;s wage for the season is calculated based on his current rating.  &lt;br /&gt;
If the player rating is below 60 then the wage is calculated using the formula below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if (rating &amp;lt; 60)&lt;br /&gt;
    return (5 * rating) * moneybase_multiplier;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where &#039;&#039;moneybase_multiplier&#039;&#039; is set to be 50,000 when the game world is created.&lt;br /&gt;
&lt;br /&gt;
If the player value is 60 rated or above then it uses the formula below, basically starting at 1500 then increasing by 20% more than the previous rating.  &lt;br /&gt;
It uses the formula below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AmountT wage = 300;&lt;br /&gt;
&lt;br /&gt;
for(int ic1 = 1; ic1 &amp;lt;= (rating-60); ic1++)&lt;br /&gt;
{&lt;br /&gt;
    wage = ((wage * 12 ) / 10);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
return wage * moneybase_multiplier;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A grid of all the wages to ratings can be seen in the table below:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Rating !! Wage&lt;br /&gt;
|-&lt;br /&gt;
| 50 || 1,250&lt;br /&gt;
|-&lt;br /&gt;
| 51 || 1,275&lt;br /&gt;
|-&lt;br /&gt;
| 52 || 1,300&lt;br /&gt;
|-&lt;br /&gt;
| 53 || 1,325&lt;br /&gt;
|-&lt;br /&gt;
| 54 || 1,350&lt;br /&gt;
|-&lt;br /&gt;
| 55 || 1,375&lt;br /&gt;
|-&lt;br /&gt;
| 56 || 1,400&lt;br /&gt;
|-&lt;br /&gt;
| 57 || 1,425&lt;br /&gt;
|-&lt;br /&gt;
| 58 || 1,450&lt;br /&gt;
|-&lt;br /&gt;
| 59 || 1,475&lt;br /&gt;
|-&lt;br /&gt;
| 60 || 1,500&lt;br /&gt;
|-&lt;br /&gt;
| 61 || 1,800&lt;br /&gt;
|-&lt;br /&gt;
| 62 || 2,160&lt;br /&gt;
|-&lt;br /&gt;
| 63 || 2,592&lt;br /&gt;
|-&lt;br /&gt;
| 64 || 3,110&lt;br /&gt;
|-&lt;br /&gt;
| 65 || 3,732&lt;br /&gt;
|-&lt;br /&gt;
| 66 || 4,479&lt;br /&gt;
|-&lt;br /&gt;
| 67 || 5,375&lt;br /&gt;
|-&lt;br /&gt;
| 68 || 6,450&lt;br /&gt;
|-&lt;br /&gt;
| 69 || 7,740&lt;br /&gt;
|-&lt;br /&gt;
| 70 || 9,288&lt;br /&gt;
|-&lt;br /&gt;
| 71 || 11,145&lt;br /&gt;
|-&lt;br /&gt;
| 72 || 13,374&lt;br /&gt;
|-&lt;br /&gt;
| 73 || 16,049&lt;br /&gt;
|-&lt;br /&gt;
| 74 || 19,259&lt;br /&gt;
|-&lt;br /&gt;
| 75 || 23,111&lt;br /&gt;
|-&lt;br /&gt;
| 76 || 27,733&lt;br /&gt;
|-&lt;br /&gt;
| 77 || 33,279&lt;br /&gt;
|-&lt;br /&gt;
| 78 || 39,935&lt;br /&gt;
|-&lt;br /&gt;
| 79 || 47,922&lt;br /&gt;
|-&lt;br /&gt;
| 80 || 57,506&lt;br /&gt;
|-&lt;br /&gt;
| 81 || 69,008&lt;br /&gt;
|-&lt;br /&gt;
| 82 || 82,809&lt;br /&gt;
|-&lt;br /&gt;
| 83 || 99,371&lt;br /&gt;
|-&lt;br /&gt;
| 84 || 119,245&lt;br /&gt;
|-&lt;br /&gt;
| 85 || 143,094&lt;br /&gt;
|-&lt;br /&gt;
| 86 || 171,713&lt;br /&gt;
|-&lt;br /&gt;
| 87 || 206,056&lt;br /&gt;
|-&lt;br /&gt;
| 88 || 247,267&lt;br /&gt;
|-&lt;br /&gt;
| 89 || 296,720&lt;br /&gt;
|-&lt;br /&gt;
| 90 || 356,064&lt;br /&gt;
|-&lt;br /&gt;
| 91 || 427,277&lt;br /&gt;
|-&lt;br /&gt;
| 92 || 512,733&lt;br /&gt;
|-&lt;br /&gt;
| 93 || 615,279&lt;br /&gt;
|-&lt;br /&gt;
| 94 || 738,335&lt;br /&gt;
|-&lt;br /&gt;
| 95 || 886,002&lt;br /&gt;
|-&lt;br /&gt;
| 96 || 1,063,203&lt;br /&gt;
|-&lt;br /&gt;
| 97 || 1,275,843&lt;br /&gt;
|-&lt;br /&gt;
| 98 || 1,531,012&lt;br /&gt;
|-&lt;br /&gt;
| 99 || 1,837,214&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
* Each player&#039;s value is calculated and updated at the start of each season.&lt;br /&gt;
&lt;br /&gt;
It uses the formula below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AmountT players_value = wage * multiplier;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Where &#039;&#039;multiplier&#039;&#039; is set to be 75.  &lt;br /&gt;
So the value of a player is 75 weeks of his wages.&lt;br /&gt;
&lt;br /&gt;
If the player is over 22 years old, then for each year of his age he loses 10% of his value compared to the previous year.&lt;br /&gt;
&lt;br /&gt;
This stops when a player reaches 40 years of age, then players aged 40 and above are all valued the same as a 40 year old player.  &lt;br /&gt;
See the formula below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if(players_age &amp;gt; 22)&lt;br /&gt;
{&lt;br /&gt;
    if(players_age &amp;gt; 40)&lt;br /&gt;
        players_age = 40;&lt;br /&gt;
  &lt;br /&gt;
    for(int ic1 = 23; ic1 &amp;lt;= (players_age); ic1++)&lt;br /&gt;
    {&lt;br /&gt;
        players_value = (players_value * 9) / 10;&lt;br /&gt;
    }             &lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Players&#039; fitness is reset to be between 85–100, using the formula below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
const int fitness = 85 + rand_get_mod(15);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Creating all the competitions==&lt;br /&gt;
&lt;br /&gt;
The competitions are created for the domestic, continental and world tournaments.&lt;br /&gt;
&lt;br /&gt;
Each country has a domestic cup and every club in the country is put into the cup. For the first round it is possible that the number of teams in the cup are not a power of 2, which means some clubs will not have an opponent and will need a bye to the next round.  &lt;br /&gt;
See the formula below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int num_dummy_teams = 0;&lt;br /&gt;
if (round == 1)&lt;br /&gt;
{&lt;br /&gt;
    const int num_teams_needed = (1 &amp;lt;&amp;lt; num_rounds);&lt;br /&gt;
    num_dummy_teams = num_teams_needed - num_teams;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The leagues are created and the correct teams are put into them for each domestic league and the continental group stages.&lt;br /&gt;
&lt;br /&gt;
If it is the first season then the clubs that go into all the domestic leagues, continental groups and the world club cup are pre‑defined and provided in a data file.&lt;br /&gt;
&lt;br /&gt;
If it is not the first season then the clubs that go into the domestic leagues are based upon the previous seasons with any promotion and relegations factored in.&lt;br /&gt;
&lt;br /&gt;
The continental groups will have the winners of all the previous season&#039;s domestic leagues put into the group stage. One spot is allocated for each country apart from ENG, GER and ESP, who each get 2 spots.&lt;br /&gt;
&lt;br /&gt;
The world club cup will have the winners of the previous season&#039;s four continental competitions placed in it.&lt;br /&gt;
&lt;br /&gt;
==Setup the Economies for the Domestic Leagues and the Continental Competitions==&lt;br /&gt;
&lt;br /&gt;
The average league attendance for each league and the average player rating of the clubs in the league are both stored.  &lt;br /&gt;
See the formula below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int ave_league_attendance;&lt;br /&gt;
int ave_club_rating_start;&lt;br /&gt;
&lt;br /&gt;
const int ave_league_attendance = league_attendance / num_teams;&lt;br /&gt;
const int ave_club_rating_start = league_rating / num_teams;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These values are immutable and all future seasons use the same values.&lt;br /&gt;
&lt;br /&gt;
At the start of the first season, each club starts off with a balance that would be enough to pay half a season&#039;s worth of its wages.  &lt;br /&gt;
See the formula below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int num_gameweek_wages_for_club_balance = (num_rounds * 5000 / 10000;&lt;br /&gt;
AmountT start_balance = club_wages * num_gameweek_wages_for_club_balance;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When the first season is created, the following values are calculated for each domestic league and continental competition: ticket cost, TV money and prize money pot. As below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AmountT ticket_cost;&lt;br /&gt;
AmountT tv_money;&lt;br /&gt;
AmountT prize_money_pot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These values are immutable and all future seasons use the same values.&lt;br /&gt;
&lt;br /&gt;
A season&#039;s worth of income for each domestic league is calculated by adding up a season&#039;s worth of outgoings for all the clubs in the league, which is the league&#039;s wage bill.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
league_wages += (league_wages * 500) / 10000;   //inflation rate&lt;br /&gt;
&lt;br /&gt;
AmountT weekly_ticket_pot = (league_wages * gate_reciepts_percentage) / 10000;&lt;br /&gt;
AmountT weekly_tv_pot = (league_wages * tv_percentage) / 10000;&lt;br /&gt;
int weekly_tickets_sold = league_attendance / 2; //halve games played at home&lt;br /&gt;
&lt;br /&gt;
const AmountT ticket_price = weekly_ticket_pot / weekly_tickets_sold;&lt;br /&gt;
const AmountT weekly_tv_money = weekly_tv_pot / num_teams;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The income is set to match the outgoings so that by the end of the season if all the clubs&#039; balances were added up, it would be around the same as at the start of a season (assuming no transfers had taken place).&lt;br /&gt;
&lt;br /&gt;
A 5% inflation rate is added to the income so that there is a little extra money for each of the clubs.&lt;br /&gt;
&lt;br /&gt;
The income is split 50/50 between TV revenue and Gate receipts (which is further split into sponsorship, merchandise). The ticket price for the league is calculated based on the number of fans expected to attend all the matches in a season.&lt;br /&gt;
&lt;br /&gt;
The prize money pot for the league, which is distributed at the end of the season, is calculated by taking 12% of a season&#039;s worth of the league&#039;s wages.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int num_gameweek_wages_for_prize_pot = (num_rounds * 1200) / 10000;    &lt;br /&gt;
AmountT season_prize_money_pot = league_wages * num_gameweek_wages_for_prize_pot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the continental competitions, the same income calculation is done for each of the group stage leagues. However, the group with the highest TV Revenue, Ticket Price and Prize Money Pot within a continent is then chosen to be used for all the other groups too.&lt;br /&gt;
&lt;br /&gt;
As previously mentioned, these values are all permanently stored and used for all the future seasons. This means that the season&#039;s income is always the same for each league and anchored around how the leagues&#039; outgoings were (its wage bill) at the start of the game.&lt;br /&gt;
&lt;br /&gt;
==Schedules==&lt;br /&gt;
&lt;br /&gt;
The schedule for the game world as a whole will have 45 gameweeks, each game week falling on Saturdays and Wednesdays.&lt;br /&gt;
&lt;br /&gt;
All leagues play their first game at the same time and their last game at the same date. As leagues all have a different number of clubs in them, they also have different numbers of fixtures during a season. Some leagues will have a few Wednesdays off, to spread the matches evenly.&lt;br /&gt;
&lt;br /&gt;
Some gameweeks will have more than one match played in them as there could be cup games, either domestic, continental or world cup on a Monday.&lt;br /&gt;
&lt;br /&gt;
The schedule can be seen here:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Week !! Date !! Weekday !! Competition !! Match Day !! &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1&#039;&#039;&#039; || 15.07.2024 || Monday || &#039;&#039;&#039;BREAK&#039;&#039;&#039; ||  || bye round in code&lt;br /&gt;
|-&lt;br /&gt;
|  || 17.07.2024 || Wednesday || &#039;&#039;&#039;BREAK&#039;&#039;&#039; ||  || bye round in code&lt;br /&gt;
|-&lt;br /&gt;
|  || 20.07.2024 || Saturday || League || 1 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;2&#039;&#039;&#039; || 22.07.2024 || Monday || Continental 1 ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 24.07.2024 || Wednesday || League || 2 || &lt;br /&gt;
|-&lt;br /&gt;
|  || 27.07.2024 || Saturday || League || 3 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;3&#039;&#039;&#039; || 29.07.2024 || Monday || Continental 2 ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 31.07.2024 || Wednesday || League || 4 || bye round league&lt;br /&gt;
|-&lt;br /&gt;
|  || 03.08.2024 || Saturday || League || 5 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;4&#039;&#039;&#039; || 05.08.2024 || Monday || Cup1 ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 07.08.2024 || Wednesday || League || 6 || bye round league&lt;br /&gt;
|-&lt;br /&gt;
|  || 10.08.2024 || Saturday || League || 7 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;5&#039;&#039;&#039; || 12.08.2024 || Monday || Continental 3 ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 14.08.2024 || Wednesday || League || 8 || bye round league&lt;br /&gt;
|-&lt;br /&gt;
|  || 17.08.2024 || Saturday || League || 9 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;6&#039;&#039;&#039; || 19.08.2024 || Monday || Continental 4 ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 21.08.2024 || Wednesday || League || 10 || bye round league&lt;br /&gt;
|-&lt;br /&gt;
|  || 24.08.2024 || Saturday || League || 11 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;7&#039;&#039;&#039; || 26.08.2024 || Monday || Continental 5 ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 28.08.2024 || Wednesday || League || 12 || bye round league&lt;br /&gt;
|-&lt;br /&gt;
|  || 31.08.2024 || Saturday || League || 13 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;8&#039;&#039;&#039; || 02.09.2024 || Monday || Cup2 ||  || bye round cup&lt;br /&gt;
|-&lt;br /&gt;
|  || 04.09.2024 || Wednesday || League || 14 || bye round league&lt;br /&gt;
|-&lt;br /&gt;
|  || 07.09.2024 || Saturday || League || 15 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;9&#039;&#039;&#039; || 09.09.2024 || Monday || Continental 6 ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 11.09.2024 || Wednesday || League || 16 || bye round league&lt;br /&gt;
|-&lt;br /&gt;
|  || 14.09.2024 || Saturday || League || 17 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;10&#039;&#039;&#039; || 16.09.2024 || Monday || Continental 7 ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 18.09.2024 || Wednesday || League || 18 || bye round league&lt;br /&gt;
|-&lt;br /&gt;
|  || 21.09.2024 || Saturday || League || 19 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;11&#039;&#039;&#039; || 23.09.2024 || Monday || Cup3 ||  || bye round cup&lt;br /&gt;
|-&lt;br /&gt;
|  || 25.09.2024 || Wednesday || League || 20 || &lt;br /&gt;
|-&lt;br /&gt;
|  || 28.09.2024 || Saturday || League || 21 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;12&#039;&#039;&#039; || 30.09.2024 || Monday || Continental 8 ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 02.10.2024 || Wednesday || League || 22 || bye round league&lt;br /&gt;
|-&lt;br /&gt;
|  || 05.10.2024 || Saturday || League || 23 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;13&#039;&#039;&#039; || 07.10.2024 || Monday || Cup4 ||  || bye round cup&lt;br /&gt;
|-&lt;br /&gt;
|  || 09.10.2024 || Wednesday || League || 24 || &lt;br /&gt;
|-&lt;br /&gt;
|  || 12.10.2024 || Saturday || League || 25 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;14&#039;&#039;&#039; || 14.10.2024 || Monday || Continental 9 ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 16.10.2024 || Wednesday || League || 26 || bye round league&lt;br /&gt;
|-&lt;br /&gt;
|  || 19.10.2024 || Saturday || League || 27 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;15&#039;&#039;&#039; || 21.10.2024 || Monday || Cup5 ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 23.10.2024 || Wednesday || League || 28 || &lt;br /&gt;
|-&lt;br /&gt;
|  || 26.10.2024 || Saturday || League || 29 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;16&#039;&#039;&#039; || 28.10.2024 || Monday || Continental 10 ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 30.10.2024 || Wednesday || League || 30 || bye round league&lt;br /&gt;
|-&lt;br /&gt;
|  || 02.11.2024 || Saturday || League || 31 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;17&#039;&#039;&#039; || 04.11.2024 || Monday || Cup6 ||  || bye round cup&lt;br /&gt;
|-&lt;br /&gt;
|  || 06.11.2024 || Wednesday || League || 32 || &lt;br /&gt;
|-&lt;br /&gt;
|  || 09.11.2024 || Saturday || League || 33 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;18&#039;&#039;&#039; || 11.11.2024 || Monday || Club World 1 ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 13.11.2024 || Wednesday || Club World 2 ||  || bye round league&lt;br /&gt;
|-&lt;br /&gt;
|  || 16.11.2024 || Saturday || League || 34 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;19&#039;&#039;&#039; || 18.11.2024 || Monday || Cup7 ||  || bye round cup&lt;br /&gt;
|-&lt;br /&gt;
|  || 20.11.2024 || Wednesday || League || 35 || &lt;br /&gt;
|-&lt;br /&gt;
|  || 23.11.2024 || Saturday || League || 36 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;20&#039;&#039;&#039; || 25.11.2024 || Monday || Continental 1/16 ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 27.10.2024 || Wednesday || League || 37 || &lt;br /&gt;
|-&lt;br /&gt;
|  || 30.11.2024 || Saturday || League || 38 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;21&#039;&#039;&#039; || 02.12.2024 || Monday || Cup8 ||  || bye round cup&lt;br /&gt;
|-&lt;br /&gt;
|  || 04.12.2024 || Wednesday || League || 39 || &lt;br /&gt;
|-&lt;br /&gt;
|  || 07.12.2024 || Saturday || League || 40 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;22&#039;&#039;&#039; || 09.12.2024 || Monday || Continental QF ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 11.12.2024 || Wednesday || League || 41 || &lt;br /&gt;
|-&lt;br /&gt;
|  || 14.12.2024 || Saturday || League || 42 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;23&#039;&#039;&#039; || 16.12.2024 || Monday || Continental SF ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 18.12.2024 || Wednesday || League || 43 || &lt;br /&gt;
|-&lt;br /&gt;
|  || 21.12.2024 || Saturday || League || 44 || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;24&#039;&#039;&#039; || 23.12.2024 || Monday || Cup9 ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 25.12.2024 || Wednesday || League || 45 || &lt;br /&gt;
|-&lt;br /&gt;
|  || 28.12.2024 || Saturday || Continental F ||  || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;25&#039;&#039;&#039; || 30.12.2024 || Monday || &#039;&#039;&#039;BREAK&#039;&#039;&#039; ||  || bye round in code&lt;br /&gt;
|-&lt;br /&gt;
|  || 01.01.2025 || Wednesday || &#039;&#039;&#039;BREAK&#039;&#039;&#039; ||  || bye round in code&lt;br /&gt;
|-&lt;br /&gt;
|  || 04.01.2025 || Saturday || &#039;&#039;&#039;BREAK&#039;&#039;&#039; ||  || &lt;br /&gt;
|-&lt;br /&gt;
| &#039;&#039;&#039;1/26&#039;&#039;&#039; || 06.01.2025 || Monday || &#039;&#039;&#039;BREAK&#039;&#039;&#039; ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 08.01.2025 || Wednesday || &#039;&#039;&#039;BREAK&#039;&#039;&#039; ||  || &lt;br /&gt;
|-&lt;br /&gt;
|  || 11.01.2025 || Saturday || League || 1 || &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Each season will start on either the second Saturday of January or the second Saturday of July:  &lt;br /&gt;
See the dates for the first 10 seasons:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Season 1:  &lt;br /&gt;
    start: 2025-1-11 0:0:0 (1736553600)  &lt;br /&gt;
    end:   2025-7-12 0:0:0 (1752278400)  &lt;br /&gt;
    first turn: 2025-1-18 6:0:0 (1737180000)  &lt;br /&gt;
    last turn:  2025-6-29 0:0:0 (1751155200)  &lt;br /&gt;
Season 2:  &lt;br /&gt;
    start: 2025-7-12 0:0:0 (1752278400)  &lt;br /&gt;
    end:   2026-1-10 0:0:0 (1768003200)  &lt;br /&gt;
    first turn: 2025-7-19 6:0:0 (1752904800)  &lt;br /&gt;
    last turn:  2025-12-28 0:0:0 (1766880000)  &lt;br /&gt;
Season 3:  &lt;br /&gt;
    start: 2026-1-10 0:0:0 (1768003200)  &lt;br /&gt;
    end:   2026-7-11 0:0:0 (1783728000)  &lt;br /&gt;
    first turn: 2026-1-17 6:0:0 (1768629600)  &lt;br /&gt;
    last turn:  2026-6-28 0:0:0 (1782604800)  &lt;br /&gt;
Season 4:  &lt;br /&gt;
    start: 2026-7-11 0:0:0 (1783728000)  &lt;br /&gt;
    end:   2027-1-9 0:0:0 (1799452800)  &lt;br /&gt;
    first turn: 2026-7-18 6:0:0 (1784354400)  &lt;br /&gt;
    last turn:  2026-12-27 0:0:0 (1798329600)  &lt;br /&gt;
Season 5:  &lt;br /&gt;
    start: 2027-1-9 0:0:0 (1799452800)  &lt;br /&gt;
    end:   2027-7-10 0:0:0 (1815177600)  &lt;br /&gt;
    first turn: 2027-1-16 6:0:0 (1800079200)  &lt;br /&gt;
    last turn:  2027-6-27 0:0:0 (1814054400)  &lt;br /&gt;
Season 6:  &lt;br /&gt;
    start: 2027-7-10 0:0:0 (1815177600)  &lt;br /&gt;
    end:   2028-1-8 0:0:0 (1830902400)  &lt;br /&gt;
    first turn: 2027-7-17 6:0:0 (1815804000)  &lt;br /&gt;
    last turn:  2027-12-26 0:0:0 (1829779200)  &lt;br /&gt;
Season 7:  &lt;br /&gt;
    start: 2028-1-8 0:0:0 (1830902400)  &lt;br /&gt;
    end:   2028-7-8 0:0:0 (1846627200)  &lt;br /&gt;
    first turn: 2028-1-15 6:0:0 (1831528800)  &lt;br /&gt;
    last turn:  2028-6-25 0:0:0 (1845504000)  &lt;br /&gt;
Season 8:  &lt;br /&gt;
    start: 2028-7-8 0:0:0 (1846627200)  &lt;br /&gt;
    end:   2029-1-6 0:0:0 (1862352000)  &lt;br /&gt;
    first turn: 2028-7-15 6:0:0 (1847253600)  &lt;br /&gt;
    last turn:  2028-12-24 0:0:0 (1861228800)  &lt;br /&gt;
Season 9:  &lt;br /&gt;
    start: 2029-1-6 0:0:0 (1862352000)  &lt;br /&gt;
    end:   2029-7-7 0:0:0 (1878076800)  &lt;br /&gt;
    first turn: 2029-1-13 6:0:0 (1862978400)  &lt;br /&gt;
    last turn:  2029-6-24 0:0:0 (1876953600)  &lt;br /&gt;
Season 10:  &lt;br /&gt;
    start: 2029-7-7 0:0:0 (1878076800)  &lt;br /&gt;
    end:   2030-1-5 0:0:0 (1893801600)  &lt;br /&gt;
    first turn: 2029-7-14 6:0:0 (1878703200)  &lt;br /&gt;
    last turn:  2029-12-23 0:0:0 (1892678400)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Stadium Building and Fanbase Changes==&lt;br /&gt;
&lt;br /&gt;
Under certain circumstances the stadiums will auto build a little bit at the start of each season, aiming to have a stadium capacity target of either the club&#039;s fanbase + 30% or the average attendance of the league + 30%, whichever is smaller.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int target_attendance;&lt;br /&gt;
if (ave_attendance &amp;lt; fans_current)&lt;br /&gt;
    target_attendance = (ave_attendance * 130) / 100;&lt;br /&gt;
else&lt;br /&gt;
    target_attendance = (fans_current * 130) / 100;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the current size of the stadium is smaller than the target attendance then seat capacity will be added somewhere between the current size and the target. Note, this will not happen if the number of new seats to be added is less than 200.  &lt;br /&gt;
See the formula below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int new_size = stadium_size_current;&lt;br /&gt;
int increase = 0;&lt;br /&gt;
&lt;br /&gt;
if (stadium_size_current &amp;lt; target_attendance)&lt;br /&gt;
{&lt;br /&gt;
    const int max_inc = target_attendance - stadium_size_current;&lt;br /&gt;
    const int min_inc = max_inc / 2;&lt;br /&gt;
&lt;br /&gt;
    increase = min_inc + rand_get_mod(max_inc - min_inc);&lt;br /&gt;
&lt;br /&gt;
    if (increase &amp;gt; 200)&lt;br /&gt;
    {&lt;br /&gt;
        new_size = stadium_size_current + increase;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example:  &lt;br /&gt;
This means that all clubs in the lower leagues have the potential to have a stadium size sufficient enough to hold the average number of fans in the top league + 30%, if they got into that league and stayed in there, allowing them to compete on a more even basis.&lt;br /&gt;
&lt;br /&gt;
Under certain circumstances, at the start of each season, the fan base can rise and fall depending on if the club has been promoted or relegated.&lt;br /&gt;
&lt;br /&gt;
If the club is currently in the division that it started in then its fanbase can rise, tending towards either the league&#039;s average attendance or the fanbase it started the game with, whichever is greater.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if (club_division == division_start)&lt;br /&gt;
{&lt;br /&gt;
    //move to league average or start fanbase (whichever is bigger)&lt;br /&gt;
&lt;br /&gt;
    if (fans_start &amp;gt; ave_attendance)&lt;br /&gt;
        target_fanbase = fans_start;&lt;br /&gt;
    else&lt;br /&gt;
        target_fanbase = ave_attendance;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the club is not in the division that it started in, then it has either been promoted or relegated and its target fanbase will change accordingly.  &lt;br /&gt;
See the formula below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
else  //In non-starting league&lt;br /&gt;
{&lt;br /&gt;
    if (fans_start &amp;gt; ave_attendance)&lt;br /&gt;
        target_fanbase = fans_start - (fans_start - ave_attendance) / 2;&lt;br /&gt;
    else&lt;br /&gt;
        target_fanbase = ave_attendance;&lt;br /&gt;
&lt;br /&gt;
    if (club_division &amp;gt; division_start)&lt;br /&gt;
    {&lt;br /&gt;
        //got relegated&lt;br /&gt;
    }&lt;br /&gt;
    else if (club_division &amp;lt; division_start)&lt;br /&gt;
    {&lt;br /&gt;
        if (target_fanbase &amp;lt; fans_start)&lt;br /&gt;
            target_fanbase = fans_start;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each season the fan base will tend from its current fan base towards its target by 50%.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int new_attendance = fans_current;&lt;br /&gt;
if (fans_current &amp;gt; target_fanbase)  //shrink it&lt;br /&gt;
    new_attendance = fans_current - (fans_current - target_fanbase) / 2;&lt;br /&gt;
if (fans_current &amp;lt; target_fanbase)  //grow it&lt;br /&gt;
    new_attendance = fans_current + (target_fanbase - fans_current) / 2;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example:  &lt;br /&gt;
If a club had a fanbase of 1000 and got promoted, its fanbase would slowly rise each season until it was at the average fanbase of the league that it is now in. An English division 10 club with a 1000 fanbase could eventually have a fanbase of over 35,000 if it got into and stayed in the English division 1.&lt;br /&gt;
&lt;br /&gt;
As mentioned before, the stadium would also gradually increase its capacity, alongside the fanbase.&lt;br /&gt;
&lt;br /&gt;
==Fitness==&lt;br /&gt;
&lt;br /&gt;
On each matchday, fitness is reduced for each player during the match.&lt;br /&gt;
&lt;br /&gt;
It uses the formula below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
reduce_level = (1 * time_played) / 15;&lt;br /&gt;
new_fitness = start_fitness - reduce_level - rand_get_mod(6);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Basically if he played 90 minutes he would lose (randomly) between 24 and 29 fitness points, which is on average 26/27 a match.  &lt;br /&gt;
Of course if he played less, say 45 minutes, then he would lose half of that, on average.&lt;br /&gt;
&lt;br /&gt;
Then each day at 3am UTC time, fitness increases with:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
new_fitness = fitness + 5 + rand_get_mod(5);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So it goes up between 5 and 9 points each day, which is on average 7 a day.&lt;br /&gt;
&lt;br /&gt;
As an example:  &lt;br /&gt;
If a player&#039;s fitness was 100% and he played two league games a week, say Saturday and Wednesday, he would go down 53 points on average (e.g. 26+27) and up 49 a week on average (e.g. plus 7 for 7 days).&lt;br /&gt;
&lt;br /&gt;
Gradually over a season the player will reduce and will need to be rotated. If the club plays in cup games too then they will reduce even faster, so squad rotation is even more important if the club is also aiming to win cups.&lt;br /&gt;
&lt;br /&gt;
Note: A player&#039;s fitness will increase more slowly if he is injured but back in the next two weeks.  &lt;br /&gt;
See below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if (injured &amp;gt; timestamp)&lt;br /&gt;
{&lt;br /&gt;
    fitness += 3 + rand_get_mod(5);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the player is injured for two weeks or more then his fitness will not increase.&lt;br /&gt;
&lt;br /&gt;
==Transfers - Unmanaged Club==&lt;br /&gt;
&lt;br /&gt;
There is logic that runs each day that allows unmanaged clubs to join in the transfer market. &lt;br /&gt;
* Each unmanaged club will have an attempt to either buy or sell 6 times, distributed over a season&lt;br /&gt;
* A club will not make an attempt if it is managed or used its seasons in/out limits&lt;br /&gt;
* The 6 attempts are configurable in a parameter and can even be turned off by setting it at 0.&lt;br /&gt;
		&lt;br /&gt;
&lt;br /&gt;
First, find what the target average rating is that we want a club’s starting 11 players to be (‘target rating’).&lt;br /&gt;
&lt;br /&gt;
This could either be the value that the club started at or the average of the division the club is currently in.  If the club is currently in the division it started in then we use the former, otherwise we use the latter.&lt;br /&gt;
&lt;br /&gt;
Note: This works the same as the target ‘fan base’ used for attendance as clubs are promoted and relegated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Buy Decision===&lt;br /&gt;
&lt;br /&gt;
Find what player position is the most required for the club.&lt;br /&gt;
* prioritise position if below any min position thresholds&lt;br /&gt;
* then prioritise position if below any ideal position thresholds&lt;br /&gt;
* otherwise go for any position other than another GK&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
- is the club&#039;s current average rating less than the ‘target rating’?&lt;br /&gt;
YES&lt;br /&gt;
   bid for player, (‘target rating’ to ‘target rating + 5’), (age 23+)&lt;br /&gt;
&lt;br /&gt;
- has there been a player bid yet?&lt;br /&gt;
NO&lt;br /&gt;
   - is the squad small / below min position limits?&lt;br /&gt;
   YES&lt;br /&gt;
      bid for squad player in required positions (‘target rating’ to ‘target rating - 5’)  (any age)&lt;br /&gt;
   NO&lt;br /&gt;
      bid for squad player in required positions (‘target rating’ to ‘target rating - 5’)  (age &amp;lt; 23) - since the squad is not small we can go for a youth player&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: All bids need to meet the following before being placed:&lt;br /&gt;
* A suitable player is on the market&lt;br /&gt;
* The club has funds to make a bid&lt;br /&gt;
* The clubs squad is not full&lt;br /&gt;
* The club has no current outstanding bids&lt;br /&gt;
* The chosen player has been on the market for at least 1 day  (not implemented)&lt;br /&gt;
&lt;br /&gt;
===Sell Decision===&lt;br /&gt;
&lt;br /&gt;
Find what player positions are above the ideal size for each position then prioritise this position if above any ideal position thresholds&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
- is the club&#039;s current average rating above the ‘target rating’?&lt;br /&gt;
YES&lt;br /&gt;
   List a player, (‘target rating’ to ‘target rating + 5’), (age 23+)&lt;br /&gt;
&lt;br /&gt;
- has there been a player listed yet?&lt;br /&gt;
NO&lt;br /&gt;
   - is the squad large / above all the ideal position thresholds?&lt;br /&gt;
   YES&lt;br /&gt;
      List a squad player from a chosen position (‘target rating’ to ‘target rating - 5’)  (any age)&lt;br /&gt;
   NO&lt;br /&gt;
      List a squad player from a chosen position (‘target rating’ to ‘target rating - 5’)  (age 30+) - since the squad is not large we can go for an older&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note: All transfer listings need to meet the following before being placed:&lt;br /&gt;
* The clubs squad is not below the minimum allowed squad size&lt;br /&gt;
* The club has not currently listed any players for sale&lt;br /&gt;
&lt;br /&gt;
==Matchday==&lt;br /&gt;
&lt;br /&gt;
All the fixtures that have not yet played are identified and prepared for processing their matchdays.&lt;br /&gt;
&lt;br /&gt;
For each fixture, the tactics and teamsheets for both teams are processed and validated before the match.&lt;br /&gt;
&lt;br /&gt;
If any player is unhappy then they lose 10% of their rating and if a player is injured or banned then he is considered to be a &amp;quot;dud player&amp;quot; and will not take part in the match.&lt;br /&gt;
&lt;br /&gt;
If the match is a continental competition then the ticket price and TV revenue numbers that are specific to that competition are used. Domestic cups use the ticket price and TV revenue numbers that the home team uses for its domestic league games. Each domestic league has its own ticket price and TV revenue that all clubs in that league use.&lt;br /&gt;
&lt;br /&gt;
==Attendance==&lt;br /&gt;
&lt;br /&gt;
The number of fans that turn up for matches are as follows:&lt;br /&gt;
&lt;br /&gt;
Domestic league and cup games will use the home club&#039;s fanbase, assuming they fit into the home club&#039;s stadium, as the number of fans that will turn up on matchday.&lt;br /&gt;
&lt;br /&gt;
The fanbase does not grow or shrink if you win or lose games; however, after the sixth domestic league game in the season, the attendance for domestic games can increase by up to 30% from its fanbase depending on how high in the table the club is above the middle of the table, and up to 30% less depending on how low the club is from the middle of the table.  &lt;br /&gt;
See the formula below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
//change the attendance based on the club&#039;s domestic league position&lt;br /&gt;
if (games_played &amp;gt; 6)&lt;br /&gt;
{&lt;br /&gt;
  int mid_table = num_teams / 2; //Get the league table size and half it.&lt;br /&gt;
&lt;br /&gt;
  //if in top half of table means more fans&lt;br /&gt;
  if (new_position &amp;lt; mid_table)&lt;br /&gt;
  {&lt;br /&gt;
    int units_of_fans = mid_table - new_position;&lt;br /&gt;
    c-&amp;gt;fans = c-&amp;gt;fans + ((c-&amp;gt;fans / 30) * units_of_fans);&lt;br /&gt;
  }&lt;br /&gt;
  else if(new_position &amp;gt; mid_table)  //bottom half of the table means less fans&lt;br /&gt;
  {&lt;br /&gt;
    int units_of_fans = new_position - mid_table;&lt;br /&gt;
    c-&amp;gt;fans = c-&amp;gt;fans - ((c-&amp;gt;fans / 30) * units_of_fans);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If it&#039;s a domestic cup or shield game then they usually get more fans than a league game, so it looks to use either the fan base (with the 30% modifier if applicable) or 75% of the stadium size, whichever is bigger.  &lt;br /&gt;
See the formula below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if((comp_type == COMP_TYPE_NATIONAL_CUP) ||&lt;br /&gt;
   (comp_type == COMP_TYPE_NATIONAL_SHIELD))&lt;br /&gt;
{&lt;br /&gt;
  int minimum_fans = (c-&amp;gt;stadium_size / 4) * 3;&lt;br /&gt;
&lt;br /&gt;
  if (c-&amp;gt;fans &amp;lt; minimum_fans)&lt;br /&gt;
  {&lt;br /&gt;
    c-&amp;gt;fans = minimum_fans - rand_get_mod(100);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Continental and world club cup games almost always have full stadium attendances.&lt;br /&gt;
&lt;br /&gt;
==Tactics Autopick==&lt;br /&gt;
&lt;br /&gt;
If the club has no manager or it has a manager who has submitted invalid tactics, then the autopick will kick in.&lt;br /&gt;
&lt;br /&gt;
Invalid tactics are:&lt;br /&gt;
* Contains at least one player who is injured or match banned.&lt;br /&gt;
* Has no goalkeeper in the goalkeeper position – unless there is a good reason like all the goalkeepers in the squad are injured or banned.&lt;br /&gt;
&lt;br /&gt;
The autopick will randomly choose one of the following formations: 4-4-2, 4-3-3 or 4-5-1 and then find the best possible player for each of the positions in the chosen formation. The player&#039;s fitness will also be taken into consideration when choosing the best players for each position.&lt;br /&gt;
&lt;br /&gt;
==Player Rating Adjustments==&lt;br /&gt;
&lt;br /&gt;
Each player is checked if it is being played in the correct position that it is meant to be played in; for example, a DC in a DC position.&lt;br /&gt;
&lt;br /&gt;
If the player is not in the correct position then he is penalized. The further out of position a player is the more he is penalized. The grid below shows what percentage should be knocked off the player&#039;s goalkeeping, tackling, passing and shooting rating, should he be out of position.  &lt;br /&gt;
See: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
const int g_grid_outta_pos_multi[16][9][7] = {&lt;br /&gt;
{&lt;br /&gt;
    {0, 0, 0, 0, 0, 0, 0}, //G&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40},&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40},&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40},&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40},&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40},&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40},&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40},&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}, //LB&lt;br /&gt;
    {3, 3, 5, 5, 5, 0, 0},&lt;br /&gt;
    {3, 3, 5, 5, 5, 0, 0},&lt;br /&gt;
    {3, 3, 5, 5, 5, 0, 0},&lt;br /&gt;
    {5, 5, 10, 10, 10, 0, 0},&lt;br /&gt;
    {10, 15, 15, 15, 15, 10, 5},&lt;br /&gt;
    {25, 25, 25, 25, 25, 25, 20},&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35}&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}, //CB&lt;br /&gt;
    {5, 0, 0, 0, 0, 0, 5},&lt;br /&gt;
    {5, 0, 0, 0, 0, 0, 5},&lt;br /&gt;
    {10, 10, 5, 5, 5, 10, 10},&lt;br /&gt;
    {10, 10, 5, 5, 5, 10, 10},&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 15},&lt;br /&gt;
    {25, 25, 25, 25, 25, 25, 25},&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35}&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}, //RB&lt;br /&gt;
    {0, 0, 5, 5, 5, 3, 3},&lt;br /&gt;
    {0, 0, 5, 5, 5, 3, 3},&lt;br /&gt;
    {0, 0, 5, 5, 5, 3, 3},&lt;br /&gt;
    {0, 0, 10, 10, 10, 5, 5},&lt;br /&gt;
    {5, 10, 15, 15, 15, 15, 10},&lt;br /&gt;
    {20, 25, 25, 25, 25, 25, 25},&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35}&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}, //DML&lt;br /&gt;
    {10, 10, 15, 15, 15, 5, 5},&lt;br /&gt;
    {10, 10, 15, 15, 15, 5, 5},&lt;br /&gt;
    {2, 2, 2, 2, 1, 0, 0},&lt;br /&gt;
    {2, 2, 2, 2, 1, 0, 0},&lt;br /&gt;
    {3, 3, 3, 3, 2, 0, 0},&lt;br /&gt;
    {15, 15, 15, 15, 10, 5, 5},&lt;br /&gt;
    {25, 25, 25, 25, 25, 25, 25},&lt;br /&gt;
    {25, 25, 25, 25, 25, 25, 25}&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}, //DMC&lt;br /&gt;
    {15, 15, 10, 10, 10, 15, 15},&lt;br /&gt;
    {15, 15, 10, 10, 10, 15, 15},&lt;br /&gt;
    {3, 0, 0, 0, 0, 0, 3},&lt;br /&gt;
    {3, 0, 0, 0, 0, 0, 3},&lt;br /&gt;
    {3, 0, 0, 0, 0, 0, 3},&lt;br /&gt;
    {15, 15, 10, 10, 10, 15, 15},&lt;br /&gt;
    {25, 15, 15, 15, 15, 15, 25},&lt;br /&gt;
    {25, 25, 25, 25, 25, 25, 25}&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}, //DMR&lt;br /&gt;
    {5, 5, 15, 15, 15, 10, 10},&lt;br /&gt;
    {5, 5, 15, 15, 15, 10, 10},&lt;br /&gt;
    {0, 0, 1, 2, 2, 2, 2},&lt;br /&gt;
    {0, 0, 1, 2, 2, 2, 2},&lt;br /&gt;
    {0, 0, 2, 3, 3, 3, 3},&lt;br /&gt;
    {5, 5, 10, 15, 15, 15, 15},&lt;br /&gt;
    {25, 25, 25, 25, 25, 25, 25},&lt;br /&gt;
    {25, 25, 25, 25, 25, 25, 25}&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}, //LM&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 15},&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 15},&lt;br /&gt;
    {5, 5, 5, 5, 4, 0, 0},&lt;br /&gt;
    {3, 3, 3, 3, 2, 0, 0},&lt;br /&gt;
    {1, 1, 1, 1, 1, 0, 0},&lt;br /&gt;
    {3, 3, 3, 3, 2, 0, 0},&lt;br /&gt;
    {10, 10, 10, 10, 10, 10, 10},&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 15}&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}, //CM&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 15},&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 15},&lt;br /&gt;
    {5, 5, 1, 1, 1, 5, 5},&lt;br /&gt;
    {3, 3, 0, 0, 0, 3, 3},&lt;br /&gt;
    {3, 0, 0, 0, 0, 0, 3},&lt;br /&gt;
    {3, 1, 0, 0, 0, 1, 3},&lt;br /&gt;
    {15, 5, 5, 5, 5, 5, 15},&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 15}&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}, //RM&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 15},&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 15},&lt;br /&gt;
    {0, 0, 4, 5, 5, 5, 5},&lt;br /&gt;
    {0, 0, 2, 3, 3, 3, 3},&lt;br /&gt;
    {0, 0, 1, 1, 1, 1, 1},&lt;br /&gt;
    {0, 0, 2, 3, 3, 3, 3},&lt;br /&gt;
    {10, 10, 10, 10, 10, 10, 10},&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 15}&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}, //AML&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {25, 25, 35, 25, 25, 25, 25},&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 10},&lt;br /&gt;
    {5, 5, 5, 5, 5, 0, 0},&lt;br /&gt;
    {5, 5, 3, 3, 1, 0, 0},&lt;br /&gt;
    {5, 5, 3, 3, 1, 0, 0},&lt;br /&gt;
    {10, 10, 10, 10, 5, 3, 3}&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}, //AM&lt;br /&gt;
    {25, 25, 25, 25, 25, 25, 25},&lt;br /&gt;
    {25, 25, 25, 25, 25, 25, 25},&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 15},&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 15},&lt;br /&gt;
    {3, 0, 0, 0, 0, 0, 3},&lt;br /&gt;
    {3, 0, 0, 0, 0, 0, 3},&lt;br /&gt;
    {3, 0, 0, 0, 0, 0, 3},&lt;br /&gt;
    {10, 10, 10, 10, 10, 10, 10}&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}, //AMR&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {25, 25, 35, 25, 25, 25, 25},&lt;br /&gt;
    {10, 15, 15, 15, 15, 15, 15},&lt;br /&gt;
    {0, 0, 5, 5, 5, 5, 5},&lt;br /&gt;
    {0, 0, 1, 3, 3, 5, 5},&lt;br /&gt;
    {0, 0, 1, 3, 3, 5, 5},&lt;br /&gt;
    {3, 3, 5, 10, 10, 10, 10}&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}, //FL&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {25, 25, 25, 25, 25, 25, 25},&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 15},&lt;br /&gt;
    {5, 5, 5, 5, 5, 5, 5},&lt;br /&gt;
    {3, 2, 2, 1, 1, 0, 0},&lt;br /&gt;
    {3, 2, 2, 1, 1, 0, 0}&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}, //FC&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {25, 25, 25, 25, 25, 25, 25},&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 15},&lt;br /&gt;
    {5, 5, 5, 5, 5, 5, 5},&lt;br /&gt;
    {3, 1, 0, 0, 0, 1, 3},&lt;br /&gt;
    {3, 1, 0, 0, 0, 1, 3}&lt;br /&gt;
},&lt;br /&gt;
{&lt;br /&gt;
    {40, 40, 40, 40, 40, 40, 40}, //FR&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {35, 35, 35, 35, 35, 35, 35},&lt;br /&gt;
    {25, 25, 25, 25, 25, 25, 25},&lt;br /&gt;
    {15, 15, 15, 15, 15, 15, 15},&lt;br /&gt;
    {5, 5, 5, 5, 5, 5, 5},&lt;br /&gt;
    {0, 0, 1, 1, 2, 3, 3},&lt;br /&gt;
    {0, 0, 1, 1, 2, 3, 3}&lt;br /&gt;
}&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Player ratings are also adjusted when taking into consideration each player&#039;s tempo, tackling style and morale.&lt;br /&gt;
&lt;br /&gt;
The tackling style can be set to be more aggressive, which means they will tackle better but also increase their chances of getting a yellow or red card.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
const int tackling_style_adjuster = 2000;&lt;br /&gt;
&lt;br /&gt;
if(tackling_style == 0)&lt;br /&gt;
{&lt;br /&gt;
    c-&amp;gt;ply[ply_off].rating_aggression = c-&amp;gt;ply[ply_off].rating_aggression - ((c-&amp;gt;ply[ply_off].rating_aggression * tackling_style_adjuster) / 10000);&lt;br /&gt;
    if(c-&amp;gt;ply[ply_off].rating_aggression &amp;lt; 10)&lt;br /&gt;
        c-&amp;gt;ply[ply_off].rating_aggression = 10;&lt;br /&gt;
}&lt;br /&gt;
else if(tackling_style == 2)&lt;br /&gt;
{&lt;br /&gt;
    c-&amp;gt;ply[ply_off].rating_aggression = c-&amp;gt;ply[ply_off].rating_aggression + ((c-&amp;gt;ply[ply_off].rating_aggression * tackling_style_adjuster) / 10000);&lt;br /&gt;
    if(c-&amp;gt;ply[ply_off].rating_aggression &amp;gt; 99)&lt;br /&gt;
        c-&amp;gt;ply[ply_off].rating_aggression = 99;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The tempo sets the player&#039;s rating and stamina. A higher tempo means that the player plays better although his fitness will drop more and faster. A lower tempo does the opposite on the ratings and stamina.&lt;br /&gt;
&lt;br /&gt;
Morale when it is set to &amp;quot;unhappy&amp;quot; will knock 10% off the player&#039;s ratings.&lt;br /&gt;
&lt;br /&gt;
==Match Results==&lt;br /&gt;
&lt;br /&gt;
After the match has been played, certain calculations are made and stored.&lt;br /&gt;
&lt;br /&gt;
Manager (veteran) points are awarded; 3 for a win and 1 for a draw.&lt;br /&gt;
&lt;br /&gt;
===Gate Receipts===&lt;br /&gt;
&lt;br /&gt;
For visual effects, the gate receipts are distributed between gate receipts, sponsorship and merchandise, with the combined total actually going 20% over. This extra 20% is then taken off through ground maintenance.  &lt;br /&gt;
See below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
AmountT gate_receipts = (AmountT)((c[0].fans * c[0].ticket_cost) * 0.8);&lt;br /&gt;
const AmountT sponsor = (AmountT)((c[0].fans * c[0].ticket_cost) * 0.3);&lt;br /&gt;
const AmountT merchandise = (AmountT)((c[0].fans * c[0].ticket_cost) * 0.1);&lt;br /&gt;
&lt;br /&gt;
const AmountT ground_maintenance = (AmountT)((c[0].fans * c[0].ticket_cost) * 0.2);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For the domestic cup games, continental knockouts and world club cup, the gate receipts are split evenly between the home team and the away team.  &lt;br /&gt;
There is only TV money for the continental knockout games and it is the same amount for both the home and away team.&lt;br /&gt;
&lt;br /&gt;
===Payouts===&lt;br /&gt;
&lt;br /&gt;
Payouts to users are made for the club/player influencers and the manager and agent wages.&lt;br /&gt;
&lt;br /&gt;
If it was a domestic league game then:&lt;br /&gt;
&lt;br /&gt;
* 0.2% of the player&#039;s wage is paid out between its influencers.&lt;br /&gt;
* 0.002% of the player&#039;s wage is paid out to the agent (if the player has one).&lt;br /&gt;
* If the club has a manager that is not locked and is active, then it gets paid a wage of 0.0004% of the club&#039;s TV income.&lt;br /&gt;
* If the club is not in debt before the game then 1% of the club&#039;s income is paid out between its influencers. This comes out of the club&#039;s balance.&lt;br /&gt;
&lt;br /&gt;
If it was a domestic cup, continental game or world club cup then:&lt;br /&gt;
&lt;br /&gt;
* If the club is not in debt before the game then 1% of the club&#039;s income is paid out between its influencers. This comes out of the club&#039;s balance.&lt;br /&gt;
&lt;br /&gt;
====Bonuses====&lt;br /&gt;
&lt;br /&gt;
* If the player starts the match then a starting lineup bonus of 0.05% of the player&#039;s wage is passed onto his influencers. A minimum of 45 minutes need to be played.&lt;br /&gt;
&lt;br /&gt;
* If the player scored then a goal bonus of 0.1% of the player&#039;s wage is passed onto his influencers for each goal scored.&lt;br /&gt;
&lt;br /&gt;
* If the player assists then an assist bonus of 0.1% of the player&#039;s wage is passed onto his influencers for each assist.&lt;br /&gt;
&lt;br /&gt;
* If there was a clean sheet then the players who played in goals and defence who were in the starting eleven get a clean sheet bonus of 0.1% of the player&#039;s wage.  &lt;br /&gt;
The player needs to have played at least 75 minutes of the game.&lt;br /&gt;
&lt;br /&gt;
===Fitness===&lt;br /&gt;
&lt;br /&gt;
Fitness is reduced for all players that played in the match. The more minutes they play the more fitness they lose. Goalkeepers lose a lot less, currently four times less, than outfield players.  &lt;br /&gt;
See below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int reduce_level;&lt;br /&gt;
if (ic2 &amp;gt; 0)&lt;br /&gt;
    reduce_level = (4 * time_played) / 15;&lt;br /&gt;
else&lt;br /&gt;
    reduce_level = (1 * time_played) / 15;&lt;br /&gt;
&lt;br /&gt;
fitness = (fitness &amp;lt; 35 ? 1 : fitness - reduce_level - rand_get_mod(6));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Players can get injured for between 2 and 160 days, although it is weighted with more chance towards the lower end.  &lt;br /&gt;
See below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
injury_days = rand_get_mod( rand_get_mod (rand_get_mod (rand_get_mod (159) + 1) + 1) + 1) + 2;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The more days a player has been injured, the more fitness he will lose.  &lt;br /&gt;
See:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
if (injury_days &amp;gt; 120)&lt;br /&gt;
{&lt;br /&gt;
    reduce_level = 40 + rand_get_mod(5);&lt;br /&gt;
}&lt;br /&gt;
else if (injury_days &amp;gt; 80)&lt;br /&gt;
{&lt;br /&gt;
    reduce_level += 30 + rand_get_mod(5);&lt;br /&gt;
}&lt;br /&gt;
else if (injury_days &amp;gt; 40)&lt;br /&gt;
{&lt;br /&gt;
    reduce_level += 10 + rand_get_mod(5);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Cup Final Prize Monday and Payouts==&lt;br /&gt;
&lt;br /&gt;
During the season, cup finals are played for domestic, continental and world tournaments that result in prize money for the clubs and payouts for the influence holders.&lt;br /&gt;
&lt;br /&gt;
* The cup prize pots are calculated at the start of the game by taking the average starting balance of the 10 clubs in the cup that have the biggest starting balance. This value is then used for that cup&#039;s prize pot for all future seasons.&lt;br /&gt;
&lt;br /&gt;
* From the cup prize pot, the club gets 25% if it is the winner and 12.5% if it is the runner up.&lt;br /&gt;
&lt;br /&gt;
* Club influence holders get paid 10% of what a club receives from cup prize money (if any).&lt;br /&gt;
** This 10% is split between all the club influence holders and the more influence a user holds in the club, the bigger portion of the 10% that influencer receives.&lt;br /&gt;
** Note: Some or even all of this will go to the club if the club has a debt&lt;br /&gt;
&lt;br /&gt;
* Each player in the club gets a bonus that equates to 0.1% of a club&#039;s cup prize money&lt;br /&gt;
** The more influence a user holds in the player, the bigger portion of the 0.1% that influence holder will receive.&lt;br /&gt;
** Note: The players rating is further used to determine the payout; e.g. a 50 rated player will get half of that 0,1%&lt;br /&gt;
&lt;br /&gt;
* The manager who wins the cup gets 10 manager points and the manager who is the runner up gets 5 manager points.&lt;br /&gt;
&lt;br /&gt;
==End of Season==&lt;br /&gt;
&lt;br /&gt;
When the last fixture of the season has been played, prize money is paid out to each of the clubs in all of the domestic leagues.&lt;br /&gt;
&lt;br /&gt;
Manager points are awarded; 10 for 1st place in a league and 5 for second place.&lt;br /&gt;
&lt;br /&gt;
The first 50% of the league prize money pot is split equally between the clubs.&lt;br /&gt;
&lt;br /&gt;
The other 50% of the total league prize money pot is then split in a linear way with the 1st placed club getting the most and the last placed club getting the least. For example, a league with 20 clubs would have the percentage split as follows: 1st: 9.5%......10th: 5%.......20th: 0.5%.  &lt;br /&gt;
See the formula below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
const int equal = 100 / num_teams;&lt;br /&gt;
int percdue = (num_teams - position) * equal;&lt;br /&gt;
int potperc = ((percdue &amp;lt;&amp;lt; 8) / 100) * (2 * equal);&lt;br /&gt;
&lt;br /&gt;
if (potperc == 0)&lt;br /&gt;
{&lt;br /&gt;
    percdue = 100 - (num_teams - 1) * equal;&lt;br /&gt;
    potperc = ((percdue &amp;lt;&amp;lt; 8) / 100) * (2 * equal);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
AmountT prize_money = (potperc / 100) * prize_money_pot;&lt;br /&gt;
&lt;br /&gt;
prize_money = ((prize_money &amp;gt;&amp;gt; 8));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
clubs_amount = (prize_money * 5000) / 10000;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
10% of a club&#039;s league prize money is split between all club influencers, provided the club isn&#039;t in debt.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
shareholders_amount = prize_money - clubs_amount;&lt;br /&gt;
shareholders_amount = (shareholders_amount * 1000) / 10000;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
0.1% of a club&#039;s league prize money is for the influencers of each player, discounted with the player&#039;s rating.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
const AmountT the_prize_share = (prize_money * 5) / 10000;   &lt;br /&gt;
AmountT sent_prize_share = (the_prize_share * player_rating) / 100;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The season then remains the current season for a few more days, before a new season is created.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Events Between Seasons===&lt;br /&gt;
&lt;br /&gt;
All the other end of season events (such as contracts, auctioning players) is done only at the point when the new season is created and the old season is replaced by it.&lt;br /&gt;
&lt;br /&gt;
A ProcessSeasonEnd script is run&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   void ProcessSeasonEnd (DbHandleData&amp;amp; db, const IdT seasonId)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Taking each of the events within it in turn:&lt;br /&gt;
&lt;br /&gt;
===Updating the player data===&lt;br /&gt;
&lt;br /&gt;
The players database is updated at the end of each season, just before the new season is created.&lt;br /&gt;
&lt;br /&gt;
New players are added, existing players updated and some players retire.&lt;br /&gt;
&lt;br /&gt;
Adding new players:&lt;br /&gt;
* If a player in real life has been playing for a club, then he will get added to the game and to the free bench.&lt;br /&gt;
&lt;br /&gt;
Updating players:&lt;br /&gt;
* Some of the current players will have their rating, position, side and influence price adjusted, all depending on how they have been performing in real life since the last update. Players that didn&#039;t have a date of birth set previously might get it added.&lt;br /&gt;
&lt;br /&gt;
Retiring players:&lt;br /&gt;
* When a player retires he leaves his current club and he goes on the freebench, however, he can not be bought by anyone.&lt;br /&gt;
* All transfer auctions involving the player are cancelled.&lt;br /&gt;
* Users are no longer able to buy influence from the game for this player.  &lt;br /&gt;
* However, users can trade any existing influence in this player between themselves.&lt;br /&gt;
* Since the player can not play for any club, he will not generate any influence payouts.&lt;br /&gt;
&lt;br /&gt;
All players will also have their value (and wage if on the free bench and not on an active contract) recalculated, as they are now a bit older and potentially worth a little less, and also the ratings will have changed.&lt;br /&gt;
&lt;br /&gt;
===Player Contracts===&lt;br /&gt;
&lt;br /&gt;
* Every player who is at a club has his contract reduced by one season.&lt;br /&gt;
* If the contract runs out then the player gets moved to the free bench.&lt;br /&gt;
* However, under certain conditions the contract will get auto-renewed for one season:&lt;br /&gt;
** Players set to &amp;quot;do not renew&amp;quot; by the agent will never be auto-renewed and will definitely leave.&lt;br /&gt;
** If the club is not actively managed or the manager is locked, then all other player contracts are auto-renewed.&lt;br /&gt;
** If the manager is active, up to 2 players may leave, and all others get auto-renewed.&lt;br /&gt;
** Worst players are released first, and only players may leave in whose position the squad has enough other players.&lt;br /&gt;
&lt;br /&gt;
===Clubs in Debt - Auto Auction===&lt;br /&gt;
&lt;br /&gt;
If a club is in debt then it will attempt to sell off the club&#039;s best player not already in an active auction by putting him on the transfer market auction with a minimum bid of 1 SVC.  In the very unlikely event that no player is available (e.g. because all players in the club retired or had their contracts run out) nothing happens.&lt;br /&gt;
&lt;br /&gt;
This auction is started immediately (ending in a week, not started only when a bid is made).  If no bid is made within the week, then the player leaves to the free bench.&lt;br /&gt;
&lt;br /&gt;
There are three reasons for this:&lt;br /&gt;
* It will reduce the club&#039;s wage bill so that its costs are lower in the future.&lt;br /&gt;
* Other clubs may decide to bid and buy the player on the auction system, potentially getting some money into the club.&lt;br /&gt;
* Losing the best player is an incentive to manage the club&#039;s finances properly.&lt;br /&gt;
&lt;br /&gt;
===Fixing Squads===&lt;br /&gt;
&lt;br /&gt;
For all clubs, the overall squad size and structure (minimum players for each position) is fixed.&lt;br /&gt;
&lt;br /&gt;
The minimum parameters can be seen below:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
const unsigned MIN_TEAM_SIZE = 21;&lt;br /&gt;
&lt;br /&gt;
const std::map&amp;lt;RequiredSquadPosition, unsigned&amp;gt; MIN_TEAM_PER_POS = {&lt;br /&gt;
  {RequiredSquadPosition::GK, 2},&lt;br /&gt;
  {RequiredSquadPosition::DEFENDER, 5},&lt;br /&gt;
  {RequiredSquadPosition::MIDFIELD, 5},&lt;br /&gt;
  {RequiredSquadPosition::ATTACKER, 3},&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The worst players on the freebench are chosen as long as no other club are bidding for them.  They are transferred for free to the club.&lt;br /&gt;
&lt;br /&gt;
===Players wages and values===&lt;br /&gt;
&lt;br /&gt;
* The values for all players are recalculated, based on possible rating changes and their changes in age for the current season.&lt;br /&gt;
* The wages for all players on the free bench are calculated.  &lt;br /&gt;
&lt;br /&gt;
(Players at a club have their wages fixed until a new contract gets signed.)&lt;br /&gt;
&lt;br /&gt;
===Club Dilution Events (Cash Injection)===&lt;br /&gt;
&lt;br /&gt;
Club dilutions are implemented but not active yet in the code!  This is how they will work once activated:&lt;br /&gt;
&lt;br /&gt;
* When a club is in debt at a season end a dilution event to raise SVC for the club is started immediately.  &lt;br /&gt;
* When not in debt, a dilution proposal is created, and club influence holders can vote it down.  This ensures that lost wallet keys won&#039;t make clubs permanently lost.&lt;br /&gt;
* The amount of new influence to be created in an event or proposal is 5%&lt;br /&gt;
* The amount of SVC raised is whatever users of the game bid for that 5% (put into the dilution pool).  For these end-of-season dilutions, there is no minimum raise specified.  It could be that one user gets all the 5% for just 1 SVC, but market forces will prevent that (and ensure a &amp;quot;fair value&amp;quot;).&lt;br /&gt;
&lt;br /&gt;
===A new season is created.===&lt;/div&gt;</summary>
		<author><name>Tyki</name></author>
	</entry>
</feed>