SuperTuxKart
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
NetworkAIController Class Reference
Inheritance diagram for NetworkAIController:
Inheritance graph
[legend]

Public Member Functions

 NetworkAIController (AbstractKart *kart, int local_player_id, AIBaseController *ai)
 
virtual void update (int ticks) OVERRIDE
 Updates the player kart, called once each timestep.
 
virtual void reset () OVERRIDE
 Resets the player kart for a new or restarted race.
 
virtual bool isLocalPlayerController () const OVERRIDE
 This function checks if this is a local player.
 
- Public Member Functions inherited from PlayerController
 PlayerController (AbstractKart *kart)
 
virtual ~PlayerController ()
 Destructor for a player kart.
 
virtual void update (int ticks) OVERRIDE
 Updates the player kart, called once each timestep.
 
virtual bool action (PlayerAction action, int value, bool dry_run=false) OVERRIDE
 This function interprets a kart action and value, and set the corresponding entries in the kart control data structure.
 
virtual void actionFromNetwork (PlayerAction action, int value, int value_l, int value_r)
 
virtual void skidBonusTriggered () OVERRIDE
 Callback when the skidding bonus is triggered.
 
virtual void reset () OVERRIDE
 Resets the player kart for a new or restarted race.
 
virtual void handleZipper (bool play_sound) OVERRIDE
 Called when a kart hits or uses a zipper.
 
virtual void resetInputState ()
 Resets the state of control keys.
 
virtual bool saveState (BareNetworkString *buffer) const OVERRIDE
 
virtual void rewindTo (BareNetworkString *buffer) OVERRIDE
 
virtual void collectedItem (const ItemState &item, float previous_energy=0) OVERRIDE
 
virtual bool isPlayerController () const OVERRIDE
 This function checks if this player is not an AI, i.e.
 
virtual bool isLocalPlayerController () const OVERRIDE
 This function checks if this is a local player.
 
virtual void setPosition (int p) OVERRIDE
 Called just before the position of the kart is changed.
 
virtual void crashed (const AbstractKart *k) OVERRIDE
 
virtual void crashed (const Material *m) OVERRIDE
 
virtual void newLap (int lap) OVERRIDE
 Callback whenever a new lap is triggered.
 
virtual bool disableSlipstreamBonus () const OVERRIDE
 Player will always be able to get a slipstream bonus.
 
virtual void finishedRace (float time) OVERRIDE
 Called when a race is finished.
 
core::stringw getName (bool include_handicap_string=true) const OVERRIDE
 Returns the name of the player profile.
 
virtual void displayPenaltyWarning ()
 Called when this kart started too early and got a start penalty.
 
- Public Member Functions inherited from Controller
 Controller (AbstractKart *kart)
 Constructor, saves the kart pointer and a pointer to the KartControl of the kart.
 
virtual void reset ()=0
 
virtual void update (int ticks)=0
 
virtual void handleZipper (bool play_sound)=0
 
virtual void collectedItem (const ItemState &item, float previous_energy=0)=0
 
virtual void crashed (const AbstractKart *k)=0
 
virtual void crashed (const Material *m)=0
 
virtual void setPosition (int p)=0
 
virtual bool isLocalPlayerController () const =0
 This function checks if this is a local player.
 
virtual bool isPlayerController () const =0
 This function checks if this player is not an AI, i.e.
 
virtual bool disableSlipstreamBonus () const =0
 
virtual bool saveState (BareNetworkString *buffer) const =0
 
virtual void rewindTo (BareNetworkString *buffer)=0
 
virtual void rumble (float strength_low, float strength_high, uint16_t duration)
 
virtual void setControllerName (const std::string &name)
 Sets the controller name for this controller.
 
const std::string & getControllerName () const
 Returns the name of this controller.
 
virtual bool action (PlayerAction action, int value, bool dry_run=false)=0
 Default: ignore actions.
 
virtual void newLap (int lap)=0
 Callback whenever a new lap is triggered.
 
virtual void skidBonusTriggered ()=0
 
virtual void finishedRace (float time)=0
 Called whan this controller's kart finishes the last lap.
 
virtual KartControlgetControls ()
 Get a pointer on the kart controls.
 
void setControls (KartControl *kc)
 
virtual bool canGetAchievements () const
 Only local players can get achievements.
 
virtual core::stringw getName (bool include_handicap_string=true) const
 Display name of the controller.
 
AbstractKartgetKart () const
 Returns the kart controlled by this controller.
 

Static Public Member Functions

static void setAIFrequency (int freq)
 

Private Member Functions

void convertAIToPlayerActions ()
 

Private Attributes

int m_prev_update_ticks
 
AIBaseControllerm_ai_controller
 
KartControlm_ai_controls
 

Static Private Attributes

static int m_ai_frequency = 30
 

Additional Inherited Members

- Protected Member Functions inherited from PlayerController
virtual void steer (int ticks, int steer_val)
 Handles steering for a player kart.
 
- Protected Attributes inherited from PlayerController
int m_steer_val
 
int m_steer_val_l
 
int m_steer_val_r
 
uint16_t m_prev_accel
 
bool m_prev_brake
 
bool m_prev_nitro
 
int m_penalty_ticks
 
- Protected Attributes inherited from Controller
AbstractKartm_kart
 Pointer to the kart that is controlled by this controller.
 
KartControlm_controls
 A pointer to the main controller, from which the kart takes it commands.
 
std::string m_controller_name
 The name of the controller, mainly used for debugging purposes.
 

Member Function Documentation

◆ isLocalPlayerController()

bool NetworkAIController::isLocalPlayerController ( ) const
virtual

This function checks if this is a local player.

A local player will get special graphical effects enabled, has a camera, and sound effects will be played with normal volume.

Reimplemented from PlayerController.

◆ reset()

void NetworkAIController::reset ( )
virtual

Resets the player kart for a new or restarted race.

Reimplemented from PlayerController.

◆ update()

void NetworkAIController::update ( int  ticks)
virtual

Updates the player kart, called once each timestep.

Reimplemented from PlayerController.


The documentation for this class was generated from the following files: