Added setting for disabling slipstream bonus (to be used mainly
with easy AI to make sure building train doesn't give it too much bonus on easy) ... and fixed the existing implementation of not giving a slipstream bonus to actually work ;) git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@11821 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
885c0c0b1d
commit
7c69adcc56
@ -218,6 +218,9 @@
|
||||
|
||||
<!-- Kart-specific settings used by the AI.
|
||||
use-slipstream: if the AI should try to overtake karts using slipstream.
|
||||
disable-slipstream-usage: even if the AI is not trying to use slipstream,
|
||||
it can get a lot of bonus, esp. on easy since the AI creates trains.
|
||||
Set this to true to make sure AI does not get any slipstream bonus.
|
||||
false-start-probability: Probability of a false start.
|
||||
min/max-start-delay: Minimum and maximum start delay.
|
||||
See http://www.humanbenchmark.com/tests/reactiontime/stats.php
|
||||
@ -280,6 +283,7 @@
|
||||
<easy time-full-steer="0.1"
|
||||
straight-length-for-zipper="35"
|
||||
use-slipstream="false"
|
||||
disable-slipstream-usage="true"
|
||||
false-start-probability="0.08"
|
||||
min-start-delay="0.3" max-start-delay="0.5"
|
||||
nitro-usage="none"
|
||||
@ -296,6 +300,7 @@
|
||||
<medium time-full-steer="0.1"
|
||||
straight-length-for-zipper="35"
|
||||
use-slipstream="false"
|
||||
disable-slipstream-usage="false"
|
||||
false-start-probability="0.04"
|
||||
min-start-delay="0.25" max-start-delay="0.4"
|
||||
nitro-usage="some"
|
||||
@ -312,6 +317,7 @@
|
||||
<hard time-full-steer="0.1"
|
||||
straight-length-for-zipper="35"
|
||||
use-slipstream="true"
|
||||
disable-slipstream-usage="false"
|
||||
false-start-probability="0.01"
|
||||
min-start-delay="0.15" max-start-delay="0.28"
|
||||
nitro-usage="all"
|
||||
|
@ -302,10 +302,6 @@ bool SlipStream::isSlipstreamReady() const
|
||||
*/
|
||||
void SlipStream::updateSlipstreamPower()
|
||||
{
|
||||
// Low level AIs should not do any slipstreaming.
|
||||
if(!m_kart->getController()->isPlayerController() &&
|
||||
race_manager->getDifficulty()==RaceManager::DIFFICULTY_EASY) return;
|
||||
|
||||
// See if we are currently using accumulated slipstream credits:
|
||||
// -------------------------------------------------------------
|
||||
if(m_slipstream_mode==SS_USE)
|
||||
@ -344,6 +340,10 @@ void SlipStream::setDebugColor(const video::SColor &color)
|
||||
*/
|
||||
void SlipStream::update(float dt)
|
||||
{
|
||||
// Low level AIs should not do any slipstreaming.
|
||||
if(m_kart->getController()->disableSlipstreamBonus())
|
||||
return;
|
||||
|
||||
MovingTexture::update(dt);
|
||||
|
||||
// Update this karts slipstream quad (even for low level AI which don't
|
||||
|
@ -450,3 +450,11 @@ bool AIBaseController::doSkid(float steer_fraction)
|
||||
// for the old skidding implementation).
|
||||
return fabsf(steer_fraction)>=m_ai_properties->m_skidding_threshold;
|
||||
} // doSkid
|
||||
// ------------------------------------------------------------------------
|
||||
/** Certain AI levels will not receive a slipstream bonus in order to
|
||||
* be not as hard.
|
||||
*/
|
||||
bool AIBaseController::disableSlipstreamBonus() const
|
||||
{
|
||||
return m_ai_properties->disableSlipstreamUsage();
|
||||
} // disableSlipstreamBonus
|
||||
|
@ -110,7 +110,7 @@ public:
|
||||
virtual bool isPlayerController() const { return false; }
|
||||
virtual void action(PlayerAction action, int value) {};
|
||||
virtual void skidBonusTriggered() {};
|
||||
|
||||
virtual bool disableSlipstreamBonus() const;
|
||||
}; // AIBaseController
|
||||
|
||||
#endif
|
||||
|
@ -48,6 +48,7 @@ AIProperties::AIProperties(RaceManager::Difficulty difficulty)
|
||||
m_collect_avoid_items = false;
|
||||
m_handle_bomb = false;
|
||||
m_item_usage_non_random = false;
|
||||
m_disable_slipstream_usage = false;
|
||||
m_nitro_usage = NITRO_NONE;
|
||||
|
||||
} // AIProperties
|
||||
@ -59,6 +60,7 @@ AIProperties::AIProperties(RaceManager::Difficulty difficulty)
|
||||
void AIProperties::load(const XMLNode *ai_node)
|
||||
{
|
||||
ai_node->get("use-slipstream", &m_make_use_of_slipstream );
|
||||
ai_node->get("disable-slipstream-usage", &m_disable_slipstream_usage );
|
||||
ai_node->get("max-item-angle", &m_max_item_angle );
|
||||
ai_node->get("max-item-angle-high-speed", &m_max_item_angle_high_speed );
|
||||
ai_node->get("time-full-steer", &m_time_full_steer );
|
||||
|
@ -93,6 +93,12 @@ protected:
|
||||
/** True if the AI should avtively try to make use of slipstream. */
|
||||
bool m_make_use_of_slipstream;
|
||||
|
||||
/** Used for low level AI to not give them a slipstream bonus.
|
||||
* Otherwise they tend to build 'trains' (AIs driving close behing
|
||||
* each other and get slipstream bonus). Only for making the easy
|
||||
* AI really easy. */
|
||||
bool m_disable_slipstream_usage;
|
||||
|
||||
/** Actively collect and avoid items. */
|
||||
bool m_collect_avoid_items;
|
||||
|
||||
@ -141,6 +147,9 @@ public:
|
||||
{
|
||||
return m_collect_item_probability.get(distance);
|
||||
} // getItemcollectProbability
|
||||
// ------------------------------------------------------------------------
|
||||
/** Returns true if this kart should not even get a slipstream bonus. */
|
||||
bool disableSlipstreamUsage() const { return m_disable_slipstream_usage; }
|
||||
}; // AIProperties
|
||||
|
||||
|
||||
|
@ -72,6 +72,7 @@ public:
|
||||
virtual void finishedRace (float time) = 0;
|
||||
virtual bool isPlayerController () const = 0;
|
||||
virtual bool isNetworkController() const = 0;
|
||||
virtual bool disableSlipstreamBonus() const = 0;
|
||||
// ---------------------------------------------------------------------------
|
||||
/** Sets the controller name for this controller. */
|
||||
virtual void setControllerName(const std::string &name)
|
||||
|
@ -70,6 +70,9 @@ public:
|
||||
virtual void crashed (const AbstractKart *k) {}
|
||||
virtual void crashed (const Material *m) {}
|
||||
// ------------------------------------------------------------------------
|
||||
/** Player will always be able to get a slipstream bonus. */
|
||||
virtual bool disableSlipstreamBonus() const { return false; }
|
||||
// ------------------------------------------------------------------------
|
||||
/** Callback whenever a new lap is triggered. Used by the AI
|
||||
* to trigger a recomputation of the way to use. */
|
||||
virtual void newLap(int lap) {}
|
||||
|
Loading…
Reference in New Issue
Block a user