Player12
An open source football management simulator
Loading...
Searching...
No Matches
tactics.h File Reference
#include <cstdint>
#include <span>
#include <string_view>
#include "global/types.h"

Go to the source code of this file.

Classes

struct  RoleProfile
 Measurable behaviour of a role and duty in the match engine. Distances are metres, biases are engine utility units; zero everywhere is the Standard role on a Support duty. More...
 
struct  SlotInstruction
 Role, duty and in-possession spot of one outfield slot. Slots are matched by their out-of-possession position (anchor, lineup coordinates: own goal at x = 0), so they survive reordering of the lineup and return when a formation is used again. More...
 
struct  PlayerInstruction
 An instruction against an opposing player for the next match. More...
 

Namespaces

namespace  TacticsTuning
 
namespace  Tactics
 Roles, duties, in-possession shapes and their engine profiles. Pure functions; the tactic data itself lives in Strategy.
 

Enumerations

enum class  RoleFamily : std::uint8_t {
  Goalkeeper , FullBack , CentreBack , Holding ,
  Central , Attacking , Wide , Striker ,
  COUNT
}
 Position group of a formation slot; it decides which roles the slot can be given (see Tactics::familyForSlot). More...
 
enum class  TacticalRole : std::uint8_t {
  Standard = 0 , LineKeeper , SweeperKeeper , InsideFullBack ,
  Stopper , CoverDefender , Anchor , Playmaker ,
  BoxToBox , SecondStriker , InsideForward , TouchlineWinger ,
  TargetForward , Poacher , PressingForward , FalseNine ,
  COUNT
}
 How a player interprets his slot (values are persisted in the tactic). Standard plays the position as drilled, with no extra bias. More...
 
enum class  RoleDuty : std::uint8_t { Defend , Support , Attack , COUNT }
 Attacking commitment of a role (persisted in the tactic). More...
 
enum class  OppositionInstruction : std::uint8_t {
  None = 0 , TightMark , Press , ShowWeakFoot ,
  DoubleUp , COUNT
}
 Individual instruction against one opposing player (values are persisted in OppositionInstructions; append new ones before COUNT). More...
 
enum class  PossessionShape : std::uint8_t {
  KeepShape , FullBacksPush , BuildWithThree , NarrowFront ,
  COUNT
}
 Ready-made in-possession shapes offered on the tactics screen. More...
 

Functions

RoleFamily Tactics::familyForSlot (Vector2F anchor)
 
std::span< const TacticalRole > Tactics::rolesFor (RoleFamily family)
 
bool Tactics::allows (RoleFamily family, TacticalRole role)
 
bool Tactics::hasDuty (RoleFamily family)
 
RoleProfile Tactics::profile (TacticalRole role, RoleDuty duty)
 
const char * Tactics::familyKey (RoleFamily family)
 
const char * Tactics::roleKey (TacticalRole role)
 
const char * Tactics::roleDescriptionKey (TacticalRole role)
 
const char * Tactics::dutyKey (RoleDuty duty)
 
const char * Tactics::possessionShapeKey (PossessionShape shape)
 
std::span< const std::string_view > Tactics::keyAttributes (RoleFamily family, TacticalRole role)
 
float Tactics::roleFit (const Player &player, RoleFamily family, TacticalRole role)
 
RoleDuty Tactics::suggestedDuty (const Player &player, RoleFamily family)
 
TacticalRole Tactics::suggestedRole (const Player &player, RoleFamily family)
 
Vector2F Tactics::possessionOffset (PossessionShape shape, Vector2F anchor)
 
void Tactics::assignRolesToFit (Strategy &strategy, const Lineup &lineup)
 

Variables

constexpr float TacticsTuning::SLOT_MATCH_DISTANCE = 0.06f
 
constexpr float TacticsTuning::RUN_BIAS_WEIGHT = 0.22f
 
constexpr float TacticsTuning::OVERLAP_BIAS_WEIGHT = 0.25f
 
constexpr float TacticsTuning::PRESS_BIAS_SECONDS = 0.6f
 
constexpr float TacticsTuning::PASS_DARING_PROGRESS_WEIGHT = 3.0f
 
constexpr float TacticsTuning::PASS_DARING_SAFETY_WEIGHT = 1.0f
 
constexpr float TacticsTuning::TARGET_BIAS_WEIGHT = 1.0f
 
constexpr float TacticsTuning::SHOT_BIAS_WEIGHT = 2.0f
 
constexpr float TacticsTuning::CUT_INSIDE_SHIFT = 0.9f
 
constexpr float TacticsTuning::KEEPER_SWEEP_DEPTH_GAIN = 0.5f
 
constexpr float TacticsTuning::KEEPER_SWEEP_ADVANTAGE_GAIN = 0.15f
 
constexpr float TacticsTuning::PRESS_BIAS_ENGAGE = 0.35f
 
constexpr float TacticsTuning::TIGHT_MARK_WEIGHT = 0.88f
 
constexpr float TacticsTuning::TIGHT_MARK_GOAL_SIDE_METRES = 1.2f
 
constexpr float TacticsTuning::TIGHT_MARK_REACH_METRES = 3.0f
 
constexpr float TacticsTuning::TIGHT_MARK_COMPLETION_PENALTY = 0.10f
 
constexpr float TacticsTuning::PRESS_ORDER_STANDOFF_SHARE = 0.45f
 
constexpr float TacticsTuning::PRESS_ORDER_ENGAGE = 0.8f
 
constexpr float TacticsTuning::WEAK_FOOT_SHADE_METRES = 1.5f
 
constexpr float TacticsTuning::WEAK_FOOT_ERROR_GAIN = 0.45f
 
constexpr float TacticsTuning::WEAK_FOOT_SHOT_PENALTY = 0.35f
 
constexpr float TacticsTuning::DOUBLE_UP_SUPPORT_METRES = 2.5f
 
constexpr float TacticsTuning::DOUBLE_UP_ENGAGE = 0.4f
 
constexpr float TacticsTuning::DOUBLE_UP_TAKE_ON_PENALTY = 0.12f
 
constexpr float TacticsTuning::DOUBLE_UP_REACH_METRES = 5.0f
 
constexpr float TacticsTuning::TALK_FULL_MINUTES = 10.0f
 
constexpr float TacticsTuning::TALK_FADE_END_MINUTES = 20.0f
 
constexpr float TacticsTuning::TALK_REFERENCE = 0.012f
 
constexpr float TacticsTuning::TALK_COMPOSURE = 0.25f
 
constexpr float TacticsTuning::TALK_PRESS_SECONDS = 0.3f
 
constexpr float TacticsTuning::TALK_ENGAGE = 0.25f
 

Enumeration Type Documentation

◆ OppositionInstruction

enum class OppositionInstruction : std::uint8_t
strong

Individual instruction against one opposing player (values are persisted in OppositionInstructions; append new ones before COUNT).

Enumerator
None 
TightMark 

Stay tight to him; his marker follows him everywhere.

Press 

Close him down as soon as he receives.

ShowWeakFoot 

Force him onto his weaker foot.

DoubleUp 

Two players close him down (wide threats).

COUNT 

◆ PossessionShape

enum class PossessionShape : std::uint8_t
strong

Ready-made in-possession shapes offered on the tactics screen.

Enumerator
KeepShape 

Same shape with and without the ball.

FullBacksPush 

Both full-backs join the midfield line.

BuildWithThree 

One full-back tucks in, the other pushes on.

NarrowFront 

Wide players come inside, full-backs give width.

COUNT 

◆ RoleDuty

enum class RoleDuty : std::uint8_t
strong

Attacking commitment of a role (persisted in the tactic).

Enumerator
Defend 
Support 
Attack 
COUNT 

◆ RoleFamily

enum class RoleFamily : std::uint8_t
strong

Position group of a formation slot; it decides which roles the slot can be given (see Tactics::familyForSlot).

Enumerator
Goalkeeper 
FullBack 
CentreBack 
Holding 
Central 
Attacking 
Wide 
Striker 
COUNT 

◆ TacticalRole

enum class TacticalRole : std::uint8_t
strong

How a player interprets his slot (values are persisted in the tactic). Standard plays the position as drilled, with no extra bias.

Enumerator
Standard 
LineKeeper 

Stays on his line.

SweeperKeeper 

Starts high and comes out for balls in behind.

InsideFullBack 

Steps into midfield when his side has the ball.

Stopper 

Centre-back who steps out to meet his man.

CoverDefender 

Centre-back who drops off and sweeps behind.

Anchor 

Holds in front of the back line.

Playmaker 

Dictates with riskier, forward passes.

BoxToBox 

Covers both boxes, joins attacks late.

SecondStriker 

Runs beyond the striker from deep.

InsideForward 

Wide forward who cuts in to shoot.

TouchlineWinger 

Hugs the line to beat his man and cross.

TargetForward 

Reference point for forward passes.

Poacher 

Lives on the last line, gambles in the box.

PressingForward 

First defender, hunts the ball.

FalseNine 

Drops off the line to link play.

COUNT