Player12
An open source football management simulator
Loading...
Searching...
No Matches
global.h File Reference
#include <array>
#include <cstdint>
#include <utility>
#include "gamedate.h"

Go to the source code of this file.

Functions

constexpr uint8_t toIndex (uint8_t row, uint8_t col)
 Converts a 2D grid position into a 1D index.
 
constexpr std::pair< int, int > toRowCol (int i)
 Converts a 1D index into a 2D grid row/column pair.
 
const GameDateValue START_DATE (2025, 7, 2)
 The starting date of the game.
 
const GameDateValue START_SEASON_DATE (2025, 9, 1)
 The date when the season officially starts.
 

Variables

constexpr uint8_t FREE_AGENTS_TEAM_ID = 0
 Team ID reserved for free agents.
 
constexpr const char * FREE_AGENTS_TEAM_NAME = "Free agents"
 Internal name of the free agents team (never shown).
 
constexpr const char * FREE_AGENTS_NAME_ARG = "@INBOX_FREE_AGENCY"
 The free agents in a message argument where a club name goes: a language key, so the reader sees it in their own language.
 
constexpr uint8_t TEAMS_PER_LEAGUE = 16
 Number of teams in each league.
 
constexpr uint8_t MIN_STAT_VAL = 1
 Minimum possible value for a player statistic.
 
constexpr uint8_t MAX_STAT_VAL = 100
 Maximum possible value for a player statistic.
 
constexpr float PLAYER_STAT_INCREASE_BASE = 0.03f
 Base rate at which player statistics increase.
 
constexpr float PLAYER_AGE_FACTOR_DECAY_RATE = 0.05f
 Rate at which the age factor decays for player development.
 
constexpr float PLAYER_AGE_FACTOR_DECLINE_AGE = 31.5f
 Age at which player performance starts to decline.
 
constexpr uint8_t PLAYER_RETIREMENT_AGE_THRESHOLD = 32
 Minimum age at which a player might consider retirement.
 
constexpr float PLAYER_RETIREMENT_BASE_CHANCE = 0.01f
 Base probability of a player retiring.
 
constexpr float PLAYER_RETIREMENT_CHANCE_INCREASE_PER_YEAR = 0.05f
 Amount by which the retirement chance increases each year after the threshold.
 
static constexpr uint8_t LINEUP_GRID_ROWS = 5
 This is the size of the grid where to insert players it could be used to generate heatmaps where the actions take place during a match simulation. So that the local average stats of all players (attacker vs defenders) do make more of a difference during the game.
 
static constexpr uint8_t LINEUP_GRID_COLS = 5
 
static constexpr uint8_t LINEUP_GRID_SIZE = LINEUP_GRID_ROWS * LINEUP_GRID_COLS
 
constexpr std::array< uint8_t, 12 > DAYS_PER_MONTH
 Array mapping each month (0-11) to its number of days (ignoring leap years for simplicity).
 

Function Documentation

◆ START_DATE()

const GameDateValue START_DATE ( 2025  ,
7  ,
2   
)

The starting date of the game.

◆ START_SEASON_DATE()

const GameDateValue START_SEASON_DATE ( 2025  ,
9  ,
1   
)

The date when the season officially starts.

◆ toIndex()

constexpr uint8_t toIndex ( uint8_t  row,
uint8_t  col 
)
constexpr

Converts a 2D grid position into a 1D index.

Parameters
rowThe row index.
colThe column index.
Returns
The 1D index representing the position in the lineup grid.

◆ toRowCol()

constexpr std::pair< int, int > toRowCol ( int  i)
constexpr

Converts a 1D index into a 2D grid row/column pair.

Parameters
iThe 1D index in the lineup grid.
Returns
A pair containing the row and column indices.

Variable Documentation

◆ DAYS_PER_MONTH

constexpr std::array<uint8_t, 12> DAYS_PER_MONTH
constexpr
Initial value:
= {31, 28, 31, 30, 31, 30,
31, 31, 30, 31, 30, 31}

Array mapping each month (0-11) to its number of days (ignoring leap years for simplicity).

◆ FREE_AGENTS_NAME_ARG

constexpr const char* FREE_AGENTS_NAME_ARG = "@INBOX_FREE_AGENCY"
constexpr

The free agents in a message argument where a club name goes: a language key, so the reader sees it in their own language.

◆ FREE_AGENTS_TEAM_ID

constexpr uint8_t FREE_AGENTS_TEAM_ID = 0
constexpr

Team ID reserved for free agents.

◆ FREE_AGENTS_TEAM_NAME

constexpr const char* FREE_AGENTS_TEAM_NAME = "Free agents"
constexpr

Internal name of the free agents team (never shown).

◆ LINEUP_GRID_COLS

constexpr uint8_t LINEUP_GRID_COLS = 5
staticconstexpr

◆ LINEUP_GRID_ROWS

constexpr uint8_t LINEUP_GRID_ROWS = 5
staticconstexpr

This is the size of the grid where to insert players it could be used to generate heatmaps where the actions take place during a match simulation. So that the local average stats of all players (attacker vs defenders) do make more of a difference during the game.

◆ LINEUP_GRID_SIZE

constexpr uint8_t LINEUP_GRID_SIZE = LINEUP_GRID_ROWS * LINEUP_GRID_COLS
staticconstexpr

◆ MAX_STAT_VAL

constexpr uint8_t MAX_STAT_VAL = 100
constexpr

Maximum possible value for a player statistic.

◆ MIN_STAT_VAL

constexpr uint8_t MIN_STAT_VAL = 1
constexpr

Minimum possible value for a player statistic.

◆ PLAYER_AGE_FACTOR_DECAY_RATE

constexpr float PLAYER_AGE_FACTOR_DECAY_RATE = 0.05f
constexpr

Rate at which the age factor decays for player development.

◆ PLAYER_AGE_FACTOR_DECLINE_AGE

constexpr float PLAYER_AGE_FACTOR_DECLINE_AGE = 31.5f
constexpr

Age at which player performance starts to decline.

◆ PLAYER_RETIREMENT_AGE_THRESHOLD

constexpr uint8_t PLAYER_RETIREMENT_AGE_THRESHOLD = 32
constexpr

Minimum age at which a player might consider retirement.

◆ PLAYER_RETIREMENT_BASE_CHANCE

constexpr float PLAYER_RETIREMENT_BASE_CHANCE = 0.01f
constexpr

Base probability of a player retiring.

◆ PLAYER_RETIREMENT_CHANCE_INCREASE_PER_YEAR

constexpr float PLAYER_RETIREMENT_CHANCE_INCREASE_PER_YEAR = 0.05f
constexpr

Amount by which the retirement chance increases each year after the threshold.

◆ PLAYER_STAT_INCREASE_BASE

constexpr float PLAYER_STAT_INCREASE_BASE = 0.03f
constexpr

Base rate at which player statistics increase.

◆ TEAMS_PER_LEAGUE

constexpr uint8_t TEAMS_PER_LEAGUE = 16
constexpr

Number of teams in each league.