From 44a7a77915a4afbddc0b846e537700dc6e2f91d6 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 25 Oct 2026 08:54:00 +0100 Subject: [PATCH] Accept data revision 1.4: real ages for all players (M5) Revision 1.4 of the Modern data set brings birth dates for every player, the camp catalogue with its maps and 100 referees. The expansion now takes the age from a birth date for the original players as well (WorldPlayer::born); before, only the added players kept their data age. The yearly aging stops at 47, the most the age bits hold, so real ages (a goalkeeper of 40) cannot run into the bits above. The season sim counts second referee assignments per day. Two seasons and ten seasons run through; the save round trip is identical; second referee assignments drop to about 7 a season. Co-Authored-By: Claude Opus 5.5 --- docs/DIFFERENCES.md | 1 + docs/new_engine/README.md | 2 +- docs/new_engine/phasen.md | 2 ++ src/modern/content/world.cpp | 2 +- src/modern/content/world.hpp | 1 + src/modern/content/world_expand.cpp | 10 ++++++++++ src/modern/game/season.cpp | 3 ++- tests/modern_season_sim.cpp | 18 +++++++++++++++++- 8 files changed, 35 insertions(+), 4 deletions(-) diff --git a/docs/DIFFERENCES.md b/docs/DIFFERENCES.md index a6deb8c..4adc159 100644 --- a/docs/DIFFERENCES.md +++ b/docs/DIFFERENCES.md @@ -42,6 +42,7 @@ describe deliberate changes; they are not a list of every known compatibility li - [src/modern/game/highscore.cpp](../src/modern/game/highscore.cpp): reads the supported edition-specific high-score format from the loaded image. - [src/modern/game/matchday_setup.cpp](../src/modern/game/matchday_setup.cpp): in Modern worlds a referee may take a second match on a day with more matches than referees. - [src/modern/game/season.cpp](../src/modern/game/season.cpp): retains the enhanced academy player-generation strength bands with monthly youth budgets. +- [src/modern/game/season.cpp](../src/modern/game/season.cpp): in Modern the age stops at 47, the most its five bits hold; real ages of a data set (a goalkeeper of 40) would otherwise run into the bits above. - [src/modern/game/season.hpp](../src/modern/game/season.hpp): retains the enhanced academy player-generation strength bands with monthly youth budgets. - [src/modern/game/week.cpp](../src/modern/game/week.cpp): uses the enhanced training rules: focus strength is at least five below its target, and completed skills rotate to another focus. - [src/modern/game/week.hpp](../src/modern/game/week.hpp): uses the enhanced assistant-training rules, retaining the selected skill until it reaches its maximum. diff --git a/docs/new_engine/README.md b/docs/new_engine/README.md index f3bfb74..447a741 100644 --- a/docs/new_engine/README.md +++ b/docs/new_engine/README.md @@ -56,7 +56,7 @@ Für 0.3 gilt außerdem: | M2 | Spielpläne je Liga, Kalender mit 38 Spieltagen | Engine-Teil erledigt (Tabelle je Ligagröße, Ligatermine, Aussetzen); Test mit echten Daten in M3 | | M3 | Modern-Weltlader, Namen (Vor-/Nachname, UTF-8), Asset-Schlüssel | Weltlader erledigt: Modern-Datensatz spielt zwei Saisons; Namen/Assets für die UI liegen in `ModernState`, Spielstände folgen mit M6 | | M4 | Trainingslager: 18 Lager, drei Karten, 6-Sterne-Wirkung | Engine erledigt (Katalog, Preis, 6-Sterne-Wirkung, Test); Saisonwirkung wird in M7 gemessen | -| M5 | Datenrevision 1.4 des Modern-Datensatzes (privat), Wirtschaftsprüfung | Datensatz/Editor geprüft; Mehrsaisonprüfung offen | +| M5 | Datenrevision 1.4 des Modern-Datensatzes (privat), Wirtschaftsprüfung | erledigt: Revision 1.4 abgenommen (Lager, 100 Schiedsrichter, Geburtsdaten; siehe Phasen) | | M6 | Modern-Spielstände (`modern-career-v1`), Projektionen für die UI | Spielstände erledigt (Rundreise identisch); Projektionen offen | | M7 | Balance-Läufe und Anpassungen | begonnen: Spielerwerte des Datensatzes nach Rangfolge ([Balance](balance.md)); Langläufe offen | | M8 | Fußball-Almanach: alle Spiele mit Ereignissen und Aufstellungen ([Almanach](almanach.md)) | Engine erledigt (Aufzeichnung, Spielstand, IDs); UI und Projektionen offen | diff --git a/docs/new_engine/phasen.md b/docs/new_engine/phasen.md index 23ff8ae..c743999 100644 --- a/docs/new_engine/phasen.md +++ b/docs/new_engine/phasen.md @@ -62,6 +62,8 @@ Siehe [Trainingslager](trainingslager.md): Katalog aus den Daten, drei Regionen, **Abnahme:** Prüfbericht ohne Fehler; Editor öffnet und speichert verlustfrei. +**Abnahme Revision 1.4 (25.10.2026):** `runtime:modern-v1` im Manifest; 18 Lager auf 3 Karten aus den Daten (`resorts`), das 6-Sterne-Lager buchbar; 100 Schiedsrichter (50 neue mit Strenge und Wahrnehmung), noch etwa 7 Doppeleinsätze pro Saison statt an fast jedem Ligatag; Geburtsdaten für alle 3.414 Spieler. Zwei Saisons ohne Abbruch, Spielstand-Rundreise identisch, zehn Saisons ohne Abbruch. Engine-Anpassungen dabei: Geburtsdaten gelten jetzt auch für die Originalspieler (`WorldPlayer::born`); das Alter stoppt bei 47, dem Maximum seines Feldes (ein 40-jähriger Torwart würde sonst nach einigen Jahren überlaufen). Offen für die Daten nur `playable: true` im Manifest (liest die Engine nicht). + **Stand Engine (erledigt):** Die Engine liest alles, was 1.4 liefern soll: `runtime:modern-v1` (F1), Ligatermine für 38 Spieltage (F3; Revision 1.3 spielt schon 38/38), den Lager-Katalog mit Karten (F4), den Schiedsrichter-Pool aus `staff` (F9). Für Finanzen (F7) braucht 0.3 nichts. **Stand Datenpflege (25.10.2026):** Revision 1.4 ist gebaut und unabhängig geprüft (101 Prüfungen, null Fehler), zweimal bytegleich erzeugt und im ergänzten Editor verlustfrei geöffnet/gespeichert. Die Welt nennt beide Laufzeit-/Editoranforderungen, ist spielbar markiert und liefert 3 Karten, 18 Lager sowie 100 Schiedsrichter. Alle 3.414 Spieler haben `born`: bei den Originalen 2.345 aus Quellen ergänzt und 229 ausdrücklich als Simulation generiert; die 840 Ergänzungen bleiben unverändert. Original-IDs, Namen, Werte und Ressourcen bleiben erhalten. Ein Engine-Zug mit der neuen Welt ist geprüft; der unten genannte Mehrsaisontest bleibt beim Engine-Team. Der Editor-Supportfix liegt ebenfalls auf `0.3`, kein neuer Editor-Release. diff --git a/src/modern/content/world.cpp b/src/modern/content/world.cpp index b65ab1c..dffd9cb 100644 --- a/src/modern/content/world.cpp +++ b/src/modern/content/world.cpp @@ -156,7 +156,7 @@ World read_world(const obw::Documents& documents) { pl.position = position_of(str(positions[0])); const auto& nations = arr(get(p, "nationalities")); if (!nations.empty()) pl.nation = str(nations[0]); - if (const J* born = find(p, "born")) pl.age = age_on(str(*born), w.start_date); + if (const J* born = find(p, "born")) pl.age = age_on(str(*born), w.start_date), pl.born = pl.age >= 0; else if (const J* at = find(p, "age_at_start")) pl.age = integer(find(*at, "years"), -1); pl.photo = text(find(p, "photo")); const J& a = get(p, "attributes"); diff --git a/src/modern/content/world.hpp b/src/modern/content/world.hpp index 0dfbe87..3bdd371 100644 --- a/src/modern/content/world.hpp +++ b/src/modern/content/world.hpp @@ -43,6 +43,7 @@ struct WorldPlayer { int position = 0; // 0 GK, 1 DEF, 2 MID, 3 FWD std::string nation; // first nationality int age = -1; // age on the start date + bool born = false; // the age comes from a birth date (not a placeholder age) std::string photo; // Attributes of bmh-classic@1. int technique = 0, condition = 0, form = 0, bonus = 0; diff --git a/src/modern/content/world_expand.cpp b/src/modern/content/world_expand.cpp index fb19acb..371152b 100644 --- a/src/modern/content/world_expand.cpp +++ b/src/modern/content/world_expand.cpp @@ -295,6 +295,16 @@ ExpandReport expand_to_world(ModernState& g, const World& world) { g.player_name_offsets.resize(size_t(next_player), 0); g.player_cards.resize(size_t(next_player), 0); if (g.player_bonus.size() < size_t(next_player) + 0x36) g.player_bonus.resize(size_t(next_player) + 0x36, 0); + // Original players with a birth date in the world take that age (bits 21-25: age - 16); the + // career start keeps it instead of drawing one (balance.md). Data set 1.3 had only a + // placeholder age for them, 1.4 gives birth dates. + g.world_age_known.assign(size_t(next_player), false); + for (size_t i = 0; i < original_players; ++i) + if (const WorldPlayer* p = player_at[i]; p && p->born) { + const int age = std::clamp(p->age, 16, 47); + g.players[i].w364 = (g.players[i].w364 & ~(0x1fu << 21)) | uint32_t(age - 16) << 21; + g.world_age_known[i] = true; + } for (size_t i = original_players; i < size_t(next_player); ++i) { const WorldPlayer& p = *player_at[i]; const auto clamp7 = [](int v) { return uint32_t(std::clamp(v, 0, 127)); }; diff --git a/src/modern/game/season.cpp b/src/modern/game/season.cpp index ba5ed27..f826a8c 100644 --- a/src/modern/game/season.cpp +++ b/src/modern/game/season.cpp @@ -1249,7 +1249,8 @@ void season_players(ModernState& g, GameRandom& game, WatcomRandom& rand, Minute } } if (!leaves) { - set_age(g, player, age); // SetAge + // OpenBMH deviates from the original: in Modern the age stops at 47, the most its five bits hold; real ages of a data set (a goalkeeper of 40) would otherwise run into the bits above. + set_age(g, player, std::min(age, 0x1f)); // SetAge last_team = uint16_t(team); break; } diff --git a/tests/modern_season_sim.cpp b/tests/modern_season_sim.cpp index 5f30c66..0cd3a3e 100644 --- a/tests/modern_season_sim.cpp +++ b/tests/modern_season_sim.cpp @@ -66,7 +66,8 @@ void check_state(const modern::ModernState& g, const std::string& when, Checks& if (id == 0xfff) continue; if (!seen.insert(id).second) c.fail("player in two squad slots", when + " player " + std::to_string(id)); const Player& p = g.players.at(size_t(id)); - if (p.age() < 16 || p.age() > 40) c.fail("age outside 16-40", when + " player " + std::to_string(id) + " age " + std::to_string(p.age())); + // a Modern world brings real ages (a keeper of 40); the age field holds up to 47 + if (p.age() < 16 || p.age() > (modern::current_world() ? 47 : 40)) c.fail("age outside 16-40 (Modern: 47)", when + " player " + std::to_string(id) + " age " + std::to_string(p.age())); if (p.technique() > 99 || p.condition() > 99) c.fail("technique/condition above 99", when + " player " + std::to_string(id)); } // the human managers: money within a sane range, a squad with at least 11 players @@ -145,6 +146,21 @@ void print_almanac(const modern::ModernState& g) { std::printf("almanac: %zu seasons, %zu matches, %zu events, %zu bytes uncompressed, %u new player identities\n", seasons.size(), matches, events, bytes, g.almanac.generated_players); std::printf("almanac: %zu matches whose goal events differ from the result, %zu without line-ups\n", mismatched, without_lineup); + { + // referees with a second match on one day (the fallback when the pool runs out, F9) + size_t twice = 0, days = 0; + for (const auto& s : seasons) { + std::map> by_day; + for (const auto& m : s.matches) + if (m.referee) ++by_day[m.date][m.referee]; + for (const auto& [day, refs] : by_day) { + bool any = false; + for (const auto& [ref, n] : refs) if (n > 1) twice += size_t(n - 1), any = true; + days += any; + } + } + std::printf("almanac: %zu second referee assignments on %zu days\n", twice, days); + } { // goals per match by competition (league index, or cup id + 100), over all seasons std::map> by; // matches, goals