Changed implementation of slipstream to make it less likely that AI

will form 'trains': you have to slipstream for a certain amount of 
time, then (indicated by blue nitro sparks appearing) you will get
a zipper boost. This avoids the previous issue that by getting a
bonus even after a single frame of slipstream that trains are build
(since an overtaken kart will become faster, it's easy for the 
overtaken kart to keep on getting slipstream bonus. Now the overtaking
kart gets a zipper and is therefore far enough ahead of the overtaken
kart as to not giving it a slipstream bonus).


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@5874 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2010-09-02 22:42:35 +00:00
parent 73339a9510
commit b1205821b2

View File

@ -926,6 +926,9 @@ float Kart::handleSlipstream(float dt)
unsigned int num_karts = world->getNumKarts();
bool is_sstreaming = false;
Kart *target_kart;
// Note that this loop can not be simply replaced with a shorter loop
// using only the karts with a better position - since a kart might
// be a lap behind
for(unsigned int i=0; i<num_karts; i++)
{
target_kart = world->getKart(i);
@ -974,12 +977,13 @@ float Kart::handleSlipstream(float dt)
if(m_slipstream_time>m_kart_properties->getSlipstreamCollectTime())
{
m_slipstream_mode = SS_USE;
//handleZipper(); // FIXME(/REMOVE?) Zipper gives a sharp push, maybe too sharp
//return 0; // see below about abusing m_zipper_time_left without zipper
return m_kart_properties->getSlipstreamAddPower();
handleZipper(); // FIXME(/REMOVE?) Zipper gives a sharp push, maybe too sharp
return 0; // see below about abusing m_zipper_time_left without zipper
//return m_kart_properties->getSlipstreamAddPower();
}
m_zipper_time_left = 5.0f; // FIXME, this is a hack to test higher speed limit without zipper, better would be own counter
return m_kart_properties->getSlipstreamAddPower();
//m_zipper_time_left = 5.0f; // FIXME, this is a hack to test higher speed limit without zipper, better would be own counter
return 0;
//return m_kart_properties->getSlipstreamAddPower();
} // handleSlipstream
@ -1471,6 +1475,11 @@ void Kart::updateGraphics(const Vec3& offset_xyz,
m_nitro->setCreationRate(m_controls.m_nitro && m_collected_energy>0
? (10.0f + fabsf(getSpeed())*20.0f) : 0);
// For testing purposes mis-use the nitro graphical effects to show
// then the slipstream becomes usable.
if(m_slipstream_mode == SS_USE)
m_nitro->setCreationRate(20.0f);
float speed_ratio = getSpeed()/getMaxSpeed();
float offset_heading = getSteerPercent()*m_kart_properties->getSkidVisual()
* speed_ratio * m_skidding*m_skidding;