|
Player12
An open source football management simulator
|
Creation of clubs and players with realistic structure. More...
Functions | |
| std::pair< std::string, std::string > | drawName (WorldRng &rng, Language nationality, NameRegistry ®istry, SquadSurnames &squad) |
| float | maxPotential (int age, float overall) |
| float | teamLevel (std::uint8_t reputation) |
| std::vector< float > | levelOffsets (const LeagueShape &shape, std::size_t clubs) |
| float | reputationCentre (const LeagueProfile &league, std::size_t clubs) |
| float | clubLevel (const LeagueEconomy &economy, std::uint8_t reputation) |
| double | overallFor (PlayerRole role, const std::map< std::string, float > &stats, const StatsConfig &stats_config) |
| void | generateClubProfiles (std::unordered_map< TeamID, Team > &teams, std::uint64_t world_seed, bool assign_opening_balance) |
| std::vector< Player > | generateSquad (const Team &team, const LeagueEconomy &economy, std::size_t existing_players, std::int64_t existing_weekly_wages, PlayerID &next_player_id, std::uint64_t world_seed, const StatsConfig &stats_config) |
| void | initializeHiddenAttributes (Player &player, WorldRng &rng, const StatsConfig &stats_config) |
| void | applyOpeningBudgets (Team &team, const LeagueEconomy &economy, std::int64_t weekly_payroll) |
Creation of clubs and players with realistic structure.
Club reputations are tiered inside each league around the league's level; squad quality, stadiums, revenue and payroll all follow from reputation, so wage bills predict league strength. Players get role-dependent attribute profiles, an age curve, hidden potential and personality.
| void WorldGeneration::applyOpeningBudgets | ( | Team & | team, |
| const LeagueEconomy & | economy, | ||
| std::int64_t | weekly_payroll | ||
| ) |
Sets the opening transfer and wage budgets from cash and payroll.
| float WorldGeneration::clubLevel | ( | const LeagueEconomy & | economy, |
| std::uint8_t | reputation | ||
| ) |
Mean first-team level a club of reputation is generated at: the league's level (teamLevel of its reputation plus the shape's offset) and the club's place in the league's hierarchy.
| std::pair< std::string, std::string > WorldGeneration::drawName | ( | WorldRng & | rng, |
| Language | nationality, | ||
| NameRegistry & | registry, | ||
| SquadSurnames & | squad | ||
| ) |
Draws a name of nationality that is free in registry and keeps the squad's surnames distinct (one repeat allowed), then claims it. After many clashes a double surname is used.
| void WorldGeneration::generateClubProfiles | ( | std::unordered_map< TeamID, Team > & | teams, |
| std::uint64_t | world_seed, | ||
| bool | assign_opening_balance | ||
| ) |
Assigns reputation, facilities, stadium and ticket price to every club (except free agents), league by league. With assign_opening_balance the clubs also get opening cash scaled to their expected income (new worlds) and the registry of generated names starts afresh; legacy saves keep their balance.
| std::vector< Player > WorldGeneration::generateSquad | ( | const Team & | team, |
| const LeagueEconomy & | economy, | ||
| std::size_t | existing_players, | ||
| std::int64_t | existing_weekly_wages, | ||
| PlayerID & | next_player_id, | ||
| std::uint64_t | world_seed, | ||
| const StatsConfig & | stats_config | ||
| ) |
Generates the missing players of a 30-man squad. Wages are scaled so the club's payroll (including existing_weekly_wages) matches the league's player-wage share of the club's expected income. Names are unique among the squads generated since the last generateClubProfiles() of a new world and follow each player's nationality.
| void WorldGeneration::initializeHiddenAttributes | ( | Player & | player, |
| WorldRng & | rng, | ||
| const StatsConfig & | stats_config | ||
| ) |
Draws potential and personality for a player that has none yet (a predefined or legacy player) and reserves his name for the world being generated.
| std::vector< float > WorldGeneration::levelOffsets | ( | const LeagueShape & | shape, |
| std::size_t | clubs | ||
| ) |
First-team level of each club relative to its league's mean, by rank (0 = strongest): normal scores with the elite pulled clear, rescaled to the shape's standard deviation.
| float WorldGeneration::maxPotential | ( | int | age, |
| float | overall | ||
| ) |
Highest believable potential for a player of age and current overall: veterans (Generation::VETERAN_AGE and older) have at most Generation::VETERAN_HEADROOM left.
| double WorldGeneration::overallFor | ( | PlayerRole | role, |
| const std::map< std::string, float > & | stats, | ||
| const StatsConfig & | stats_config | ||
| ) |
Overall rating of stats for role (same formula as Player).
| float WorldGeneration::reputationCentre | ( | const LeagueProfile & | league, |
| std::size_t | clubs | ||
| ) |
Reputation the clubs of league spread around: the league's own reputation, lowered when needed so that its strongest club stays below the cap of 99.
| float WorldGeneration::teamLevel | ( | std::uint8_t | reputation | ) |
Mean overall rating of a first-team regular at a club.