diff --git a/CMakeLists.txt b/CMakeLists.txt
index 949cf87..aed6f05 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1268,6 +1268,10 @@ add_executable(modern_toto_tests tests/modern_toto_tests.cpp)
target_link_libraries(modern_toto_tests PRIVATE bmh_season_modern)
add_test(NAME modern_toto_tests COMMAND modern_toto_tests)
+add_executable(modern_play_shift_tests tests/modern_play_shift_tests.cpp)
+target_link_libraries(modern_play_shift_tests PRIVATE bmh_season_modern)
+add_test(NAME modern_play_shift_tests COMMAND modern_play_shift_tests)
+
add_executable(modern_traffic_tests tests/modern_traffic_tests.cpp)
target_link_libraries(modern_traffic_tests PRIVATE bmh_season_modern)
add_test(NAME modern_traffic_tests COMMAND modern_traffic_tests)
diff --git a/assets/modern/sports.rcss b/assets/modern/sports.rcss
index 64c95cd..fb9ee48 100644
--- a/assets/modern/sports.rcss
+++ b/assets/modern/sports.rcss
@@ -28,20 +28,22 @@
.training-roster select selectbox {width:310dp;max-height:480dp;margin-top:8dp;padding:10dp;border-radius:16dp;}
.training-roster select option {min-height:72dp;padding:10dp 14dp;line-height:52dp;}
.tactics-board {position:absolute;left:76dp;top:0;width:2300dp;height:100%;}
-.tactics-surface {position:absolute;left:0;right:0;top:0;bottom:100dp;border:2dp var(--border);border-radius:28dp;decorator:linear-gradient(130deg,#bfd9e40a,#9ecbb809);}
-.tactics-board>.image-frame {filter:drop-shadow(#e0edbc 0dp 0dp 1dp);}
+.tactics-surface {position:absolute;left:0;right:0;top:0;bottom:100dp;}
+
.tactic-hotspot {padding:0;border:0dp;background-color:transparent;}
.tactic-hotspot:hover,.tactic-hotspot:active {background-color:transparent;}
.tactic-hotspot:focus-visible {border:3dp var(--accent);}
-.tactic-effort {position:absolute;left:1021.188dp;top:1021.469dp;width:1012dp;height:316.875dp;color:#d4e6b3;}
-body.silver .tactic-effort {color:#536f66;}
+.tactic-effort {position:absolute;left:1021.188dp;top:1000dp;width:1012dp;height:316.875dp;color:#f1efe2;}
.tactic-effort-label {display:flex;align-items:baseline;gap:18dp;font-family:Chalk;font-size:60dp;line-height:1.2;letter-spacing:4dp;}
.tactic-effort-marks {font-size:52dp;letter-spacing:1dp;line-height:1.2;}
.tactic-effort input {position:absolute;left:2dp;top:96dp;width:96%;height:20dp;}
.tactic-effort input slidertrack {margin:8dp 0;height:4dp;}
-.tactic-effort input sliderprogress {height:4dp;background-color:var(--accent);border-radius:2dp;}
-.tactic-effort input sliderbar {width:16dp;height:16dp;margin-top:2dp;border:0dp;border-radius:8dp;background-color:var(--accent);}
-.tactic-hint {position:absolute;left:0;right:0;bottom:34dp;height:39dp;text-align:center;font-size:34dp;color:var(--text);}
+.tactic-effort input slidertrack {background-color:#f1efe240;}
+.tactic-effort input sliderprogress {height:6dp;background-color:#f1efe2;border-radius:3dp;}
+.tactic-effort input sliderbar {width:30dp;height:30dp;margin-top:-5dp;border:0dp;border-radius:15dp;background-color:#f3d977;}
+.tactic-hint {position:absolute;left:0;right:0;bottom:20dp;height:92dp;text-align:center;font-size:34dp;color:var(--text);}
+.tactic-hint strong {display:block;font-weight:normal;}
+.tactic-hint span {display:block;font-size:28dp;line-height:1.4;color:var(--muted);}
body.midnight .training-skill {color:#c6d6df;}
body.midnight .training-row {color:#d8e3eb;}
body.midnight .training-header,body.midnight .training-position {color:#9fb2c3;}
diff --git a/docs/DIFFERENCES.md b/docs/DIFFERENCES.md
index dc75164..09ebfd5 100644
--- a/docs/DIFFERENCES.md
+++ b/docs/DIFFERENCES.md
@@ -21,6 +21,7 @@ describe deliberate changes; they are not a list of every known compatibility li
- [src/game/lineup.hpp](../src/game/lineup.hpp): disables the foreign-player limit and supports owner-bound designated set-piece selection.
- [src/game/match.hpp](../src/game/match.hpp): uses the enhanced injury selection and suspension rules.
- [src/game/match_engine.cpp](../src/game/match_engine.cpp): supports designated set-piece takers, the enhanced injury tables, and the extended suspension fields.
+- [src/game/match_engine.cpp](../src/game/match_engine.cpp): Dreierpack gives the six play settings of the tactics board (manager record +0xd3..+0xd8), which the original stores but never reads, an effect of its own (`play_shift`, switched on by `MatchEngine::tactic_effects` in the Modern turn driver only). A human side's wing play, through balls, goal kicks, flat or high balls, offside trap and pressing shift how often it and its opponent come to a chance by at most two steps of the chance roll; each setting pays in one situation and costs in another (relative strength, the attitudes of both sides, a wet pitch, the minute). Pressing also raises the foul roll. No random numbers are drawn for it. Computer sides have no board and play as before.
- [src/game/season.cpp](../src/game/season.cpp): retains the enhanced academy player-generation strength bands with monthly youth budgets.
- [src/game/season.hpp](../src/game/season.hpp): retains the enhanced academy player-generation strength bands with monthly youth budgets.
- [src/game/state.hpp](../src/game/state.hpp): retains designated set-piece selections in the supported manager-record extension.
diff --git a/src/game/match_engine.cpp b/src/game/match_engine.cpp
index b75826f..9c097b7 100644
--- a/src/game/match_engine.cpp
+++ b/src/game/match_engine.cpp
@@ -713,6 +713,41 @@ ForcedMatchEvent MatchEngine::event_impl(MatchGroup& g, int m, int s, int minute
return result;
}
+// Dreierpack: what the play settings of the two sides add to the attacking side's chance
+// roll, in half steps (two half steps = one step of the roll, about a tenth more or fewer
+// chances). `own`/`other` are the side records of the attacker and the defender, `attack`/
+// `defend` their boards (manager record +0xd2.., nullptr for a computer side). Nothing is
+// drawn at random. Every setting is a bet on the situation:
+// 1 wing play (0-3) pays for the stronger side, costs the weaker one
+// 2 through balls (0-3) pay against an attacking opponent, fail against a deep one
+// 3 long goal kicks (0-3) pay with a defensive attitude (counters), cost an attacking one
+// 4 high balls (0/1) better on a wet pitch and for a side with more condition than
+// technique; flat play suits technique on a dry pitch
+// 5 offside trap (0/1) helps a side that stands high, hurts a deep one and against a
+// clearly stronger attack
+// 6 pressing (0/1) more chances of one's own for an hour, then the side is tired
+// and the opponent gets more
+int play_shift(const uint8_t* own, const uint8_t* other, const uint8_t* attack, const uint8_t* defend, int own_att,
+ int opp_att, int minute, bool wet) {
+ int halves = 0;
+ if (attack) {
+ const int wings = std::min(attack[1], 3), through = std::min(attack[2], 3), kicks = std::min(attack[3], 3);
+ halves += wings * clamp(int(own[2]) - int(other[2]), -6, 6) / 9;
+ static constexpr int kLean[4] = {-2, -1, 1, 2}; // by attitude, 0 = very defensive
+ halves += through * kLean[clamp(opp_att, 0, 3)] / 2;
+ halves -= kicks * kLean[clamp(own_att, 0, 3)] / 2;
+ const bool condition_side = own[6] > 100; // balance: condition above technique
+ if (attack[4]) halves += wet ? 1 : condition_side ? 1 : -1;
+ else halves += wet ? -2 : condition_side ? 0 : 1;
+ if (attack[6] && minute <= 60) halves += 2;
+ }
+ if (defend) {
+ if (defend[5]) halves += (opp_att >= 2 ? -2 : 1) + (int(own[2]) > int(other[2]) + 6 ? 1 : 0);
+ if (defend[6] && minute > 60) halves += 2;
+ }
+ return clamp(halves, -4, 4);
+}
+
void MatchEngine::side(MatchGroup& g, int m, int& s, int minute, int& own_att, int& opp_att, MinuteReport& report) {
uint8_t* rec = g.records.data() + m * 18;
uint8_t* own = rec + s * 9;
@@ -722,8 +757,19 @@ void MatchEngine::side(MatchGroup& g, int m, int& s, int minute, int& own_att, i
int rhythm = clamp(own[7], 44, 80); // MatchRuntimeField2
+ // Dreierpack: the boards of human sides; pressing also means more fouls
+ const auto play_board = [&](int t) -> const uint8_t* {
+ if (!tactic_effects) return nullptr;
+ const int manager = state.manager_of(t);
+ if (manager < 0 || state.manager_records.size() < size_t(manager + 1) * 0xB0C) return nullptr;
+ return state.manager_records.data() + size_t(manager) * 0xB0C + 0xd2;
+ };
+ const uint8_t* own_board = play_board(g.fixtures.at(m * 2 + s));
+ const uint8_t* opp_board = play_board(g.fixtures.at(m * 2 + 1 - s));
+ const int pressing_fouls = own_board && own_board[6] ? 4 : 0;
+
// --- event roll (AlternateEventRoll selects an alternative range, separately from indoor) ---
- bool trigger = alternate_event_roll ? rand.range(0, 10) > 7 : rand.range(0, 220) < rhythm - 30;
+ bool trigger = alternate_event_roll ? rand.range(0, 10) > 7 : rand.range(0, 220) < rhythm - 30 + pressing_fouls;
if (trigger) {
event(g, m, s, minute, report);
if (report.unsupported) return;
@@ -737,7 +783,10 @@ void MatchEngine::side(MatchGroup& g, int m, int& s, int minute, int& own_att, i
// --- chance roll ---------------------------------------------------------------------------
int roll = game.range(0, away_penalty * 4 + 44);
- if (int16_t(opp_att + own_att + 3 + (indoor ? 14 : 0)) < roll) return; // no chance
+ int play = 0; // half steps; the odd half counts in the attack value below
+ if (own_board || opp_board)
+ play = play_shift(own, other, own_board, opp_board, own_att, opp_att, minute, !indoor && g.desc.at(0x50 + m) >= 4);
+ if (int16_t(opp_att + own_att + 3 + (indoor ? 14 : 0) + play / 2) < roll) return; // no chance
int team = g.fixtures.at(m * 2 + s), opp_team = g.fixtures.at(m * 2 + 1 - s);
// A side whose record byte 2 (its attack strength) is 0 gets no chance at all: the
@@ -745,6 +794,7 @@ void MatchEngine::side(MatchGroup& g, int m, int& s, int minute, int& own_att, i
// block, without the result-screen part after it (WEEK240).
if (own[2] == 0) return;
int attack = int16_t(own[2] + game.range(0, rhythm) / 10 + own_att * 2 - 9); // uVar5
+ attack = int16_t(attack + play % 2 * 4);
if (minute < clamp(own[6], 50, 130)) attack = int16_t(attack + game.range(6, 12));
int defence = int16_t(other[2] + (3 - opp_att) * 2); // local_a0
if (game.range(0, 100) < other[6]) defence = int16_t(defence + 5);
diff --git a/src/game/match_engine.hpp b/src/game/match_engine.hpp
index 97f7937..b791619 100644
--- a/src/game/match_engine.hpp
+++ b/src/game/match_engine.hpp
@@ -161,6 +161,12 @@ struct LiveRealityEvent {
RealitySceneTick tick;
};
+// Dreierpack (MatchEngine::tactic_effects): what the play settings of a human attacker's
+// and a human defender's board (manager record +0xd2.., nullptr for a computer side) add to
+// the attacker's chance roll, in half steps within -4..4. `own`/`other` are the side records.
+int play_shift(const uint8_t* own, const uint8_t* other, const uint8_t* attack, const uint8_t* defend, int own_att,
+ int opp_att, int minute, bool wet);
+
struct MatchEngine {
MatchEngine(GameState& s, std::vector& gr, GameRandom& gm, WatcomRandom& r, std::vector refs)
: state(s), groups(gr), game(gm), rand(r), referees(std::move(refs)), last_pick_quality(s.last_pick_quality) {}
@@ -177,6 +183,10 @@ struct MatchEngine {
bool live_desk_disabled = false; // LiveDeskDisabled: no live desk (both live modes off)
int month = 0; // CareerSession_PairingsRuntimeDraw_ExecutableField5, for the climate effect when re-rating
bool trace = false; // print events and chances to stderr (debugging)
+ // Dreierpack rule (not in the original, off by default): the six play settings of a
+ // human side (manager record +0xd3..+0xd8) shift how often that side and its opponent
+ // come to a chance. See play_shift in match_engine.cpp and docs/DIFFERENCES.md.
+ bool tactic_effects = false;
// What the original would show (presentation.hpp); filled only when set. Appending
// draws no random numbers and changes nothing else.
std::vector* show = nullptr;
diff --git a/src/modern/app/modern_session.cpp b/src/modern/app/modern_session.cpp
index 8c975a5..53e8e7a 100644
--- a/src/modern/app/modern_session.cpp
+++ b/src/modern/app/modern_session.cpp
@@ -9501,10 +9501,10 @@ cli::Json ModernSession::ui_read(const cli::Json& request, uint64_t revision) co
{"credit", O{{"status", "available"}, {"read", "credit"}, {"command", "bank.commit"}}}});
}
if (kind == "tactics") {
- // the eight settings (record +0xd2..+0xd9) with the executable's maxima; the meaning of
- // settings 1-3, 5 and 6 (diagrams on the original board) is not proven, hence neutral labels
- static constexpr const char* kLabels[8] = {"Grundausrichtung", "Spielzug 1", "Spielzug 2", "Spielzug 3",
- "Flache oder hohe Bälle", "Aufbau links", "Aufbau rechts", "Einsatz"};
+ // the eight settings (record +0xd2..+0xd9) with the executable's maxima; settings 1-6
+ // carry Dreierpack's own meaning (play_shift in the match engine)
+ static constexpr const char* kLabels[8] = {"Grundausrichtung", "Flügelspiel", "Steilpässe", "Abschlag",
+ "Flache oder hohe Bälle", "Abseitsfalle", "Pressing", "Einsatz"};
const ui::TacticsState t = ui::tactics_from_game(g_, exe_, revision);
A controls;
for (int i = 0; i < 8; ++i)
diff --git a/src/modern/game/turn_driver.cpp b/src/modern/game/turn_driver.cpp
index bd93d31..c5c8771 100644
--- a/src/modern/game/turn_driver.cpp
+++ b/src/modern/game/turn_driver.cpp
@@ -160,6 +160,7 @@ bool run_current_matchday(TurnDriver& driver, ModernState& g, GameRandom& game,
if (manager_match_played) events.push_back(audio_event(driver, TurnAudioKind::kickoff_whistle));
MatchEngine engine{g, driver.groups, game, rand, driver.referees};
+ engine.tactic_effects = true; // Dreierpack: the play settings count (docs/DIFFERENCES.md)
if (driver.original_sound) {
engine.original_sound = [&driver, &g](uint8_t id) { driver.original_sound(id, g); };
if (manager_match_played) engine.original_sound(3); // EndPhase / ReadButtons, crowd.
diff --git a/src/modern/ui/demo_sports.cpp b/src/modern/ui/demo_sports.cpp
index f713099..85cc36a 100644
--- a/src/modern/ui/demo_sports.cpp
+++ b/src/modern/ui/demo_sports.cpp
@@ -1,6 +1,10 @@
// SPDX-License-Identifier: GPL-3.0-only
#include "modern/ui/demo_sports.hpp"
#include
+#include
+#include
+#include
+#include
#include
#include
#include
@@ -182,53 +186,113 @@ std::string edit_demo_tactics(Json &state, const Json &action) {
}
std::string tactics_diagram(const Json &state, const std::string &theme,
const Json &lineup_points, int depth_max, int lane_max) {
+ // A slate with a wooden frame, drawn on by hand: every line wobbles a little, is gone
+ // over twice and skips where the chalk did not grip. The wobble follows from the
+ // coordinates alone, so the same board always looks the same.
const auto values = state.at("values").get>();
- const std::string line = theme == "silver" ? "#536f66" : "#dfe8bf";
- const auto field_line = theme == "silver" ? "#536f66" : "#d7edbf",
- man_line = theme == "silver" ? "#536f66" : "#c9e6ae",
- curve_line = theme == "silver" ? "#536f66" : "#d4e7ba";
- const std::string defence = theme == "silver" ? "#85600c" : "#ffdd6b";
+ const std::string chalk = "#f1efe2", own = "#f3d977", opponent = "#ee8d77";
+ const std::string slate = theme == "silver" ? "#35584a" : theme == "matchday" ? "#2f3b36" : "#274a3e";
std::ostringstream out;
out.imbue(std::locale::classic());
- out << "";
return out.str();
}
} // namespace bmh::modern_ui
diff --git a/src/modern/ui/engine_sports.inc b/src/modern/ui/engine_sports.inc
index 2919914..3b9cc6e 100644
--- a/src/modern/ui/engine_sports.inc
+++ b/src/modern/ui/engine_sports.inc
@@ -102,6 +102,6 @@ bool App::engine_sports_event(Rml::Event &event) {
if (!change) return false;
engine_tactics_draft_["values"][7] = value; last_tactic_ = 7;
element("tactic-effort-value")->SetInnerRML(std::string(size_t(value), '!'));
- element("tactic-hint")->SetInnerRML(esc(engine_tactics_draft_.at("labels")[7].get() + ": " + std::to_string(value) + " / " + std::to_string(engine_tactics_draft_.at("limits")[7].get())));
+ element("tactic-hint")->SetInnerRML("" + esc(engine_tactics_draft_.at("labels")[7].get() + ": " + tactic_value_text(7, value, engine_tactics_draft_.at("limits")[7].get())) + "" + esc(tactic_effect_text(7)) + "");
engine_sports_update(); dirty_ = true; return true;
}
diff --git a/src/modern/ui/live_controls.inc b/src/modern/ui/live_controls.inc
index 7a0e36e..37103a9 100644
--- a/src/modern/ui/live_controls.inc
+++ b/src/modern/ui/live_controls.inc
@@ -388,6 +388,7 @@ bool App::live_action(const std::string &action, Rml::Element *target) {
try {
const int index = std::stoi(id);
if (index < 0 || index > 7) return true;
+ last_tactic_ = index;
if (engine_live_running_) {
// the next value of the engine's own range, wrapping to its lowest
const auto &control = engine_live_tactics_.at(size_t(index));
diff --git a/src/modern/ui/live_screens.inc b/src/modern/ui/live_screens.inc
index 61a6880..efd6b86 100644
--- a/src/modern/ui/live_screens.inc
+++ b/src/modern/ui/live_screens.inc
@@ -8,14 +8,7 @@ std::string live_score_text(const Json &score) {
}
// A value of the engine's tactics board in words: the attitude (item 0, lowest = most
// defensive), the commitment (item 7) and the numbered variants of the play patterns.
-std::string live_tactic_value(size_t index, int value, int maximum) {
- if (index == 0 && maximum == 3) {
- static const std::array attitude{"Sehr defensiv", "Defensiv", "Offensiv", "Sehr offensiv"};
- if (value >= 0 && value <= 3) return attitude[size_t(value)];
- }
- if (index == 7) return std::to_string(value) + " von " + std::to_string(maximum);
- return "Variante " + std::to_string(value + 1) + " von " + std::to_string(maximum + 1);
-}
+std::string live_tactic_value(size_t index, int value, int maximum) { return tactic_value_text(index, value, maximum); }
const Json &live_match_by_id(const Json &rows, const Json &id) {
for (const auto &row : rows) if (row.at("id") == id) return row;
@@ -112,13 +105,9 @@ std::string App::live_detail(const Json &owner, const Json &frame) {
}
if (live_tab_ == "tactics" && live_.running() && engine_live_tactics_.size() == 8) {
std::string out = "
" + live_text("Taktik in diesem Spiel") + "
";
- // the match engine reads the attitude (item 0) and the commitment (item 7); the play
- // patterns between them have no effect on a match and are not offered here
for (size_t i = 0; i < engine_live_tactics_.size(); ++i)
- if (i == 0 || i == 7)
out += "
" + live_text("Offensiver heißt mehr eigene Chancen und mehr Chancen für den Gegner. Mehr Einsatz bringt Druck nach vorn, aber auch mehr Karten und Verletzungen.") + "