Show / Hide Table of Contents

Class OvermindUpdater

The overmind bot brain updater.

Inheritance
object
BrainUpdaterBase<OvermindState, OvermindBot, OvermindAction>
OvermindUpdater
Implements
IOvermindUpdater
IBrainUpdater
Inherited Members
BrainUpdaterBase<OvermindState, OvermindBot, OvermindAction>.Logger
BrainUpdaterBase<OvermindState, OvermindBot, OvermindAction>.Brain
BrainUpdaterBase<OvermindState, OvermindBot, OvermindAction>.States
BrainUpdaterBase<OvermindState, OvermindBot, OvermindAction>.TickFrequency
BrainUpdaterBase<OvermindState, OvermindBot, OvermindAction>.Bots
BrainUpdaterBase<OvermindState, OvermindBot, OvermindAction>.Brains
BrainUpdaterBase<OvermindState, OvermindBot, OvermindAction>.BrainManager
BrainUpdaterBase<OvermindState, OvermindBot, OvermindAction>.Serializer
BrainUpdaterBase<OvermindState, OvermindBot, OvermindAction>.AddBrain(IBotBrain)
BrainUpdaterBase<OvermindState, OvermindBot, OvermindAction>.SetBrain(IBotBrain)
BrainUpdaterBase<OvermindState, OvermindBot, OvermindAction>.AddBrain(string)
BrainUpdaterBase<OvermindState, OvermindBot, OvermindAction>.SetBrain(string)
BrainUpdaterBase<OvermindState, OvermindBot, OvermindAction>.ClearBrains()
BrainUpdaterBase<OvermindState, OvermindBot, OvermindAction>.AddBotAsync(string, IBotBrain, string, int, CancellationToken)
BrainUpdaterBase<OvermindState, OvermindBot, OvermindAction>.AddBotAsync(string, object, IBotBrain, string, int, CancellationToken)
BrainUpdaterBase<OvermindState, OvermindBot, OvermindAction>.AddBotAsync(string, OvermindState, IBotBrain, string, int, CancellationToken)
BrainUpdaterBase<OvermindState, OvermindBot, OvermindAction>.RemoveBotAsync(IAutomatedBot, IBotBrain)
BrainUpdaterBase<OvermindState, OvermindBot, OvermindAction>.Run(CancellationToken)
BrainUpdaterBase<OvermindState, OvermindBot, OvermindAction>.RunOnce()
BrainUpdaterBase<OvermindState, OvermindBot, OvermindAction>.RemoveBrain(IBotBrain)
BrainUpdaterBase<OvermindState, OvermindBot, OvermindAction>.CreateBotAsync(string, OvermindState, string, int)
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Microsoft.XboxStudios.BotBrain.Overmind
Assembly: BotBrain.Overmind.dll
Syntax
public class OvermindUpdater : BrainUpdaterBase<OvermindState, OvermindBot, OvermindAction>, IOvermindUpdater, IBrainUpdater

Constructors

View Source

OvermindUpdater(IDeviceProvider, IBrainHelper, IOvermindSerializer, IServiceProvider, OvermindManager?, ILogger<OvermindUpdater>?)

Initializes a new instance of the OvermindUpdater class.

Declaration
public OvermindUpdater(IDeviceProvider deviceProvider, IBrainHelper brainHelper, IOvermindSerializer serializer, IServiceProvider services, OvermindManager? brainManager = null, ILogger<OvermindUpdater>? logger = null)
Parameters
Type Name Description
IDeviceProvider deviceProvider

The device provider.

IBrainHelper brainHelper

The brain helper to use to run title-specific bots within overmind.

IOvermindSerializer serializer

The brain serializer.

IServiceProvider services

The service provider used for construction.

OvermindManager brainManager

The brain manager.

ILogger<OvermindUpdater> logger

The logger to use.

Properties

View Source

MaxTickFrequency

Gets or sets the maximum overmind tick frequency, when only one bot is running. When more than one bot is running, this value will be divided by the number of bots.

Declaration
public TimeSpan MaxTickFrequency { get; set; }
Property Value
Type Description
TimeSpan
View Source

Serializer

Gets the overmind serializer.

Declaration
protected IOvermindSerializer Serializer { get; }
Property Value
Type Description
IOvermindSerializer
View Source

Settings

Gets the overmind settings.

Declaration
public OvermindSettings Settings { get; }
Property Value
Type Description
OvermindSettings
View Source

State

Gets the overmind state.

Declaration
public OvermindState State { get; }
Property Value
Type Description
OvermindState
View Source

States

Gets the game state objects associated with running bots.

Declaration
public override IReadOnlyCollection<OvermindState> States { get; }
Property Value
Type Description
IReadOnlyCollection<OvermindState>
Overrides
Microsoft.XboxStudios.BotBrain.Composition.BrainUpdaterBase<Microsoft.XboxStudios.BotBrain.Overmind.OvermindState, Microsoft.XboxStudios.BotBrain.Overmind.OvermindBot, Microsoft.XboxStudios.BotBrain.Overmind.OvermindAction>.States
View Source

SubBrainHelper

Gets the brain helper to use to run title-specific bots within overmind.

Declaration
protected IBrainHelper SubBrainHelper { get; }
Property Value
Type Description
IBrainHelper

Methods

View Source

AddBotAsync(string, IBotBrain?, string?, int, CancellationToken)

Adds a bot to the brain.

Declaration
public override Task<IAutomatedBot?> AddBotAsync(string deviceName, IBotBrain? brain = null, string? botName = null, int playerIndex = 0, CancellationToken token = default)
Parameters
Type Name Description
string deviceName

The device name.

IBotBrain brain

The brain to use.

string botName

The bot's name.

int playerIndex

The bot's player index.

CancellationToken token

The cancellation token.

Returns
Type Description
Task<IAutomatedBot>

The bot.

Overrides
BrainUpdaterBase<OvermindState, OvermindBot, OvermindAction>.AddBotAsync(string, IBotBrain, string, int, CancellationToken)
View Source

AddBrain(IBotBrain?)

Adds a brain instance.

Declaration
public override bool AddBrain(IBotBrain? brain)
Parameters
Type Name Description
IBotBrain brain

The brain.

Returns
Type Description
bool

True if the brain was added successfully.

Overrides
Microsoft.XboxStudios.BotBrain.Composition.BrainUpdaterBase<Microsoft.XboxStudios.BotBrain.Overmind.OvermindState, Microsoft.XboxStudios.BotBrain.Overmind.OvermindBot, Microsoft.XboxStudios.BotBrain.Overmind.OvermindAction>.AddBrain(Microsoft.XboxStudios.BotBrain.IBotBrain)
View Source

CreateBotAsync(string, OvermindState, string, int)

Creates a bot.

Declaration
protected override Task<OvermindBot> CreateBotAsync(string deviceName, OvermindState state, string botName, int playerIndex)
Parameters
Type Name Description
string deviceName

The device name.

OvermindState state

The game state.

string botName

The bot's name.

int playerIndex

The bot's player index.

Returns
Type Description
Task<OvermindBot>

The bot.

Overrides
BrainUpdaterBase<OvermindState, OvermindBot, OvermindAction>.CreateBotAsync(string, OvermindState, string, int)
View Source

CreateState()

Used to populate the title-specific overmind state.

Declaration
protected virtual OvermindState CreateState()
Returns
Type Description
OvermindState

An overmind state object.

View Source

CreateState<TState>(params object[]?)

Used to create a title-specific overmind state.

Declaration
protected TState CreateState<TState>(params object[]? parameters) where TState : OvermindState
Parameters
Type Name Description
object[] parameters

The parameters, if any. If null, the sub-brain helper is passed.

Returns
Type Description
TState

A state object.

Type Parameters
Name Description
TState

The state type

View Source

FlagUnfinishedScenarios()

Flags the unfinished scenarios as failed.

Declaration
public void FlagUnfinishedScenarios()
View Source

OnEventReceived(object?, OvermindEventArgs)

Called when the overmind state receives an event.

Declaration
protected virtual void OnEventReceived(object? sender, OvermindEventArgs e)
Parameters
Type Name Description
object sender

The event publisher.

OvermindEventArgs e

The event.

View Source

OnSubbotEventReceived(object?, OvermindBotEventArgs)

Called when the overmind state receives a sub-bot event.

Declaration
protected virtual void OnSubbotEventReceived(object? sender, OvermindBotEventArgs e)
Parameters
Type Name Description
object sender

The event publisher.

OvermindBotEventArgs e

The event.

View Source

RecalculateTickRate()

Re-calculates the current overmind tick rate.

Declaration
protected virtual void RecalculateTickRate()
View Source

RemoveBotAsync(IAutomatedBot, IBotBrain?)

Removes a bot from the brain.

Declaration
public override Task RemoveBotAsync(IAutomatedBot bot, IBotBrain? brain = null)
Parameters
Type Name Description
IAutomatedBot bot

The bot.

IBotBrain brain

The brain to use.

Returns
Type Description
Task

A task.

Overrides
Microsoft.XboxStudios.BotBrain.Composition.BrainUpdaterBase<Microsoft.XboxStudios.BotBrain.Overmind.OvermindState, Microsoft.XboxStudios.BotBrain.Overmind.OvermindBot, Microsoft.XboxStudios.BotBrain.Overmind.OvermindAction>.RemoveBotAsync(Microsoft.XboxStudios.BotBrain.IAutomatedBot, Microsoft.XboxStudios.BotBrain.IBotBrain)
View Source

ResetState(Action<OvermindEventArgs>?)

Resets the overmind state including returning scenarios with their initial settings.

Declaration
public void ResetState(Action<OvermindEventArgs>? eventSubscriber = null)
Parameters
Type Name Description
Action<OvermindEventArgs> eventSubscriber

An optional subscriber for overmind events.

Implements

IOvermindUpdater
IBrainUpdater
  • View Source
In this article
Back to top Generated by DocFX