Mangy5882

FM24 Youth Intake — Reverse Engineering Notes

Nov 22nd, 2026
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 72.84 KB | Gaming | 0 0
  1. # FM24 Youth Intake — Reverse Engineering Notes
  2.  
  3. Nov 17, 2026 · @Phil
  4.  
  5. Static analysis of `fm.exe` in IDA, checked against a live save (Aston Villa, club UID 603, England) in Cheat Engine on the day the Youth Intake Preview fired (Dec 2023 in game). All addresses are virtual addresses at image base 0x140000000. Names like `sub_…` and `vNN` are IDA defaults.
  6.  
  7. **Status.** The preview mechanics and the template contents were confirmed live. The CA/PA paths were traced statically and then checked against Villa's real intake on 15 Mar 2024 (see "Verification on intake day"). The real players only fit once the nation PA quota and the CA top-up are included; both are described below.
  8.  
  9. ## Summary
  10.  
  11. - **Players exist (as templates) from preview day.** On preview day the game creates **every** incoming youth player for each club with a human manager. Each one is a 232-byte *newgen template* that holds name, nationality, date of birth, positional ratings and a quality "type". It holds **no CA, PA or attributes**. Clubs without a human manager get no templates. Their intake is generated from scratch on intake day.
  12. - **The preview rates a fresh roll, not the real players.** To grade the intake, the game turns each template into a temporary player and rolls CA, PA and attributes for it with the global RNG. The Head of Youth Development (HoYD) rates that temporary player with `player_match_rating` against a club benchmark. The rating blends the temp player's PA with a CA-based projection, weighted by the HoYD's **Judging Player Potential**; his Judging Player Ability only adds noise to the stars and count (see "Preview rating R").
  13. - **Intake day rolls again.** The same templates become the real players, with CA, PA and attributes **rolled a second time**. Fixed since December: the number of players, their positions, nationality, date of birth and type. Rolled again: everything ability-related. The grades are a sample from the same odds, not a promise.
  14. - **The type biases PA and CA.** Each template's type (+51) is rolled once in December and changes the PA and CA odds a lot. That is why a good preview still matters, even though the actual numbers are rolled again.
  15. - **PA comes from a club "youth score"** built from youth facilities, junior coaching, youth recruitment and the nation's youth rating. Club reputation adds to the CA range. The nation's player deficit sets how many players arrive.
  16. - **A nation-wide PA quota then moves PA between 20-point bands.** Each nation has a target count per PA band, taken at game start, and a live count. A new player is pushed down out of an over-full band, or stepped up into bands that are short of players. For Villa this is the biggest single effect: types 3 and 4 go from about 2 % and 0.2 % chance of PA ≥ 140 to well over half. The room is shared first-come by every club in the nation during the intake window.
  17. - **CA is then topped up from the final PA** (about 40–55 % of PA, adjusted for age), so a quota-boosted player also gets a higher CA.
  18. - **Attribute shape comes from an archetype, not a formation.** Each youth player gets an archetype (69 attribute multipliers) matched to natural position group, height band and area. Archetypes are **built at new-game setup by clustering the save's own database players** (`sub_14362DD90`), per playable nation and per continent; weight = number of players merged. The HoYD's dominant coaching attribute category makes same-style archetypes up to 2× as likely. Most attributes then snap to multiplier × base ±2 (see "Attributes on intake day").
  19.  
  20. ## Timeline
  21.  
  22. | When | What | Code |
  23. | --- | --- | --- |
  24. | 09:00 on the day 93 days before the nation's intake start date (Dec for a mid-March intake) | Preview: templates are generated for human clubs and the preview news item is built | `GAME_RULE_GROUP_MANAGER` vtable slot 135 → `sub_155DA03E0` → `sub_1436157C0` → `sub_1436161D0` |
  25. | Every day from intake start to intake end | Clubs in the nation are spread across the window. On its day each club's templates become players, or a fresh intake is generated if it has none | slot 134 → `sub_142D29670` → `sub_14361D9F0` → `sub_1436162F0` |
  26. | Intake end date | Clean-up, plus topping up the nation's pool of club-less newgens (`sub_14362C720` → `sub_14362C830`) | `sub_142D29670` |
  27.  
  28. - The intake window comes from `sub_141CF4A20(rule_group, &start, &end)`. It is based on the rule-group fields `newgen_intake_day` and `newgen_intake_variance`, with hard-coded overrides for a few nations.
  29. - The caller is `sub_141CF9A40`. It fires the preview when `v23 == 900` (09:00) and `start.day == today.day + 93`. It calls slot 134 on every day inside `[start, end]`.
  30. - The live save's preview fired on day-of-year 347 (2023), which gives England an intake start of about 16 Mar 2024. In practice Villa's intake arrived at 00:00 on 15 Mar 2024. At that point only 25 English-nationality newgens had been added nation-wide, so Villa was among the first clubs processed.
  31.  
  32. ## Data structures
  33.  
  34. ### Regeneration manager (`REGENERATION_MANAGER`, pointer at `0x14637C8B8`)
  35.  
  36. | Offset | Type | Meaning |
  37. | --- | --- | --- |
  38. | +168 / +176 | `vector<NATION_POTENTIAL_TEMPLATE*>` | Per-nation PA-band quotas (see below) |
  39. | +256 | `std::map<int clubIndex, vector<TEMPLATE>>` | Stored candidates per club. The key is `club+8`, the internal index (Villa = 301), not the UID. Empty before preview day. After it, one entry per human club (live: 1 entry, Villa, 16 templates). |
  40. | +272 | `std::map<int nationId, vector<CLUB*>>` | Clubs to process during the current intake window. Filled on the start date and cleared on the end date. |
  41. | +304 | u8 | Gates the quota stage. Set to 1 by intake processing (`sub_14361D9F0`); `sub_1436347C0` and `sub_1436370E0` (probably setup/load) set it to 0 and then to 1. It is never otherwise cleared, so in practice it is always 1. |
  42.  
  43. The +256 map is emptied once the templates have been turned into players.
  44.  
  45. MSVC map node layout: left +0, parent +8, right +16, colour +24, is-nil +25, key +32, value (vector begin/end/cap) +40/+48/+56.
  46.  
  47. ### Nation PA quota (`NATION_POTENTIAL_TEMPLATE`, 88 bytes, pool `unk_146437ED0`)
  48.  
  49. | Offset | Meaning |
  50. | --- | --- |
  51. | +0 | `int targets[10]`: target count per PA band |
  52. | +40 | `int actuals[10]`: live count per PA band |
  53. | +80 | Nation id |
  54. | +84 | 0 = players, 1 = non-player staff (uses the non-player's own ability band) |
  55.  
  56. Band = PA / 20 for PA ≥ 20, capped at 9 (band 7 = 140–159, band 8 = 160–179); PA < 20 is band 0.
  57.  
  58. How the counts are kept:
  59.  
  60. - **Rebuilt at game start.** `sub_157C7A900` (thunk `sub_143630E20`) runs from new-game setup `sub_143188320` and from `sub_142D1AF90`. It clears every object and then, for each person, calls `sub_145158AA0`/`sub_145158DA0` with a3 = 0. That increments both target and actual. So **targets = the nation's PA-band population at game start**.
  61. - **Intake adds to actuals only.** `sub_143623630` calls `sub_145158AA0(mgr+168, player, mgr+304)` for each new player; `sub_145157DC0` does `actual[band]++`, plus `target[band]++` only when a3 == 0. The count uses the **player's own nationality**.
  62. - **Removal subtracts.** `sub_145157EB0` → `sub_15C243FF0` does `actual[band]--` (floor 0). It is called from `sub_143676050` (person removal: retirement via `sub_143666520` "RETIREMENT", and deletions via `sub_143671DB0`, `sub_14367DED0`, `sub_143322B10`). `sub_1436770B0` is the staff version and `sub_1451590A0` handles a nationality change.
  63. - Staff generation (`sub_143610D60`, `sub_143613BB0`) uses the flag-1 objects and `sub_145157C30`, which picks a band weighted by targets.
  64.  
  65. So the actuals track the living population against the game-start snapshot. Live England (players), 14 Mar → 15 Mar 2024:
  66.  
  67. | Band | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
  68. | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
  69. | Target | 11 | 38 | 326 | 602 | 1058 | 1460 | 1016 | 288 | 55 | 6 |
  70. | Actual before | 0 | 12 | 130 | 403 | 886 | 1317 | 894 | 275 | 57 | 7 |
  71. | Actual after | 0 | 12 | 132 | 406 | 889 | 1318 | 900 | **283** | 59 | 7 |
  72.  
  73. Low bands are heavily depleted (many low-PA players get deleted), so the quota mostly lifts newgens into PA 60–139. Band 7 had only about 8 places of room, and it stopped at exactly target − 5 (see the quota stage below).
  74.  
  75. ### Club facilities (club +256 → data block)
  76.  
  77. | Offset | Meaning | Villa | Getter / evidence |
  78. | --- | --- | --- | --- |
  79. | +288 | Training facilities | 20 | `sub_142215070` (same affiliate walk as the other getters; callers lead to `icons/custom/training/...`). Confirmed in the UI: writing 19 changed it from State of the Art (20) to Superb (19). |
  80. | +289 | **Club morale** (1–20) | 20 | Confirmed in the UI: writing 19 changed club morale. `sub_14224E180` (with +290 as a ± modifier); `sub_14217BB30` (new player's +607 = 10 + rand(3), adjusted if +289 ≠ 0, so a newgen's starting morale is probably seeded from club morale) |
  81. | +291 | Corporate facilities | 10 | Confirmed in the UI |
  82. | +296 | Youth-rating category for English clubs (765) | 1 | `sub_142244810` |
  83. | +299 | Youth facilities | 18 | `sub_142211430`; confirmed in the UI |
  84. | +300 | Junior coaching | 14 | `sub_1422113D0`; confirmed in the UI |
  85. | +301 | Youth recruitment | 17 | `sub_142215310`; confirmed in the UI |
  86.  
  87. ### Clubs, nations and competitions (lookups used to name IDs)
  88.  
  89. Names are pointers to length-prefixed strings (text at pointer + 4).
  90.  
  91. | Object | Fields |
  92. | --- | --- |
  93. | Club (all clubs: pointer array `qword_14642EF88`..`EF90`) | +12 ID (Villa 603), +192 long name, +200 short name, +216 nation, +24/+32 team vector, +256 data block, +362 "strong club" byte (Villa 1) |
  94. | Team | +12 ID, +48 club, +80 competition |
  95. | Competition | +12 ID, +64 name, +418 league level (Premier League 0) |
  96. | Nation (contiguous, stride 472) | +12 ID, +24 name, +40 code, +48 adjective, +240 continent, +264 rules object |
  97. | Continent | +12 ID (1 Africa … 6 South America), +24 name |
  98.  
  99. ### Player (`ACTUAL_PLAYER`, 1000-byte pool objects)
  100.  
  101. | Offset | Meaning |
  102. | --- | --- |
  103. | +512 / +514 | CA / PA (int16, 0–200) |
  104. | +520 | Positional ratings (1–20), copied from template +55: GK 520, SW 521, DL/DC/DR 522–524, DM 525, ML/MC/MR 526–528, AML/AMC/AMR 529–531, ST 532, WBL/WBR 533/534. Zero entries become 1 and some secondary ratings are adjusted. |
  105. | +605 / +606 | Highest CA / PA seen (u8) |
  106. | +672 | Person sub-object (`v6 + vbtbl[2] + 8`, vbtable at +8): DOB +28, nationality +72, name pointers +48/+56/+64 |
  107.  
  108. Villa's 16 new players were contiguous in the pool (stride 0x3E8). They can be found by scanning for the template DOB values and checking the nationality.
  109.  
  110. ### Newgen template (232 bytes, init `sub_14488B980`)
  111.  
  112. | Offset | Type | Meaning (live values in brackets) |
  113. | --- | --- | --- |
  114. | +0 | ptr | Nation used for name/region (England) |
  115. | +8 | ptr | Team (Villa first team) |
  116. | +16 | ptr | Club (Villa) |
  117. | +48 | u16 | Number of players in this batch (16) |
  118. | +50 | u8 | Forced position byte (0xFF = none; 3, 6, 8, 9, 11 on gap fillers) |
  119. | +51 | u8 | **Type**: quality tier, see below |
  120. | +52 | u8 | Generation path (1 here; 2 enables PA caps, see `sub_14361FB60`) |
  121. | +53 | u8 | Flag passed to the youth-score function (0) |
  122. | +55 | 15 × u8 | Positional ratings (20 = natural) in the order below. Copied 0x45 bytes into the player at +520. |
  123. | +168 / +176 | ptr | Nationality / second nationality |
  124. | +184 | ptr | City of birth |
  125. | +224 | u32 | Date of birth (year << 16 \| day-of-year) — 2007/2008 |
  126.  
  127. Byte order of the positional ratings: 0 GK, 1 (sweeper), 2 DL, 3 DC, 4 DR, 5 DM, 6 ML, 7 MC, 8 MR, 9 AML, 10 AMC, 11 AMR, 12 ST, 13 WBL, 14 WBR. Live, Villa's 16 templates matched the preview's position counts exactly.
  128.  
  129. ### Preview result (`sub_1408220B0` init, serialised by `sub_144253410`)
  130.  
  131. | Offset | Meaning |
  132. | --- | --- |
  133. | +0..+8 | Position groups with many players (count > 2, or > 3 for CB/WB) |
  134. | +24..+32 | Position groups with no players |
  135. | +48..+56 | Vector of (group u8, grade u8): the per-position grades |
  136. | +88 | map group → count of "good" candidates |
  137. | +104..+112 | Weak groups (more poor than average, no good) |
  138. | +128 / +136 | Best prospect's references (template +168 / +184) |
  139. | +144 | Best prospect's position flags |
  140. | +148 | Overall rating (11–20; 20 = 5 stars) |
  141. | +149 / +150 | Reported player count range: n − e, n + e |
  142. | +151 | Valid flag |
  143.  
  144. The news-item copy lives on the human manager object at +592 (`sub_143A910A0`). It is deleted on the club's intake day. The club screen can re-run `sub_14361B6D0` (club message `CNGr`), but see "Does the preview re-roll?" below.
  145.  
  146. ## What the preview shows: `sub_14361B6D0(mgr, club, out)`
  147.  
  148. 1. **Assessor.** `sub_1447E66B0(club)`: the staff member in job role −93 (0xA3, Head of Youth Development), else the parent club's, else a fallback via vtable +1688. Two of their 0–100 judging bytes are used, each shown in the UI as `j20 = clamp((x+2)/5, 1, 20)` (80 → 16):
  149. - +52 **Judging Player Ability** sets only the noise term `e = (25 − j20) / 10`: **0 for 16–20, 1 for 6–15, 2 for 1–5** (steps 6–7).
  150. - +53 **Judging Player Potential** sets the PA weight inside each candidate's R (step 3; see "Preview rating R").
  151. 2. **Club benchmark B** (`sub_14361F300`): the average of `(vtbl+8 + vtbl+24)/2` over the club's top 13 players (CA and PA on the 0–200 scale). If that is zero, it falls back to first-team reputation / 50.
  152. 3. **Each candidate.** A temporary `ACTUAL_PLAYER` is built from the template (`sub_14488C660`) and given a youth contract. `sub_14361FB60` then generates CA, PA and attributes with the **global** RNG, and the HoYD's `player_match_rating(HoYD, temp, 1, …)` gives R (0–200 scale): a JPP-weighted blend of PA and a projection, defined below.
  153. - **Good:** `R > 159`, or `R ≥ B × clamp(1.4 − 0.4·(B−50)/110, 1.0, 1.4)`. Only possible when `R > 49`.
  154. - **Poor:** `R < B × clamp(1.0 − 0.2·(B−50)/110, 0.8, 1.0)`.
  155. - **Average:** anything else.
  156. 4. **Position group** (from the template's natural position, `sub_1419C9D00`): 0 GK; 1 Full-backs (DL/DR); 2 Centre-backs; 3 DM; 4 Central mids; 5 Wide mids (ML/MR); 6 AMC; 7 Wingers (AML/AMR); 8 Strikers; 9 Wing-backs.
  157. 5. **Grade per group** (`sub_144255130`): `s = clamp(4·good + average − poor, −4, 4)`, `grade = int((s+4)·5/8) + 1`, where 1 = F … 6 = A and 0xFF = "–" (no players). So s = −4/−3 → F, −2/−1 → E, 0 → D, 1/2 → C, 3 → B, 4 → A. **One good prospect with no poor ones is an A.** One poor prospect and nothing else is an E (Villa's GK).
  158. 6. **Overall rating** (`sub_143621270`): `T` = the average R of the top 6 candidates; `base = 20` if T > B, else `11 + 36·(clamp(T/B, 0.75, 1) − 0.75)`. Then add a uniform integer in `[−e, +e]` and clamp to 11–20. The noise RNG is seeded from the assessor (person +20), so the same HoYD always gives the same noise.
  159. 7. **Player count** shown as `n ± e`.
  160.  
  161. **Live check (Villa).** Five stars, with the "golden generation" headline. Grades: FB A (3 players), WB A (1), ST A (2), AM A, CB D (2), MC D (2), GK E (1), WM E (2), DM – (0). All of these are consistent with the formula, e.g. WB with 1 player at A means that player was "good", and GK E means one poor player.
  162.  
  163. **Does the preview re-roll?** Unconfirmed. The `CNGr` handler (`sub_142E697D0`, at 0x142E6EC08) calls `sub_14361B6D0`, and CA/PA (and the projection's damping) come from the global TLS RNG, so a re-run would give new grades. But in a live test (a CE breakpoint at 0x14361BF25, the Villa preview, the news item clicked several times) the preview was computed **once** and the estimates didn't change on re-opening. What triggers `CNGr` (and whether the result is cached) hasn't been traced. Only the star noise is seeded (from the assessor), so that part is stable either way.
  164.  
  165. ### Preview rating R (`player_match_rating`, 0x1426B5410, mode a3 = 1)
  166.  
  167. Called from the preview at 0x14361BF20 and 0x14361C882. Decompile: `C:\Users\phila\fmre\nat\dec\player_match_rating.c`. Player vtable (`off_145A4E958`): +8 = CA (word +512), +16 = PA (word +514), +24 = byte +613 (projection, below).
  168.  
  169. ```
  170. j = clamp((JPP + 2)/5, 1, 20) JPP = assessor byte +53
  171. d = |player person id − assessor person id| person id at person-subobject +12
  172. w = 20 if d % 100 == 49; 1 if d % 100 == 50; else clamp(j + (d & 3) − 2, 0, 20)
  173. w = min(w, cap(age)) cap: ≤15 → 7, 16 → 10, 17 → 12, 18 → 14, 19 → 17, ≥20 → none
  174. R = (w·PA + (20 − w)·Proj) / 20 integer division
  175. ```
  176.  
  177. - Age is person vtable +408 (`sub_14269B870`) against `dword_145A4C04C` (null date = today). DOB is player +700 (day = word & 0x1FF, year = word +702).
  178. - JPP needed to always hit the cap (jitter −2): 9 at ≤15, 12 at 16, 14 at 17, 16 at 18, 19 at 19. At ≥20 even JPP 20 can be jittered to 18.
  179. - Bypass: if player byte +446 & 0x40 (set by `sub_14217E290` via `sub_142179240`), `R = min(CA + floor(0.05·CA), PA)`. Preview temp players don't have it.
  180. - Assessor byte +52 (JPA) is read only in modes 2 and 5 (current-ability ratings), never in mode 1.
  181. - Unconfirmed: whether the temp player's person id is a real id or −1. If it's fixed, the jitter is fixed per HoYD.
  182.  
  183. **Projection** `sub_1426F3090(player)` (byte +613; decompile `...\dec\proj_1426F3090.c`), capped at 200:
  184.  
  185. ```
  186. age ≥ 28: Proj = CA
  187. else: P0 = CA + (int)((28 − age) · max(3, CA · ((40 − age)/20)^4 / 25))
  188. ```
  189.  
  190. Then P0 is damped against a level L. Which branch sets L depends on the player's links (vtable +1064 contract club, +664, +672). The preview temp player has no contract club and takes the vtable +672 branch:
  191.  
  192. - team = first entry of (+672 object)+24, i.e. the club's first team; COMP = team+80; `L = 8·max(1, rep/10) + 40` with rep = COMP word +384. Villa: Premier League rep 185 → **L = 184**.
  193. - **Random damping** (this branch only): k = rand 1..5, `L′ = (k·((L+40)/2) + (10−k)·L)/10` = L − k·(L−40)/20 (disasm 0x1426F3651–0x1426F367B). Villa: L′ ∈ {176, 169, 162, 155, 148}.
  194. - If P0 > L′: `Proj = (int)(L′ + f·(P0 − L′))`, f = 0.35 if L′ < 120, 0.55 if 120–139, 0.85 if ≥ 140.
  195. - `Proj = max(Proj, CA)`, capped at 200.
  196. - If the +672 object has no team, L = 40 and the extra floor `Proj ≥ P0 − 30` applies. Real players with a contract club use the club's competition level, moved towards a previous club's level over the first 100 days after a transfer, with no random damping.
  197.  
  198. **Live check (Villa preview, day 347/2023).** CE breakpoint at 0x14361BF25 (after the call; temp player at RSP+0x88), HoYD person 0x1238D5CF0 (id 28087034, JPP 90 → 18, so always at the age cap). All **16** candidates' Proj and R reproduced exactly with L = 184 and a consistent k:
  199.  
  200. | Age | CA | PA | P0 | Proj | R |
  201. | --- | --- | --- | --- | --- | --- |
  202. | 15 | 53 | 121 | 120 | 120 | 120 |
  203. | 16 | 69 | 158 | 137 | 137 | 147 |
  204. | 15 | 75 | 148 | 170 | 167 (k = 4) | 160 |
  205. | 15 | 87 | 159 | 197 | 192 (k = 2) | 180 |
  206. | 15 | 48 | 142 | 108 | 108 | 119 |
  207. | 15 | 50 | 56 | 113 | 113 | 93 |
  208. | 16 | 46 | 54 | 91 | 91 | 72 |
  209.  
  210. The projection formula was also checked with `executeCodeEx` on ~30 real players. Consequence: at 15, 65 % of R comes from a CA-based projection, so the grades reward current ability far more than PA.
  211.  
  212. **Rating text** (`sub_1426FD240(out, value, short)`). Stars = (value − 10) / 2, so 20 = 5★.
  213.  
  214. | Value | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
  215. | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
  216. | Short | Unsuitable | Low | Useful | Decent | Fairly Good | Good | Very Good | Superb | Excellent | Star |
  217.  
  218. The long form reads "Not suitable for the senior team", "Low rating for the senior team", "… rating for the senior team", up to "Star Player". Values 1–10 (youth-team scale) run Below Average … Excellent, then "Star Youth Player".
  219.  
  220. The headline sentence ("golden generation" and so on) is **not** in fm.exe or in loaded memory. That string appears only as a UI style key and in fan social-media texts, so the headline is presumably in the language database (.fmf), selected when `db::NEWS_ITEM` is posted by `sub_143621710`.
  221.  
  222. ## How many players and what type
  223.  
  224. **Count** (`sub_1436162F0`, the path for clubs in an active league). Let D = (game-nation +420) − (game-nation +416), the nation's target player count minus its current count, and P = D / (+412):
  225.  
  226. - D > 299, or the club is in a league with a level → **14–16** (14 + rand 0..2)
  227. - D ≥ 150 → **10–12**
  228. - Lower values use smaller counts.
  229. - Affiliated or B teams: clamped to 3–6.
  230. - Top-division clubs: at least 7.
  231. - Never more than `max(base, P − 1)`, and never more than 25 including existing candidates.
  232.  
  233. Live: England D = 4860 − 4539 = 321, and Villa received 16.
  234.  
  235. The "game-nation" object is at nation +264 (or +272). It is not the 0x1D8-byte `db::NATION`.
  236.  
  237. | Game-nation offset | Meaning | England |
  238. | --- | --- | --- |
  239. | +412 | Number of clubs (divisor for P) | 1085 |
  240. | +416 / +420 | Current / target player count | 4539 / 4860 |
  241. | +1144 | Importance, ×10 (game code rounds `/10` to 1–20) | 185 |
  242. | +1932 | **Youth rating** (0–200; fallback nation rep / 50) | 135 |
  243. | +1949 | Tier flag (1 = major) | 1 |
  244. | +1956 | Max age used by `sub_14365B4E0` | 20 |
  245.  
  246. **Type** (`sub_142248490`, template +51), rolled per template in a playable league with r = rand(1000):
  247.  
  248. | r | Type | Share |
  249. | --- | --- | --- |
  250. | < 180 | 2 | 18 % |
  251. | 180–454 | 4 | 27.5 % |
  252. | 455–459 | 1 | 0.5 % |
  253. | ≥ 460 | 3 | 54 % |
  254.  
  255. - In leagues of level ≥ 2, types 1/2 can be swapped to 3. Type 4 at a club with rep ≤ 1499 becomes 3 one time in three.
  256. - Non-playable nations use reputation-based odds. Nation 390 (United States) has its own table.
  257. - **Type 6** is a gap-filler, generated afterwards with a forced position (+50) to cover empty position groups.
  258. - Villa live: 4 × type 2, 4 × type 3, 3 × type 4, 5 × type 6.
  259.  
  260. ## PA on intake day
  261.  
  262. Path: `sub_14361FB60` → `sub_14217CB40` (PA) → `sub_142248F70(club, &PA, type, nationality, flag, rng)`.
  263.  
  264. ### 1. Youth score S (`sub_142247230(club, 1, …)`)
  265.  
  266. ```
  267. YF = youth facilities (club+256 → +299), max over parent clubs
  268. JC = junior coaching (club+256 → +300), from the top parent club
  269. YR = nation youth rating (game-nation +1932)
  270. if the player's nationality ≠ the club's nation: YR = max(YR, YR × YRec / 20)
  271. where YRec = youth recruitment (club+256 → +301)
  272. (non-playable nations: JC may get + rand(JC/2) when rand(40) < YRec and YR ≥ 100)
  273. S = int( (YF/5 + YR × (JC/20) × 0.5) × 1.5 )
  274. ```
  275.  
  276. - Villa: YF 18, JC 14, YRec 17, YR 135 → S = (3 + 47.25) × 1.5 ≈ **75**.
  277. - Training facilities (+288 = 20) do not appear in the formula.
  278.  
  279. ### 1b. Youth-staff bonus (before the jitter)
  280.  
  281. Pseudocode ~812–867 of `sub_142248F70`. It runs only for **types 1/2** when `v480` is set (below), the club's first-team competition level (+418) is ≤ 1, and `a5` = 0.
  282.  
  283. ```
  284. with v475 (club nation playable):
  285. bonus = youth-staff score (sub_142246F70)
  286. without v475:
  287. bonus = top parent's junior coaching (club+256 → +300; affiliation walk, mask 0x1001F0)
  288. if S + bonus ≥ 71: bonus = max(0, 70 − S)
  289. S += rand(min(bonus, S/5)) # uniform 0 … cap−1
  290. ```
  291.  
  292. **Youth-staff score** `sub_142246F70(club)`:
  293.  
  294. ```
  295. HoYD present: sum = 2·(j(HoYD) + HoYD WwY), n = 4
  296. each staff member from sub_1428D6EC0(club) passing sub_14269BAB0
  297. (job code & 0xFE ∈ {2, 22, 26, 34, 64}; the HoYD is not counted again):
  298. sum += j(staff), n += 1
  299. score = sum / n (integer division); no HoYD and no qualifying staff → 1
  300. j(x) = clamp(round(JPP/5), 1, 20)
  301. ```
  302.  
  303. **Which staff count** `sub_14269BAB0(person, club)`, applied to every entry of the club staff vector (club+120/+128, `ACTUAL_NON_PLAYER` / `ACTUAL_PLAYER_AND_NON_PLAYER` objects):
  304.  
  305. ```
  306. c = person->vfn1024(club, 0) # this person's contract with this club
  307. if c == null or c->vfn136() == 5: no # 5 = BASIC_CONTRACT
  308. if (c+28 & 0xFE) ∈ {2, 22, 26, 34, 64} and youth_team(c+16): yes
  309. if (c->vfn104() & 0xFE) ∈ same set and youth_team(c->vfn88()): yes # second job: byte +178, team +144
  310. no
  311. ```
  312.  
  313. `youth_team` = `sub_1428BA810(team)`:
  314.  
  315. ```
  316. age = team+44; if age ≤ 0 or age == 100: age from team type (+40):
  317. 9/0x2B → 23, 0xA/0x15 → 21, 0x21 → 22, 0x12 → 20, 0xB/0x24 → 19, 0xC/0x25 → 18, 0x1D → 17, else 100
  318. (club ids 562397–562398 → 21)
  319. nation = club+216 (club+368 if team+47) → +272 if club+185 else +264
  320. pass if 0 < age ≤ nation+1956 (max youth age; England 20)
  321. no nation: pass if type ∈ {9, 43} or (type − 10) ∈ mask 0xC800007
  322. ```
  323.  
  324. - **Job codes** (contract +28, second job +178). Even codes are names from the staff-overview colour switch `sub_140C43950` (index (code − 2)/2) and were checked in the UI. Counted roles are in bold.
  325.  
  326. | Code | Job | Code | Job |
  327. | --- | --- | --- | --- |
  328. | **2** | **Coach** | 38 | Chief Doctor |
  329. | 10 | Director of Football | 40 | Head of Sports Science |
  330. | 12 | Physio | 44 | Chief Scout |
  331. | 14 | Scout | 46 | Doctor |
  332. | 16 | Manager | 48 | Sports Scientist |
  333. | 20 | Assistant Manager | 50 | Head Physio |
  334. | **22** | **Set Piece Coach** | 58 | Recruitment Analyst |
  335. | **26** | **Fitness Coach** | 60 | Performance Analyst |
  336. | **34** | **GK Coach** | 62 | Head Performance Analyst |
  337. | | | **64** | **HoYD** |
  338. | | | 86 | Head of Player Development |
  339. | | | 88 | Technical Director |
  340.  
  341. - **Bit 0 = also a player.** Every odd-coded person in the save is an `ACTUAL_PLAYER_AND_NON_PLAYER` (vtables 0x145C7F458 / 0x145C7ECB8). `sub_142692F20(person)` tests bit 0 of either job, and a caller treats job ≤ 1 as "player only".
  342. - Codes seen: 3 (player-coach, 10), 17 (player-manager, 1), 21 (player-assistant, 2), 27 (1), 35 (player-GK coach, 10), 61 (1) and 89 (1).
  343. - The filter masks bit 0, so a player-coach counts as a coach.
  344. - **Contract classes** (vtable +136 = type):
  345.  
  346. | Class | Type |
  347. | --- | --- |
  348. | `FULL_CONTRACT` | 0 |
  349. | `LOAN_CONTRACT` | 1 |
  350. | `TRIAL_CONTRACT` | 2 |
  351. | `B_CLUB_CONTRACT` | 3 (presumed) |
  352. | `YOUTH_TRIAL_CONTRACT` | 4 |
  353. | `BASIC_CONTRACT` | 5 |
  354. | `CONTRACT` (base) | −1 |
  355.  
  356. - `BASIC_CONTRACT` is a **national-team job**. All 47 in the save sit in a staff member's extra-contract array, and each points to a `NATIONAL_TEAM_CONTAINER` (vtable 0x145A6CD98, +186 = 1, not in the club array) at senior, U23, U21, U20 or U19 level.
  357. - Since `vfn1024(club, 0)` returns the contract with the club being scored, the type-5 check is only a guard. National jobs neither count nor block anything.
  358. - `BASIC_CONTRACT`s are 0x20 bytes, so +178 isn't a job byte on them.
  359. - **Villa (31 staff).**
  360. - Counted (all U18, type 12, age 18): Coach ×2, Fitness ×2 and GK ×2. These give j = 11, 7, 12, 11, 11, 9.
  361. - Not counted:
  362. - U21 Coach ×2, Fitness ×1 and GK ×1: age 21 > 20.
  363. - U18 and U21 Manager and Assistant Manager: wrong job.
  364. - The HoYD (64): on the first team, so he fails the youth-team test and isn't double-counted.
  365. - Without the JPP 7 coach, the score would be (74 + 54)/9 = 14.
  366. - In the all-club census, codes 22 and 64 appear only at first teams, so in practice the counted roles are youth-team Coach, Fitness and GK coaches.
  367.  
  368. - Staff fields: +0x24 **Working with Youngsters** (1–20), +0x34 **Judging Player Ability** (0–100), +0x35 **Judging Player Potential** (0–100). All three were matched to the UI (Villa HoYD: WwY 19, JPA 80 → 16, JPP 90 → 18).
  369. - The rounding is confirmed by club 1542 (HoYD JPP 38, WwY 12, no other staff): 2·(8 + 12)/4 = 10, as logged; truncation would give 9.
  370. - A good HoYD barely moves the score, and a weak one is worse than none. With Villa's staff (j = 11, 7, 12, 11, 11, 9 → 61): a 20/20 HoYD gives (80 + 61)/10 = 14, the actual HoYD 13, no HoYD 61/6 = 10, and a 1/1 HoYD (4 + 61)/10 = 6.
  371.  
  372. **Live check (15 Mar 2024 intake, two runs, CE logging breakpoints at `0x142246F9A`, `0x1422470A4`, `0x14224717D`, `0x142249591`, `0x142249719`, `0x142249745`, `0x14224979A`).** Every call came from the PA generator (return `0x142249591`); `sub_14260F040` was never hit.
  373.  
  374. | Club | Nation (status) | Path | Inputs | Cap | Observed S → S + bonus |
  375. | --- | --- | --- | --- | --- | --- |
  376. | 603 Villa | England (playable) | staff | HoYD 90/19 + 6 staff → **13** | min(13, 75/5) = 13 | 75 → 76, 77, 80, 81, 83, 85, 85, 86 |
  377. | 650 | England | staff | HoYD 71/15 + 3 staff → 12 | 12 | 75 → 76…86 |
  378. | 713 | England | staff | HoYD 77/16 + 4 staff → 12 | 12 | 85 → 85…96 (≥ 90 before the jitter in 11 of 16) |
  379. | 862 | France (view-only) | JC | JC 14, S 85 ≥ 71 | 0 | 85 → 85 |
  380. | Scottish / US clubs | not loaded | JC | JC 5–14 | min(JC, S/5) = 3–10 | e.g. 54 → 62, 48 → 52, 17 → 17 |
  381.  
  382. - All bonuses fit `0 ≤ bonus < cap`.
  383. - **Effect at Villa:** S′ stays in the 75–89 band (max 75 + 12 + 1 = 88), so the PA code chain cannot change. Only S′-dependent side rules shift: the in-band push odds rise, and the 1/120 youth-recruitment jump stops applying above 79. Clubs whose S sits just below a band edge (713 at 85) can be lifted into the next band. The Monte Carlo model (`pa_gen.py`) does not include this step.
  384. - The preview's temporary players go through the same generator, so they get the bonus too.
  385.  
  386. ### 2. Score jitter and nation bonuses
  387.  
  388. - S′ = S + rand(0..3) − 2. When game-nation +1949 ≥ 2 and importance < 13, it is S + rand(0..1) instead.
  389. - Inside each band (0–9, 10–24, 25–39, 40–54, 55–74, 75–89, 90–99, 100+), types other than 4 get a chance of `(S′ − lo)·80/(hi − lo)` % to be pushed to the top of the band.
  390. - The boosts below run for types 1/2 only. Other types get them only when `v480` is set, `v475` is not set, S′ ≥ 66 and a 1/6 roll hits, so never for Villa (England is playable).
  391. - `v475` = `(status & 0xFD) == 0` means **"the club's nation is playable"**. It is **per nation, not game-wide**; earlier versions of these notes called it a game-rules flag that was 1 in the live save. `status` is the nation rules group's **league load status** (club+216 → `NATION` → +264/+272 `NATIONAL_TEAM_CONTAINER` → +368 `NATION` → +288 rules group, byte +610, read as sub-object +88 byte +0x20A; the +624 copy is used when the container's +185 is set). It is written at new-game setup by `sub_141CD2F00` (from the `PLAYABLE` / `VIEW_ONLY` league lists) and `sub_141CC3F00` (default 3): **0 = playable, 1 = view-only, 3 = not loaded**; 2 also passes the mask. Live (setup confirmed by the user): England 0 → `v475` = 1; France 1, Scotland (793) 3 and the USA (390) 3 → `v475` = 0. Every "with/without `v475`" rule in these notes therefore splits playable nations from view-only or unloaded ones.
  392. - `v480` = importance ≥ 13 and league level ≤ 1. With a "major" nation, importance ≥ 9 and level ≤ 1, it is set 1 time in 4 instead.
  393. - **Top-flight lift** (S′ ≥ 31, league level 0): `rand(100) < topYRec` → S′ = max(S′, clamp(natRep/120, 45, 80)).
  394. - **Club-nation specials:**
  395. - 1649 (Argentina): 1/55 → +rand(75), else 1/50 → +rand(40).
  396. - 1651 (Brazil): up to three rolls, each adding up to 90.
  397. - **England 765, France 769, Germany 771, Italy 776, Netherlands 784, Portugal 788, Russia 791, Spain 796, Türkiye 799 and Ivory Coast 24**, when S′ ≥ 31: 1/21 → S′ = max(S′, rand(120)), else 1/5 → max(S′, rand(70)). This "wonderkid lottery" is the main route to a very high S′.
  398. - **Continent** of the club nation (nation +240 → continent, id at +12: 1 Africa, 2 Asia, 3 Europe, 4 North America, 5 Oceania, 6 South America): South America, importance ≥ 5: 1/20 → max(S′, 60 + rand(30)). Africa, importance ≥ 6: 1/32 → max(S′, 35 + rand(30)). Without `v475` the odds double. Europe gets no continent bonus.
  399. - **Hard-coded clubs:** 485678 RGUOR Minsk, Belarus (1/6 → +rand(25)) and 3506513 ASEC Mimosas, Ivory Coast (1/75 → +rand(100)).
  400. - **Youth-recruitment jump** (30 ≤ S′ ≤ 79): with `v475`, 1/120 → S′ = min(80, S′ + rand(2·(YRec + JC))) (top parent's values). Without it, S′ += rand((YRec ≥ 12 ? 110 : 80) − S′) with 1/8, which can land S′ in the 90+ band.
  401.  
  402. ### 3. PA range code
  403.  
  404. The game picks a code from a chain of "1 in N" rolls tried from best to worst. The first hit wins; otherwise the default is used. Codes map to ranges via `sub_142127090` (decompiled; table confirmed):
  405.  
  406. | Code | −1 | −2 | −3 | −4 | −5 | −6 | −7 | −8 | −9 | −10 |
  407. | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
  408. | PA range | 0–20 | 10–40 | 30–60 | 50–80 | 70–100 | 90–120 | 110–140 | 130–160 | 150–180 | 170–200 |
  409.  
  410. The same function also maps −15 → 0–30 and −25/−35/…/−95 → 20–50/40–70/…/160–190 (lo = 20·(k − 1.5) for code −(10k + 5)); anything else → 0/0. These codes are not produced on the youth path.
  411.  
  412. Top bands (the ≥ 90 row is reached via the wonderkid lottery or high JC; there is no band above it, from the code-selection chain near line 2901 of `sub_142248F70`):
  413.  
  414. | S′ band | Type 1 | Type 2 | Type 3 | Type 4 and 6 |
  415. | --- | --- | --- | --- | --- |
  416. | ≥ 90 (types 1/2 differ at ≥ 100) | −10 1/16 (≥ 100: 1/8), −9 1/2, else −8 | −10 1/20 (≥ 100: 1/10), −9 1/3 (≥ 100: 1/2), else −8 | −9 1/12, −8 1/3, −6 1/2, else −7 | −4 1/9, −3 1/6, else −5 |
  417. | 75–89 | −10 1/36, −9 1/3, −8 1/2, else −7 | −10 1/60, −9 1/4, −8 1/2, else −7 | −7 | −6 1/30, −5 1/14, −3 1/4, −2 1/7, else −4 |
  418. | 55–74 | −9 1/6, −8 1/3, else −7 | −9 1/8, −8 1/4, else −7 | −6 | −5 1/26, −3 1/4, −2 1/8, else −4 |
  419.  
  420. - **Halving** (only without `v475`): junior coaching ≥ 16 halves N for the −8 roll for types 1/2; otherwise the marked −7 or −6 roll is halved. It is off for playable nations such as England.
  421. - **Upgrade ladders** (pseudocode ~1710–2041). Without `v475`, 1 in 3 takes path B; with `v475` it is always path A. Path A, in leagues of level ≤ 3:
  422. 1. Go one code better with 1/20 if code ≥ −6, then 1/6 if ≥ −5, then 1/3 if ≥ −4.
  423. 2. **Youth-rating gate:** continue only if `rand(50) + 50 ≤ YR`. England's 135 always passes.
  424. 3. Continue only if `rand(15) ≤ topJC` and code ≥ −5.
  425. 4. A ladder of 1/5, 1/4, 1/3, 1/3, 1/2 one-step upgrades, stopping as soon as the code passes −4, −3, −2, −1. **This is the stage that was previously untraced.** It mostly lifts type 4/6 players from −3/−4 to −5.
  426. - **Youth-recruitment upgrade:** code −5/−6 with S′ ≥ 61 → **−8** when `rand(90) + 12 < YRec` (5.6 % for Villa).
  427. - Without `v475` there are two more stages, both off for playable nations: −4/−5 → −7 at a rate of (YRec − 5)/50, then a cascade keyed on the global `byte_14642F38A`. That byte is the **new-game database size** (set in `sub_143184A30` from "SMALL"/"MEDIUM"/"LARGE" = 0/1/2, saved with the game and restored in `sub_1431E3F50`); live = 0 (Small). It is also read by the per-club intake (`sub_1436162F0`).
  428. - **Cap:** a code more than two bands better than the chain result is pulled back to chain − 2 with 19/20.
  429. - Tiny clubs (team rep ≤ 500, S′ ≤ 10) get a literal PA of 1–10.
  430. - **Value** (`sub_142127330`). The range floor is raised to CA (hi = CA + 5 if needed). The value is the top 10 points of the range 1/4 of the time, the bottom 10 points 1/4, and the middle 1/2. Values ≥ 180 are re-rolled with 1/2 and values ≥ 190 with 49/50. Then +0/1 is added and the result is clamped to 1–200.
  431. - `sub_14217CB40`: if PA < CA afterwards, PA = CA + 5 + rand(15).
  432. - Types 8/9 (not produced by the youth type roll) and "special teams" (types 5/7, nation 390) take separate early exits. Both special-team tests are gated by globals `byte_146435261` (live 1) and `word_146435283` (live 0):
  433. - `sub_14289C970(team)`: team ID is one of the 28 **MLS academy** clubs (Seattle Sounders Academy 164040, Nashville SC Academy 31051842, 72006961–72006974 except 72006969, …, St. Louis CITY SC Academy 2000153734).
  434. - `sub_14289CA80(team)`: the team's competition is a **USL PDL** division (164021–164028), USSL D2 Mountain (20031727), 20016870 or 981733, and the competition nation's flag (+264 → +1150) is not negative.
  435. - Full spec: `pa_spec.md` / `pa_gen.py` (Monte Carlo reimplementation) from the session work.
  436.  
  437. ### 4. Post-caps (`sub_14361FB60`)
  438.  
  439. The block is skipped when the global `qword_14643528D` is set, the type is not 6 and template +52 ≠ 2. That global is a **"world loaded" flag**: it is set to 1 at the end of new-game setup (`sub_143188320`) and of save loading (`sub_1431E3F50`), and cleared while a game is being set up or loaded (`sub_14007B460`). Live = 1.
  440.  
  441. - PA ≥ 121 is replaced by 120–130 for type 6 fillers in game, and for **every** type while the world is not loaded (newgens generated during new-game database setup).
  442. - In game, for types other than 6 with template +52 == 2 (not the youth path seen live), PA is capped at `1.85·S′` (×1.35 or ×1.65 by league level; 165 at age ≥ 18) ± 7.
  443. - If CA > PA, CA is pulled back to PA (−5 above 100).
  444.  
  445. ### 5. Nation PA quota stage (`sub_14361FB60` ~lines 430–990)
  446.  
  447. This runs only when mgr+304 is set. It uses the quota object for the **club's** nation and is skipped for type 1 and for nations with Σ targets < 10.
  448.  
  449. 1. **Floor and ceiling bands.** With `v475` they come from top-parent junior coaching: JC > 14 → (4, 9); 12–14 → (3, 8); 9–11 → (2, 7); otherwise (1, 6). Villa (JC 14) gets **(3, 8)**. Without `v475` they come from nation importance: < 6 → (2, 5); ≤ 10 and not major → (2, 4); otherwise (3, 8).
  450. 2. **Exemption.**
  451. - A player given a forced CA/PA record (`a4`, see section 6) with flag `a5` set is exempt.
  452. - When importance ≥ 6, a player is also exempt if `rand(150) + 10 < topJC`, the league level is ≤ 1, PA ≥ 126 and `v475` is set. Villa's JC 14 never passes this.
  453. 3. **Downgrade.** While band > floor and the band is "full", move down one band.
  454. - Full means `act ≥ max(tgt + slack, int(tgt·m))`, where slack = 5/3/1 and m = 1.3/1.2/1.1 by target size (`sub_145157FA0`).
  455. - For weak nations and bands ≥ 7, full means `act ≥ max(1, tgt)`.
  456. 4. **Upgrade.** This happens only if there was no downgrade, type ≠ 6, the player is not exempt, and band < ceiling. It repeats until the ceiling: stop if `act[b+1] ≥ tgt[b+1] + v132` (v132 = −5 with `v475`, else 0), or with 1/v125; otherwise b++.
  457. - v125 depends on the player's **positional ratings** (player +520…+534, 1–20), read through vtable getters +952 = ST, +832 = best of AML/AMC/AMR, +816 = best of DL/DC/DR, +808 = GK:
  458. - 12 if ST ≥ 18 or best AM ≥ 18 (strikers, attacking midfielders);
  459. - else 8 if best D ≥ 18 (defenders);
  460. - else 5 if GK ≥ 18 (keepers);
  461. - else 10 (midfielders, wing-backs, etc.).
  462. - So each step stops with 1/12, 1/8, 1/5 or 1/10: keepers are the least likely to be lifted far.
  463. 5. If the band changed, PA is re-rolled from code `~band` with the CA floor. For example, band 7 → code −8 → 130–160 (+1 possible), which is how 160/161 appear.
  464.  
  465. The increment uses the player's own nationality, but the gating uses the club's nation. So a foreign newgen at an English club can be lifted by England's room even if their own nation's band is over target. Villa's nation-801 keeper reached PA 158 while 801's band 7 was at 21 against a target of 18.
  466.  
  467. Effect for Villa (Monte Carlo, P(PA ≥ 140), no quota → live quota): type 2 64 % → 88 %; type 3 2 % → 66 %; type 4 0.2 % → 52 %; type 6 unchanged (no upgrades). If band 7 is already full: type 3 2 %, type 4 1 %. **So the intake date order within the nation matters:** Villa was processed early, with about 8 band-7 places left for the whole country, and took 5 of them.
  468.  
  469. ### 6. CA top-up from final PA (`sub_1421C0210`, called ~line 1032)
  470.  
  471. It is skipped only when the generator is given a **forced CA/PA record** (`a4`: CA at +88, PA at +90) with a valid CA or PA and template +53 == 0. That record is passed in by the caller or, with 1/25 when instantiating, picked from the nationality's list (`nation +264 → +1256`, `sub_14261E9C0`); `sub_1425287D0` copies its CA/PA onto the player. These lists hold no valid CA/PA in the live save (England 418 records, Wales 7, France 26, Germany 12), so the top-up always runs. (Earlier versions of these notes called this a "relative"; it is not.)
  472.  
  473. 1. **"Strong club" flag (v27).** Set when club +362 == 1, or the club's first team plays at league level (competition +418) < 2. When the global `word_14642F248` is set and the nation-rules byte +522 is 0 or 2 (both true live), v27 is only applied if `rand(125) < C`, where C is the CA score (Villa 72 → **57.6 %**). Villa has +362 = 1 and is in the Premier League (level 0).
  474. 2. **Base percentage.**
  475. - PA > 145 (and PA 100–145 when the US flag `a3` is set and the team is not an MLS academy):
  476. - v27 off: 55 with 1/15, else 52 with 1/3, else 50 (24/25) or 45 (1/25). Overall about 6.7 / 31 / 60 / 2.5 %.
  477. - v27 on: 55 (~25 %) or 52 (~75 %).
  478. - PA > 175 differs slightly in both cases.
  479. - PA 100–145 (normal case):
  480. - v27 off: 50 with 1/12, else 45 with 1/5, else 40 (8 / 18 / 73 %).
  481. - v27 on: 55 with 1/6, else about 50 (32 %) or 45 (51 %).
  482. - PA ≤ 99: 20 + rand(10). Type 8: 85 + rand(10).
  483. - Clubs in Hong Kong (nation 111), age ≤ 19: −(25 + rand(15)) if the base is ≥ 41, then −rand(10) if still ≥ 11.
  484. 3. **Age adjustment** (`vtbl+408`, age today): under 16 −2.5 per year under 16; 16 → −5; 17 → 0; over 17 → +5 per year. Age > 24 floors the percentage at `100 − (20 − attr)`.
  485. 4. **Target.** `v = trunc(min(100, pct) · PA / 100)`. If club +362 ≠ 1 and v > 100, then v = 100 + 0.15·(v − 100) (not for Villa).
  486. 5. **If v > CA:** CA = v + rand(10) − 5. (A softer `(3·CA + 2·v)/5` branch exists for PA ≤ 144 when `rand(15) ≥` best YF, but only for clubs with no nation.)
  487. 6. **Otherwise** (age ≤ 20): if CA > `max(80, (5·age − 25) % of PA)`, it is set to that value + rand(8) − 4.
  488. 7. Finally, if CA ≥ PA, CA = PA − 1 − rand(5).
  489.  
  490. So a quota-boosted youngster ends with CA ≈ 40–55 % of PA. That is why Villa's high-PA intake also had CAs of 53–81. Every Villa CA fits this model; #4 (PA 161, CA 68) and #1 (below) need v27 off.
  491.  
  492. ## CA on intake day (`sub_14217BE60`)
  493.  
  494. 1. **CA score C** = `sub_142247230(club, 0, …)` = `(4·JC + YF + firstTeamRep/100) / 2`. Villa: (56 + 18 + 70) / 2 = **72**. Scores ≤ 74 have a 1/25 chance of losing rand(C/2).
  495. 2. **CA range by band and type** (`sub_142247BE0`). Columns are the template type; "Other" is types 3, 6 and the rest:
  496.  
  497. | C band | Type 1 | Type 2 | Other (3, 6, …) | Type 4 |
  498. | --- | --- | --- | --- | --- |
  499. | ≥ 90 | 105–135 | 65–100 | 45–75 | 30–50 |
  500. | 75–89 | 95–125 | 60–90 | 40–70 | 30–45 |
  501. | 55–74 | 85–125 | 45–80 | 35–60 | 25–40 |
  502. | 35–54 | 65–95 | 40–60 | 30–50 | 20–35 |
  503.  
  504. A parent club with better junior coaching gives a 1/3 chance to use the type-2 row.
  505. 3. **CA = rand(lo..hi).** With probability `PA²/60000` (always when PA > 150), CA is instead `max(PA/5, PA−75)`, capped at `max(PA/3, PA−50)`. CA is never above PA.
  506. 4. CA is then usually replaced by the **top-up from final PA** (PA section 6). For high-PA players the table above only matters as the floor for the PA re-roll; low-PA players keep values from it (Villa's PA-62–99 players: CA 31–55).
  507.  
  508. ## Attributes on intake day: archetypes and the HoYD's coaching style
  509.  
  510. Static analysis only (the game was not running). The **HoYD's preferred formation/tactic is never read**. Archetypes are not shipped data: they are generated from the database at new-game setup (see "Where archetypes come from"). His coaching attributes bias which attribute archetype is picked.
  511.  
  512. ### Manager and call chain
  513. - Global `qword_14642B720` (almost certainly `&mgr + 24`, the third `REGENERATION_MANAGER` vtable sub-object; the constructor `sub_14360CD30` writes vtables at +0, +8 and +24). Offsets below that are relative to it (+120/+128) are absolute mgr +144/+152. Base vtable `0x145C77A48` (RTTI `REGENERATION_MANAGER_BASE`), whose +32 is a stub returning 0. Derived `REGENERATION_MANAGER` vtable `0x145AF9A08`, whose +32 is `sub_143637DE0`.
  514. - `sub_142179240` (regen builder) → `sub_1447DB780` → `sub_1447DD470` (attribute filler) → manager +32 (`sub_143637DE0`) → `sub_14362D030` (picker).
  515. - `a7` is `v320` = `v21` in `sub_142179240` (~line 701). It is 0 once the world is loaded (`qword_14643528D` ≠ 0), or otherwise `(person flags +32 & 8) == 0`. So for real intakes a7 = 0, and the final override below runs.
  516.  
  517. ### Archetype record (`NEWGEN_TEMPLATE` pool, 296 bytes; vector at mgr +144/+152/+160, i.e. sub-object +120/+128)
  518. | Offset | Meaning |
  519. | --- | --- |
  520. | +0 | Role (qword, from `sub_1421983F0(player, 1 << posBit, 0, 0, 0)`; used as a bitmask by the chooser). The lowest set bit becomes player +615 (role index). Masks 0x2000000000000, 0x8000000 and 0x100000000000 swap the feet against the side. |
  521. | +8 | Weight (int; read as u16 by the picker) = number of database players merged into it |
  522. | +12 | Area tag: positive = nation id (playable nation), negative = −continent id (1 Africa … 6 S America). The builder can also write −99 (player's nation has no continent). In the picker, −99 is not a tag but means "no area filter". The loader frees tags ≤ −8 other than −99 and flags a rebuild. |
  523. | +16 | 69 float multipliers; attribute block index i is at +16+4i. Indices 15–68 are the clustered shape (below); the source of 0–14 at creation isn't traced |
  524. | +292 | Position-group code (as from `sub_14364E330`) |
  525. | +293 | Height band: 0 = <177 cm, 1 = 177–185, 2 = ≥186. Height comes from person vtable +696 (PERSON default 182). |
  526.  
  527. Player attribute block (player +520, 69 bytes): indices 0–14 are positional ratings, and 15… are attributes in FM's internal order: 15 Crossing, 16 Dribbling, 17 Finishing, 18 Heading, 19 Long Shots, 20 Marking, 21 Off the Ball, 22 Passing, 23 Penalties, 24 Tackling, 25 Vision, 26–31 GK (Handling, Aerial Ability, Command of Area, Communication, Kicking, Throwing), 32 Anticipation, 33 Decisions, 34 One on Ones, 35 Positioning, 36 Reflexes, 37 First Touch, 38 Technique, 39 Left Foot, 40 Right Foot, 41 Flair, 42 Corners, 43 Teamwork, 44 Work Rate, 45 Long Throws, 46 Eccentricity, 47 Rushing Out, 48 Tendency to Punch, 49 Acceleration, 50 Free Kicks, 51 Strength, 52 Stamina, 53 Pace, 54 Jumping Reach, 55 Leadership, 56 Dirtiness, 57 Balance, 58 Bravery, 59 Consistency, 60 Aggression, 61 Agility, 62 Important Matches, 63 Injury Proneness, 64 Versatility, 65 Natural Fitness, 66 Determination, 67 Composure, 68 Concentration. The feet at 39/40 and the coherent category triples confirm the order. Values are generated on 1–20 and stored ×5.
  528.  
  529. ### Where archetypes come from: `sub_14362DD90(mgr, area)`
  530. - **When.** End of new-game setup: `sub_143188320` → `sub_143610130` (thunk) → `sub_157C73C10`. That calls the builder once per nation in `qword_14642ED30`+128 that passes the playable check (area = nation id), then once per continent in `qword_14642ECF0`+128 (area = −continent id), then sorts. The list is serialised in the save (`sub_14360F7A0` loads it).
  531. - **Top-up `sub_143630BE0(mgr)`**, called from `sub_142D1AF90` (large world-update routine; trigger not identified, possibly add/remove leagues). Archetypes of nations that are no longer playable get tag −1. Playable nations with no archetypes are built. **All negative-tag archetypes are deleted and every continent is rebuilt**, then the list is re-sorted.
  532. - **Player selection** (all players `qword_14642EDD0`..`EDD8`):
  533. - person vtable +408 (`&dword_145A4C04C`) ≥ 20 (almost certainly age);
  534. - not flag +32 & 8 (regen) unless `BYTE6(qword_146435270)`;
  535. - nationality (person sub-object +72, via vbtbl[2] + 80) non-null;
  536. - area > 0: nationality id == area. Area < 0: the nation fails the playable check (via person vtable +560 → +264/+272 → +368 → +288, as in the picker), and nationality +240 → continent +12 == −area.
  537. - **CA ≥ min**: `min = int((N+556 / N+420) × 1.25)` with N = vtable+560 → +264/+272 (25 if +420 ≤ 0). Raised to a floor from `r = lroundf(N word +1144 / 10)`: r ≥ 15 → 50, ≥ 12 → 40, ≥ 9 → 30, ≥ 5 → 25, else 10. (+1144 is probably reputation; +556/+420 unidentified.) For a nation call, min is computed once from the first player; for a continent call, per player.
  538. - **Shape.** `L = int(CA/20 + 6)` (not +6.5). Attribute values are raw bytes (player +535 + i, 0–100) → `clamp((x+2)/5, 1, 20)`. `m_i = (attr_i / L)^1.2`. Pass 1 accumulates per-group sums for all 69 indices over the player's natural groups (`sub_14364E330`), giving the group averages used by the distance function.
  539. - **Per sample** (pass 2): one sample per natural position bit (0–14, excluding 1 = SW) in each natural group. Role = `sub_1421983F0(player, 1 << bit, 0, 0, 0)`. For i = 15–68, clamp by role class `sub_1419C7820(role)(i, role, 0)`:
  540. - class 0 → max(m, 0.85);
  541. - class 1 → clamp(m, 0.7, 1.25);
  542. - otherwise, if position weight (`qword_14642F3A0[sub_1419C9810(bit)]` byte i) > 0 → clamp(m, 0.5, 1.1);
  543. - no clamp if there is no role, or the weight is 0.
  544. - **Height band**: <177 → 0, 177–185 → 1, ≥186 → 2. **Tag**: N+12 if N is playable, else −(N+368 → +240 → +12), else −99.
  545. - **Clustering.** Find the template with the same group (+292), role (+0), band (+293) and tag (+12, or any negative if the tag is −99) at minimum `sub_145159520` distance. If the distance is ≤ 19, merge: `m = (m·n + v)/(n+1)`, weight n+1. Otherwise create a new one with weight 1.
  546. - **Distance `sub_145159520(tmpl, cand, groupAvg)`.** Over the 54 attributes whose position weight byte (`qword_145D03F10[group]` → `qword_14642F3A0`) is ≥ 2, bucket `m/groupAvg`:
  547. - ≤ 0.5 → 0
  548. - ≤ 0.7 → 1
  549. - ≤ 0.9 → 2
  550. - < 1.1 → 3
  551. - < 1.3 → 4
  552. - < 1.5 → 5
  553. - else → 6
  554.  
  555. A bucket difference ≥ 2 adds 1, or 2 if the weight byte is ≥ 4.
  556. - **Prune** (per area): delete if weight ≤ 4 or 100·weight / (area's total weight in that group) < 3.
  557. - **Sort `sub_143613420`**: tag ascending (continents −6 S America … −1 Africa, then nation ids), then group ascending, then role (signed qword) ascending, then **weight descending**.
  558.  
  559. ### Archetype category (computed from the multipliers)
  560. Sums of three multipliers: Attacking (4) = Fin + OtB + Vis; Defending (5) = Mar + Tck + Pos; Fitness (3) = Str + Sta + Pac; Tactical (6) = OtB + Dec + Vis; Technical (7) = Tec + FTo + Dri; Mental (8) = Bra + Concentration (index 68, confirmed in the picker and wrapper; not Consistency) + Wor; Set pieces (9) = Cor + FK + LTh. The order is as listed; a later one wins only if strictly greater. If avg(Att, Def, Fit sums) > 0.8 × max, the category is 1 (balanced).
  561.  
  562. ### HoYD category: `sub_1420FF9D0(staff, 0)`
  563. - Job code & 0xFE: 2 (Coach), 16, 20 and 64 (HoYD) → computed. 22 Set Piece → 9; 26 Fitness → 3; 34 GK → 2 (never matches an archetype); else → 1.
  564. - Staff raw bytes (0–100) → `clamp((x+2)/5, 1, 20)`: +58 Attacking, +59 Defending, +60 Fitness, +61 Mental, +62 Technical, +63 Tactical, +75 = set-piece slot (**unidentified in-game**).
  565. - Argmax tie order: Att(4), Def(5), Tac(6), Tech(7), Men(8), Fit(3), +75(9). If `int((Att+Def+Fit+Tech+Tac+[+75])/6) > 0.8·max` (**Mental excluded** from the average), the category is 1.
  566. - No HoYD → 0 → no bias.
  567.  
  568. ### Picker: `sub_14362D030(mgr, player, cat, a4=0, a5=0, a6=0)`
  569. Vtable slot `0x145AF9A38` (mgr+24 interface, vtable +0x30). a4 = 1 is the internal retry (whole list, no further recursion). **a5 = 1 = ignore height**: W counts every band and the walk breaks regardless of band (used only by `sub_1448DE620`, below). a6 is an out-pointer. The roll is `r = (pcg32 × W) >> 32` with W read as int16 (`movsx`).
  570. - Eligible: the archetype's group is among the player's natural groups (ratings ≥ 15 → groups via `sub_14364E330`). The height band is checked at the break test, so non-matching bands still consume weight.
  571. - Area. N = person vtable +560 → +264 (+272 if person flag 0x1000 and `BYTE2(qword_14643529D)`). "Playable" = `word_14642F248` and N+368 → +288 → (+624 or +88) → flag +68 and [522] & 0xFD == 0 (league load status 0/2). The total and the walk use **different** area filters:
  572. - **Total W** (a4 = 0): area = N+12 if playable, else −continent. Counts only archetypes in the player's groups **and height band**.
  573. - **Walk**: area = N+12 if playable. Otherwise it is chosen with the **roll's low bit**: even → −continent; odd → −99 = **no area filter (whole list)**.
  574. - Odd rolls for non-playable nations therefore walk the whole sorted list with a roll sized for one continent. Continent sets come first (−6 S America, −5 Oceania, −4 N America, −3 Europe, …), so the pick lands in the earliest continent sets that have templates for his groups. This is probably a bug; its size depends on the save's list.
  575. - `r = rand(W)` (0..W−1), where W is the sum of eligible weights **without** doubling and only for the player's band. Iterate in list order: `r -= weight × (cat match ? 2 : 1)`, and break at the first band-matching archetype with r ≤ 0. The first archetype gets w + 1 outcomes, and a match gains up to 2× at the expense of later entries (none if it is last). Other-band archetypes also consume r without being pickable, which pushes their share onto later entries. Because the sort puts the heaviest archetype of each role first, the HoYD doubling most helps the most common archetypes.
  576. - If nothing is picked, recurse with a4 = 1: no area filter, and W is recomputed over the whole list (band-only). If that also finds nothing, return 0: the wrapper returns false and no archetype is applied (T = 0).
  577.  
  578. ### Live dump and live validation (March intake, England the only playable nation)
  579. - **Location.** mgr = `qword_14637C8B8` (0x3043D480 in that session); `qword_14642B720` = mgr+24. Vector at mgr+144/+152 holds **pointers** to 296-byte records (335 entries). Session copy: `files/archetypes_live.csv`.
  580. - **Counts.** 335 archetypes, total weight 10,091. England (765) 75, Europe 76, S America 60, Africa 51, N America 45, Asia 28, Oceania 0 (all pruned). Indices 0–14 of the multipliers are 0 in every record.
  581. - **Categories** (count, share of weight): Balanced 220 (62.2 %), Technical 81 (29.7 %), Mental 17 (5.8 %; all 16 GK archetypes + Europe ST PF 177–185), Fitness 9 (1.2 %), Attacking 4 (0.6 %), Tactical 3 (0.4 %), Defending 1 (0.1 %), Set pieces 0.
  582. - **Group codes (+292):** 0 GK, 1 FB, 2 CB, 3 DM, 4 CM, 5 WM, 6 AMC, 7 W, 8 ST, 9 WB. Natural positions (player +520+i ≥ 15, i = GK, SW, DL, DC, DR, DM, ML, MC, MR, AML, AMC, AMR, ST, WBL, WBR) map via mask table `dword_145AFAC64` (1, 2, 8, 0x10, 4, 0x80, 0x200, 0x400, 0x100, 0x1000, 0x2000, 0x800, 0x4000, 0x40, 0x20). Multi-position players pool several groups (35 of 63 intake players).
  583. - **Role bits (+0)**, names from `role_mask_names` (0x140ABC790): 0 GK, 1 CD, 2 FB, 3 WB, 4 DM, 5 CM, 6 WM, 7 W, 9 AM, 10 DLF, 11 AF, 12 SK, 14 Libero, 15 DLP, 16 B2B, 17 AP, 18 TM, 19 P, 20 CF, 24 BPD, 27 IF, 28 BWM, 29 NCB, 30 DW, 31 PF, 32 Treq, 33 Anchor, 35 HB, 36 NFB, 37 Enganche, 38 CWB, 39 Regista, 40 F9, 41 SS, 42 WTM, 43 WP, 44 IWB, 45 Raumdeuter, 46 RPM, 47 Mezzala, 48 Carrilero, 49 IW, 50 SV, 51 WCB, 52 IFB. The foot-swap masks are IW (49), IF (27) and IWB (44).
  584. - **Live validation.** CE hardware breakpoints on picker entry (0x14362D030), the roll (0x14362D42D: r9 = r, r15w = W) and the wrapper return (0x143637E0E). The simulator reproduced **all 62 intake picks** exactly: 26 England (own tag), 18 Europe even (−3), 18 Europe odd (whole list → landed 9 in −6, 5 in −4, 4 in −3). One GK < 177 cm had W = 0 in both passes → no archetype (no GK or CB < 177 records exist anywhere). HoYD cats seen: 0, 1, 6, 7, 9.
  585. - **Second caller `sub_1448DE620`** ("ACTUAL_PLAYER"; return 0x1448E07E1) calls the picker with cat 0, a5 = 1. All 39 of its picks replay in ignore-height mode. Its callers include `sub_1448D78B0` ← `sub_1448D84F0` (`virtual_manager.cpp`, `get_virtual_players`, "All star team…"), so it generates virtual/filler players, not the intake. At entry, [RSP+0x28] read 0 for this path; a5 = 1 is from the call site.
  586. - **Reachability (England, single group, simulated with the exact walk).** Because band is not a sort key, other-band records ahead of a role consume r. 30 of 75 England archetypes (890 of 3,434 weight) can never be picked with no HoYD (36 Balanced HoYD, 32 Technical, 31 Mental). Example ST 186+: W = 27 + 56 + 11 + 13 = 107, but DLF(177–185) 17 + AF(177–185) 63 + AF(<177) 33 = 113 precede AF(186+) → always AF, never TM/P/PF. Per-group odds: forum Part 6b, "What the templates look like in a real save".
  587.  
  588. ### Chooser: `sub_143637DE0`
  589. It copies the 69 floats to `v813`, sets `*a5 = (archetype cat == HoYD cat)` and `*a6 =` the role mask. On a match, DD470 sets `*a10 = HoYD`, and `sub_1447DB780` calls `sub_142166530(player+128, HoYD, 11, 100)`: the same relationship the personality pull adds (probably favoured personnel; unconfirmed).
  590.  
  591. ### Applying it: `sub_1447DD470`
  592. Per attribute index i:
  593. 1. `v98 = int(CA/20 + 6.5)` (CA = +512, PA = +514). X = PA (1/3) or rand[CA, PA] (2/3); `lvl = int(X/20 + 6.5)`; `b = min(lvl, v98) + rand(|lvl − v98|)`.
  594. 2. Position weight w (`qword_146427F68` via `sub_1419CF670`), adjusted by the role class from `sub_1419C7820`: class 0 floors w at 4, 1 floors at 3, 2 caps at 1, 3/255 caps at 2.5. Then `b += rand over [0, 2(w − 2.5))` (negative when w < 2.5), and `b` (v856) is clamped to 1–20.
  595. 3. `T = clamp(int(m_i × b), 1, 20)` (v859). T = 0 if not youth, there is no archetype, a preset role mismatches, or age ≥ 30 (v848).
  596. 4. The normal value (v862) is computed by attribute-specific code (~lines 1600–1940).
  597. 5. Gate (~2174–2470): `v264 = rand(24) ≠ 0`, preceded by `rand(20) ≠ 0` when v862 > T. Extra attribute-specific gates apply (e.g. 18 Heading, 25 Vision, 38 Technique, 50 Free Kicks, 57 Balance, 58 Bravery, and Teamwork/Work Rate get a further 2/3). Requires v855 (position weight > 0), T > 0 and a7 == 0.
  598. 6. Override (~4145): T ≥ b → `v = T − 2 + rand(5)`; else `v = T + rand(3)`. Then with 1/4: `v = (v98 + v)/2`.
  599. - The "similar players" min/max clamp (v816) is skipped for youth (v833 = 1 when flag 8).
  600. - `sub_14274B3B0` runs afterwards: it re-derives best position (+609) and walks all 69 values. Probably CA normalisation (unverified).
  601.  
  602. ## Nationality, position and the Head of Youth Development
  603.  
  604. Static analysis (IDA). The HoYD (`sub_1447E66B0`, job role −93) has **no influence on nationality or position**. Within six calls of the template filler `sub_143627E00`, the HoYD is reached only through `sub_142248F70`, which runs after nationality and position are fixed. It is not reached at all from `sub_143660A40` or `sub_143646F30`. Calls resolved only at run time (vtable calls) were not covered.
  605.  
  606. ### Nationality (`sub_143627E00` ~lines 1249–1660)
  607. 1. Base pick: `sub_143660A40(club, &nat, &nat2, &flag, template+53, 0, &out)` uses club, nation and region data.
  608. 2. **Board-vision override.** The club's vision objectives are reached via `GAME_CLUB` (`qword_14642DE58`) vtable +224 (`0x142E67A10`): first team +0xA0 → +0xC0 (`CLUB_HUMAN_MANAGER_DETAILS`, kind +0x70 ∈ {1,3,4}) → +0x78 vector of `CLUB_VISION_OBJECTIVE` / `CLUB_COMPETITION_VISION_OBJECTIVE`.
  609. - Each objective with [44] == 100 (play/sign players from a nation) and [48] == 1 gives a nation. The entity at +8 is used as a nation, or its +368 if it is a region (vtable+56 == 9).
  610. - Weight = ([45] − 10) / 2, where [45] is the importance. If weight > rand(6), the nationality is replaced.
  611. - Villa (Mar 2024) has no type-100 objective.
  612. 3. Fixes: special cases for Germany (771), nation ids 215446, 114502, 791 and 800, and nations with no continent (`sub_14365CC00`). Then `sub_14365A7F0` and the city → region override (`sub_143637C70` → `sub_1451566A0`).
  613.  
  614. ### Position (`sub_143627E00` ~lines 545–1185)
  615. - Template +40 holds per-position-group squad counts from `sub_143646F30` (`sub_1436162F0` ~line 3711).
  616. - Thresholds come from `unk_145AFA5C8` (default 3); the group → position map is `byte_145AF9B14`.
  617. - If fewer than 6 groups meet their threshold, the well-stocked groups are marked.
  618. - GK count ≤ 1 → favour GK (with count == 1, 8/9 of the time). With the club-vtable +1760 flag set and total ≥ 11, +50 is forced to the first under-filled group.
  619. - No squad data, batch < 5 or +55 == 0 → GK.
  620. - The natural position gets 20; nearby secondary positions roll 15 + rand(5).
  621.  
  622. ### Where the HoYD actually matters
  623. - **Preview judging** (not the real players). JPP weights PA against a CA-based projection in each candidate's R; JPA adds the star/count noise. See "Preview rating R".
  624. - **Personality** (`sub_14365B210`, from player creation `sub_143623630` ~line 1480). With 1-in-7 odds, player bytes +89…+94 each become `clamp((3×HoYD + player)/4, 1, 20)`. +91 uses vtable +1504 for both. Then `sub_142166530(player+128, HoYD, 11, 100)` adds a relationship.
  625. - **Live check (15 Mar 2024 intake).** CE logging breakpoints at `0x14365B239` (entry, rsi = player, rax = HoYD) and `0x14365B4C1` (the blend). There were 62 player creations; 38 had a HoYD and 8 were blended, about 21 % against an expected 14 %. Villa's HoYD is 6,15,12,15,12,15, and one Villa newgen went 3,15,15,12,18,15 → 5,15,12,14,13,15, matching `(3×HoYD + player)/4`. Clubs without a HoYD skip the roll. Villa's templates matched the preview-day nationality and positions, so they are fixed before intake day.
  626. - **Archetype bias** (`sub_1420FF9D0` → `sub_14362D030`). His dominant coaching category (Att/Def/Tac/Tech/Men/Fit/+75, or balanced) weights matching archetypes ×2 in the cumulative walk. Formation is not read. See "Attributes on intake day".
  627. - **Youth-staff score** (`sub_142246F70`, called only from the PA generator in the live intake). It gives types 1/2 at top-flight clubs in playable, important nations a bonus of `rand(min(score, S/5))` to the youth score before the jitter. The HoYD counts as 4 slots worth 2·(JPP/5 + WwY), and each qualifying staff member adds JPP/5 in 1 slot. Villa's score is 13. See "PA on intake day → 1b".
  628.  
  629. ## Answers to the original questions
  630.  
  631. 1. **What the preview governs.** It is generated on the same day the players' templates are, so it describes real, already-chosen people: how many there are, their positions, nationalities, ages and quality types. The grades come from the HoYD rating one random roll of CA and PA per template. On intake day ability is rolled again from the same odds. A five-star preview means the types and positions were favourable *and* the sample rolled well. It does not lock in the actual PAs.
  632. 2. **What decides the preview's quality.**
  633. - The templates' types (18 % type 2, 0.5 % type 1).
  634. - The club youth score: youth facilities, junior coaching, the nation's youth rating, and youth recruitment for foreign-born players. For types 1/2 at top-flight clubs in playable, important nations it gets a small youth-staff bonus (section 1b).
  635. - The club benchmark it is judged against: a stronger first team makes "good" harder to reach.
  636. - The HoYD's **Judging Player Potential**, which sets how much of each R is true PA rather than a CA-based projection (capped by age: at most 35 % at 15 and 50 % at 16; JPP 12+ always reaches the cap for 15–16-year-olds).
  637. - The HoYD's **Judging Player Ability**, which only adds ±0–2 noise to the stars and the count.
  638. 3. **What decides CA, PA and positions on intake day.**
  639. - Positions, age and nationality are fixed in the template.
  640. - PA = youth score band × type → a range code → a value. **The nation PA quota then moves it between bands**, which in England mostly means upward until a band reaches target − 5.
  641. - CA = (junior coaching, youth facilities, first-team reputation) band × type → a range. For most players it is then reset to about 45–55 % of the final PA, adjusted for age.
  642. - Nation wealth (`db::NATION`+460) is **not** used anywhere on this path. Population and football importance only appear indirectly, through the nation's youth rating, importance, player-count deficit and the game-start PA distribution (quota targets).
  643. 4. **Why a preview and its intake can differ.**
  644. - The preview's temporary players go through the same `sub_14361FB60`, including the quota stage (mgr+304 is effectively always set), but they are never counted.
  645. - So the preview judges them against the quota **as it stands on preview day**. By intake day the room in bands 6–8 depends on deaths and retirements in between, and on how many clubs in the nation were processed first.
  646. - On top of that, every value is re-rolled.
  647.  
  648. ## Verification on intake day (15 Mar 2024, 00:00)
  649.  
  650. Snapshots of the regeneration manager and England's quota were taken on 14 Mar (paused) and after the intake. All 16 templates became players with the template's DOB, nationality, names and positions (position 0s become 1s; some secondary ratings change). Age is at 15 Mar 2024.
  651.  
  652. | # | Type | Nat | DOB (year/day) | Age | CA | PA |
  653. | --- | --- | --- | --- | --- | --- | --- |
  654. | 1 | 4 | 801 | 2008/46 | 16 | 59 | 158 |
  655. | 2 | 3 | 765 | 2008/40 | 16 | 69 | 146 |
  656. | 3 | 3 | 765 | 2007/345 | 16 | 76 | 160 |
  657. | 4 | 2 | 765 | 2008/71 | 16 | 68 | 161 |
  658. | 5 | 4 | 765 | 2008/124 | 15 | 31 | 73 |
  659. | 6 | 2 | 765 | 2008/150 | 15 | 61 | 145 |
  660. | 7 | 3 | 765 | 2008/39 | 16 | 53 | 114 |
  661. | 8 | 2 | 765 | 2007/271 | 16 | 67 | 141 |
  662. | 9 | 4 | 765 | 2008/100 | 15 | 81 | 157 |
  663. | 10 | 2 | 789 | 2008/226 | 15 | 56 | 145 |
  664. | 11 | 3 | 765 | 2007/316 | 16 | 75 | 153 |
  665. | 12 | 6 | 765 | 2008/200 | 15 | 55 | 75 |
  666. | 13 | 6 | 765 | 2008/171 | 15 | 47 | 81 |
  667. | 14 | 6 | 774 | 2008/126 | 15 | 37 | 65 |
  668. | 15 | 6 | 797 | 2008/216 | 15 | 55 | 62 |
  669. | 16 | 6 | 801 | 2008/145 | 15 | 36 | 99 |
  670.  
  671. - **10 of 16 have PA ≥ 140.** That is impossible under the base generator for types 3/4 (2 % and 0.2 %), but it fits the quota model (66 % and 52 %).
  672. - England's band 7 went 275 → 283 and stopped at exactly target − 5 (288 − 5), which confirms `v132 = −5`. Bands 6 and 8 rose by 6 and 2. Band 8 is at 59 against a target of 55 because a band-7 re-roll (130–160, +1) can land on 160/161.
  673. - Type 6 fillers stayed at 62–99 (no upgrades for type 6), matching the model mean of about 78.
  674. - The CAs of the PA ≥ 140 players fit the top-up at roughly 45–50 % (age 15/16 adjustments). The outlier is #1 (age 16, CA 59, PA 158): only v27 off plus the 1/25 base of 45 % fits (40 % after age → v = 63 → CA 58–67). That is about 0.424 × 0.025 ≈ 1.1 % per player, or ~6 % that one of Villa's six PA > 145 players gets it. Skipping the top-up is ruled out: no forced CA/PA records exist, and a skip would leave the type-4 table CA (≤ 40). Nothing position-specific (e.g. for keepers) exists in the top-up.
  675. - Only 25 English-nationality newgens existed nation-wide when Villa was done, out of 1063 English clubs in the window. So Villa took most of the country's band-7 room.
  676.  
  677. ## Still open
  678.  
  679. - **Preview re-runs:** what sends `CNGr`, and whether re-opening the news item ever recomputes the preview (it didn't in the live test).
  680. - **Headline text** for the preview news item: presumably in the language database, not the exe (not pursued).
  681. - Minor: the exact meaning of the special-team globals `byte_146435261` / `word_146435283`, the US nation flag (+264 → +1150), and the nation-rules byte +522 that gates v27. None affect an English club.
  682. - **Archetypes:** generation is traced (`sub_14362DD90`), and the live list is dumped and validated (above). Still to do: identify nation +420/+556/+1144, person vtable +560, the top-up trigger (`sub_142D1AF90`), and the role-class meanings (0/1 = key/preferable is assumed). Identify staff +75 (the set-piece slot). Confirm that relationship type 11 = favoured personnel. Read the per-role classes in `sub_1419C7820`, and `sub_14274B3B0`.
  683.  
  684. ## Function index
  685.  
  686. | Address | Role |
  687. | --- | --- |
  688. | `sub_141CF9A40` | Rule-group daily tick; fires the preview (slot 135) and intake (slot 134) |
  689. | `sub_141CF4A20` | Intake start/end dates for a rule group |
  690. | `sub_155DA03E0` | Preview day: for each nation, `sub_1436157C0` |
  691. | `sub_1436157C0` / `sub_1436161D0` | Generate and store templates for human clubs; build the preview news object |
  692. | `sub_142D29670` | Intake window handler per rule group |
  693. | `sub_14361D9F0` | Per-nation daily intake; spreads clubs across days (`sub_14361E940`) |
  694. | `sub_1436162F0` | Per-club intake: instantiate stored templates, or count + generate (a3 = 1 → store only) |
  695. | `sub_143626D80` | "New method" template generation (sets type via `sub_142248490`) |
  696. | `sub_143627E00` | Fill a template: nationality, names, city, DOB |
  697. | `sub_143623630` | Instantiate a template as an `ACTUAL_PLAYER` |
  698. | `sub_14361B6D0` | Build the preview (grades, stars, count range) |
  699. | `sub_14361F300` | Club benchmark B |
  700. | `sub_143621270` | Overall star rating |
  701. | `sub_144255130` | Per-position grade |
  702. | `sub_1447E66B0` | Pick the assessor (HoYD) |
  703. | `sub_1426B5410` | `player_match_rating`; mode 1 = preview R (JPP-weighted PA/projection blend) |
  704. | `sub_1426F3090` | Projected ability (player +613): CA grown to 28, damped against league level |
  705. | `sub_14217E290` | Sets the +446 & 0x40 flag that bypasses the R blend |
  706. | `sub_14361FB60` | Generate a player from a template (CA/PA/attributes, caps) |
  707. | `sub_1448DE620` | Virtual-player generator (`virtual_manager.cpp` chain); calls the picker with a5 = 1 (ignore height) |
  708. | `role_mask_names` (0x140ABC790) | Role bit → role name |
  709. | `sub_14217CB40` / `sub_142248F70` | PA |
  710. | `sub_14217BE60` / `sub_142247BE0` | CA |
  711. | `sub_142247230` | Club youth score (a2 = 1 for PA, a2 = 0 for CA) |
  712. | `sub_142127090` / `sub_142127330` | PA code → range → value |
  713. | `sub_14362C720` / `sub_14362C830` | Top up club-less newgens for nations under target |
  714. | `sub_14488C660` | Build a temporary player from a template (preview) |
  715. | `sub_142E697D0` | Club screen message handler; `CNGr` re-runs the preview |
  716. | `sub_1426FD240` | Rating value → text (short/long) |
  717. | `sub_143621710` | Post the preview news item |
  718. | `sub_1421C0210` | CA top-up from final PA |
  719. | `sub_1425287D0` / `sub_14261E9C0` | Apply a forced CA/PA record / pick one from a nation's list |
  720. | `sub_14289C970` / `sub_14289CA80` | Special teams: MLS academies / USL PDL divisions |
  721. | `sub_142188A40` / `sub_142188C30` / `sub_142188A50` / `sub_1421D05F0` | Player ST / best AM / best D / GK rating (v125) |
  722. | `sub_143184A30` | New game setup; sets the database size `byte_14642F38A` |
  723. | `sub_143188320` / `sub_1431E3F50` / `sub_14007B460` | End of new-game setup / save load (set world-loaded `qword_14643528D`) / load start (clear it) |
  724. | `sub_145157FA0` | Quota "band full" test |
  725. | `sub_145158AA0` / `sub_145158DA0` / `sub_145157DC0` | Quota count +1 (targets too when a3 = 0) |
  726. | `sub_145157EB0` / `sub_15C243FF0` | Quota count −1 (person removal, from `sub_143676050`) |
  727. | `sub_145157C30` | Pick a band weighted by targets (staff generation) |
  728. | `sub_157C7A900` | Rebuild all quotas at game start |
  729. | `sub_142215070` / `sub_142211430` / `sub_1422113D0` / `sub_142215310` | Club facility getters (+288 / +299 / +300 / +301) |
  730. | `sub_143660A40` | Base newgen nationality pick |
  731. | `0x142E67A10` (`GAME_CLUB` vtable +224) | Club → vision objectives vector |
  732. | `sub_143646F30` | Squad counts per position group (template +40) |
  733. | `sub_14365B210` | HoYD personality influence (1 in 7) |
  734. | `sub_142246F70` | Youth-staff score: HoYD 2·(JPP/5 + WwY) over 4 slots + staff JPP/5, averaged |
  735. | `sub_1428D6EC0` / `sub_14269BAB0` | Club staff list / youth-staff job filter (codes 2, 22, 26, 34, 64) |
  736. | `sub_1428BA810` | Team is a youth team: age limit (+44, or from type +40) ≤ nation max youth age (+1956) |
  737. | `sub_140C43950` | Staff-overview colour by job code (job-code → role map) |
  738. | `sub_142692F20` | Person is also a player (bit 0 of either job code) |
  739. | `sub_141CD2F00` / `sub_141CC3F00` | Set nation league load status (0 playable, 1 view-only, 3 not loaded) |
  740. | `sub_143623630` | Create player from template on intake day |
  741. | `sub_142179240` | Regen builder; a7 = v320 (0 in a loaded world) |
  742. | `sub_1447DB780` / `sub_1447DD470` | Attribute generation / per-attribute filler (archetype applied) |
  743. | `sub_143637DE0` | `REGENERATION_MANAGER` vtable +32: choose archetype, copy multipliers |
  744. | `sub_14362D030` | Archetype picker (weights ×2 on HoYD category match; a5 = 1 ignores height) |
  745. | `sub_14362DD90` | Archetype builder (cluster database players for one nation / −continent) |
  746. | `sub_157C73C10` | Build all archetypes at new-game setup (via `sub_143188320` → `sub_143610130`) |
  747. | `sub_143630BE0` | Archetype top-up: build missing nations, rebuild all continents (from `sub_142D1AF90`) |
  748. | `sub_145159520` | Archetype distance (bucketed ratio to group average) |
  749. | `sub_143613420` | Archetype sort comparator (tag, group, role, weight desc) |
  750. | `sub_14360F7A0` | `REGENERATION_MANAGER` loader (archetype list from the save) |
  751. | `sub_14360CD30` | `REGENERATION_MANAGER` constructor (vtables at +0, +8, +24) |
  752. | `sub_157C72CB0` / `sub_14360FFC0` | Archetype free |
  753. | `sub_1420FF9D0` | Staff coaching category (job code or attribute argmax) |
  754. | `sub_14364E330` | Player natural position groups (ratings ≥ 15) |
  755. | `sub_1419C7820` / `sub_1419CF670` | Role attribute class / position attribute weight |
  756. | `sub_14274B3B0` | Post-pass over attributes (probably CA normalisation) |
  757.  
Add Comment
Please, Sign In to add comment