Player12
An open source football management simulator
Loading...
Searching...
No Matches
interactions.h File Reference
#include <array>
#include <cstddef>
#include <cstdint>
#include <functional>
#include <memory>
#include <optional>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
#include "global/types.h"
#include "model/gamedate.h"
#include "model/player.h"

Go to the source code of this file.

Classes

struct  Promise
 A measurable commitment with a deadline. More...
 
struct  PlayerRelation
 A managed player's relationship with the manager (persisted). More...
 
struct  TalkContext
 Everything the reply to a conversation depends on. More...
 
struct  TalkOutcome
 Result of one conversation line. More...
 
struct  TalkOptionView
 One option as offered to the manager. More...
 
struct  TalkListener
 
struct  TeamTalkContext
 Situation of a team talk. More...
 
struct  TeamTalkPrediction
 Predicted reception of a tone. More...
 
struct  TeamTalkResult
 What a team talk did. More...
 
struct  LeaderInfo
 
struct  SocialGroup
 
struct  DressingRoom
 Summary of the managed squad's social state. More...
 
struct  InteractionState
 Persisted state of the interaction system. More...
 
class  InteractionSystem
 Relations, promises, requests and team talks of the managed club. More...
 
struct  InteractionSystem::TeamTalkRecord
 

Namespaces

namespace  Interactions
 

Enumerations

enum class  TalkOption : std::uint8_t {
  PraiseForm = 0 , CriticiseForm , DiscussPlayingTime , PromisePlayingTime ,
  PromiseContract , PromiseSigning , AskPatience , ReassureStay ,
  OpenToOffers , AcceptTransferRequest , RefuseTransferRequest , COUNT
}
 The human side of management: one-to-one conversations, promises, team talks and the dressing room of the managed club. More...
 
enum class  TalkReaction : std::uint8_t { Positive , Neutral , Negative }
 
enum class  TalkHint : std::uint8_t { LikelyPositive , Uncertain , Risky }
 
enum class  TalkRequest : std::uint8_t { None = 0 , PlayingTime , NewContract , Transfer }
 
enum class  TalkBlock : std::uint8_t {
  None , Cooldown , NotAtClub , NoRecentMatches ,
  Injured , PromiseActive , PromiseNotCredible , ContractLong ,
  NoWindowAhead , NoTransferInterest , NoTransferRequest , NotUnhappy
}
 
enum class  PromiseType : std::uint8_t { PlayingTime = 0 , NewContract , Signing }
 
enum class  PromiseState : std::uint8_t { Active = 0 , Kept , Broken , Voided }
 
enum class  PromiseVoidReason : std::uint8_t { None = 0 , PlayerLeft , LongInjury , TooFewMatches }
 
enum class  TalkGroup : std::uint8_t {
  Form = 0 , PlayingTime , Promise , Patience ,
  Transfer , COUNT
}
 
enum class  TeamTalkMoment : std::uint8_t { PreMatch = 0 , HalfTime }
 
enum class  TeamTalkTone : std::uint8_t {
  Calm = 0 , Motivate , DemandMore , Praise ,
  NoPressure , COUNT
}
 
enum class  DressingMood : std::uint8_t { Buoyant , Settled , Uneasy , Tense }
 

Functions

const char * Interactions::optionKey (TalkOption option)
 
const char * Interactions::optionDescriptionKey (TalkOption option)
 
const char * Interactions::reactionKey (TalkReaction reaction)
 
const char * Interactions::hintKey (TalkHint hint)
 
const char * Interactions::blockKey (TalkBlock block)
 
const char * Interactions::requestKey (TalkRequest request)
 
const char * Interactions::promiseTypeKey (PromiseType type)
 
const char * Interactions::promiseStateKey (PromiseState state)
 
const char * Interactions::voidReasonKey (PromiseVoidReason reason)
 
const char * Interactions::toneKey (TeamTalkTone tone)
 
const char * Interactions::toneDescriptionKey (TeamTalkTone tone)
 
const char * Interactions::moodKey (DressingMood mood)
 
TalkGroup Interactions::groupOf (TalkOption option)
 
std::int32_t Interactions::cooldownDays (TalkGroup group)
 
float Interactions::expectedRating (SquadRole role)
 
float Interactions::expectedShare (SquadRole role, int age)
 
float Interactions::positiveChance (const TalkContext &context, TalkOption option)
 
float Interactions::negativeChance (const TalkContext &context, TalkOption option)
 
TalkHint Interactions::hintFor (float positive, float negative)
 
TalkOutcome Interactions::evaluateTalk (const TalkContext &context, TalkOption option, double roll, double variant_roll)
 
std::vector< TeamTalkPrediction > Interactions::predictTeamTalk (const TeamTalkContext &context)
 
TeamTalkResult Interactions::evaluateTeamTalk (const TeamTalkContext &context, TeamTalkTone tone, std::uint64_t seed)
 
float Interactions::cohesionModifier (float new_share)
 
float Interactions::newness (std::int32_t joined_day, std::int32_t today)
 
float Interactions::hierarchyScore (int tenure_days, int age, float standing, const PlayerTraits &traits)
 

Variables

constexpr float Interactions::TALK_CAP = 0.012f
 
constexpr float Interactions::TOTAL_CAP = 0.02f
 
constexpr std::int32_t Interactions::SETTLE_DAYS = 240
 

Enumeration Type Documentation

◆ DressingMood

enum class DressingMood : std::uint8_t
strong

Overall mood of the dressing room.

Enumerator
Buoyant 
Settled 
Uneasy 
Tense 

◆ PromiseState

enum class PromiseState : std::uint8_t
strong
Enumerator
Active 
Kept 
Broken 
Voided 

◆ PromiseType

enum class PromiseType : std::uint8_t
strong
Enumerator
PlayingTime 

Share of the club's competitive minutes.

NewContract 

Contract extended before the deadline.

Signing 

A first-team level signing by the window's end.

◆ PromiseVoidReason

enum class PromiseVoidReason : std::uint8_t
strong
Enumerator
None 
PlayerLeft 
LongInjury 
TooFewMatches 

◆ TalkBlock

enum class TalkBlock : std::uint8_t
strong

Why an option cannot be used right now.

Enumerator
None 
Cooldown 
NotAtClub 
NoRecentMatches 
Injured 
PromiseActive 
PromiseNotCredible 
ContractLong 
NoWindowAhead 
NoTransferInterest 
NoTransferRequest 
NotUnhappy 

◆ TalkGroup

enum class TalkGroup : std::uint8_t
strong

Cooldown groups of the conversation options.

Enumerator
Form 
PlayingTime 
Promise 
Patience 
Transfer 
COUNT 

◆ TalkHint

enum class TalkHint : std::uint8_t
strong

Predicted reaction shown next to an option.

Enumerator
LikelyPositive 
Uncertain 
Risky 

◆ TalkOption

enum class TalkOption : std::uint8_t
strong

The human side of management: one-to-one conversations, promises, team talks and the dressing room of the managed club.

Design rules (research D-14, FR-119..FR-123):

  • Interactions change morale points and the player's trust in the manager; they never touch results directly. The only performance knobs exposed (team talk and cohesion modifiers) are bounded to +-2% and are read-only hints for the match engine.
  • Conversations are rare and consequential: every option has a cooldown and the player's reply depends on his personality, form against what his squad role demands, trust and the manager's standing.
  • Every promise has a measurable condition and a deadline and always ends Kept, Broken or Voided (with a reason). A manager's line in a one-to-one conversation (values are persisted).
Enumerator
PraiseForm 
CriticiseForm 
DiscussPlayingTime 
PromisePlayingTime 
PromiseContract 
PromiseSigning 
AskPatience 
ReassureStay 

Transfer interest: "you are not for sale".

OpenToOffers 

Transfer interest: "we would listen".

AcceptTransferRequest 

Lists the player.

RefuseTransferRequest 
COUNT 

◆ TalkReaction

enum class TalkReaction : std::uint8_t
strong

How the player took it.

Enumerator
Positive 
Neutral 
Negative 

◆ TalkRequest

enum class TalkRequest : std::uint8_t
strong

Something an unhappy player asked the manager for (persisted).

Enumerator
None 
PlayingTime 
NewContract 
Transfer 

◆ TeamTalkMoment

enum class TeamTalkMoment : std::uint8_t
strong
Enumerator
PreMatch 
HalfTime 

◆ TeamTalkTone

enum class TeamTalkTone : std::uint8_t
strong
Enumerator
Calm 
Motivate 
DemandMore 
Praise 
NoPressure 
COUNT