19#ifndef HEADER_AI_BASE_CONTROLLER_HPP
20#define HEADER_AI_BASE_CONTROLLER_HPP
22#include "karts/controller/controller.hpp"
23#include "utils/cpp2011.hpp"
46 bool m_enabled_network_ai;
60 static bool m_ai_debug;
82 virtual bool canSkid(
float steer_fraction) = 0;
87 virtual void reset() OVERRIDE;
90 static
void enableDebug() {m_ai_debug =
true; }
91 static void setTestAI(
int n) {
m_test_ai = n; }
92 static int getTestAI() {
return m_test_ai; }
94 virtual void handleZipper(
bool play_sound) OVERRIDE {};
96 virtual void collectedItem(
const ItemState &item,
97 float previous_energy=0) OVERRIDE {};
98 virtual void setPosition(
int p) OVERRIDE {};
105 virtual void skidBonusTriggered() OVERRIDE {}
109 void setNetworkAI(
bool val) { m_enabled_network_ai = val; }
111 virtual void update(
int ticks) OVERRIDE;
A base class for all AI karts.
Definition: ai_base_controller.hpp:34
virtual bool action(PlayerAction action, int value, bool dry_run=false) OVERRIDE
Default: ignore actions.
Definition: ai_base_controller.hpp:101
float m_kart_width
Cache width of kart.
Definition: ai_base_controller.hpp:52
bool m_stuck
A flag that is set during the physics processing to indicate that this kart is stuck and needs to be ...
Definition: ai_base_controller.hpp:43
virtual bool isPlayerController() const OVERRIDE
This function checks if this player is not an AI, i.e.
Definition: ai_base_controller.hpp:99
const AIProperties * m_ai_properties
A pointer to the AI properties for this kart.
Definition: ai_base_controller.hpp:58
bool isStuck() const
This can be called to detect if the kart is stuck (i.e.
Definition: ai_base_controller.hpp:75
void setControllerName(const std::string &name) OVERRIDE
In debug mode when the user specified –ai-debug on the command line set the name of the controller as...
Definition: ai_base_controller.cpp:69
virtual bool disableSlipstreamBonus() const OVERRIDE
Certain AI levels will not receive a slipstream bonus in order to be not as hard.
Definition: ai_base_controller.cpp:222
virtual bool isLocalPlayerController() const OVERRIDE
This function checks if this is a local player.
Definition: ai_base_controller.hpp:100
std::vector< int > m_collision_ticks
Stores the last N times when a collision happened.
Definition: ai_base_controller.hpp:39
virtual void finishedRace(float time) OVERRIDE
Called whan this controller's kart finishes the last lap.
Definition: ai_base_controller.hpp:95
Track * m_track
Keep a pointer to the track to reduce calls.
Definition: ai_base_controller.hpp:55
virtual void setSteering(float angle, float dt)
Converts the steering angle to a lr steering in the range of -1 to 1.
Definition: ai_base_controller.cpp:185
float normalizeAngle(float angle)
Normalises an angle to be between -pi and _ pi.
Definition: ai_base_controller.cpp:157
void determineTurnRadius(const Vec3 &end, Vec3 *center, float *radius) const
Determine the center point and radius of a circle given two points on the circle and the tangent at t...
Definition: ai_base_controller.cpp:299
float steerToPoint(const Vec3 &point)
Computes the steering angle to reach a certain point.
Definition: ai_base_controller.cpp:86
static int m_test_ai
Stores the '–test-ai=n' command line parameter: It indicates which fraction of the AIs are going to b...
Definition: ai_base_controller.hpp:67
virtual void crashed(const Material *m) OVERRIDE
This is called when the kart crashed with the terrain.
Definition: ai_base_controller.cpp:235
virtual bool canSkid(float steer_fraction)=0
Return true if AI can skid now.
float m_kart_length
Length of the kart, storing it here saves many function calls.
Definition: ai_base_controller.hpp:49
A simple class that stores all AI related properties.
Definition: ai_properties.hpp:40
An abstract interface for the actual karts.
Definition: abstract_kart.hpp:62
Describes a chain of 8-bit unsigned integers.
Definition: network_string.hpp:53
This is the base class for kart controller - that can be a player or a a robot.
Definition: controller.hpp:46
Contains the state information of an item, i.e.
Definition: item.hpp:53
Definition: material.hpp:48
Definition: track.hpp:114
A wrapper around bullets btVector3 to include conventient conversion functions (e....
Definition: vec3.hpp:35