Added AI tweaks (adjusting curve speed and angle
depending on track). Details in wiki. git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@1513 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
720d31edc5
commit
930a1ef2b5
@ -6,6 +6,8 @@
|
|||||||
(music "oggs/CaribbeanMusic.ogg")
|
(music "oggs/CaribbeanMusic.ogg")
|
||||||
(screenshot "sshot-beach.rgb")
|
(screenshot "sshot-beach.rgb")
|
||||||
(topview "topview-beach.rgb")
|
(topview "topview-beach.rgb")
|
||||||
|
(AI-curve-speed-adjust 2.0)
|
||||||
|
(AI-angle-adjust 2.7)
|
||||||
)
|
)
|
||||||
|
|
||||||
;; EOF ;;
|
;; EOF ;;
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
(music "oggs/Lava_Lagoon_2.ogg")
|
(music "oggs/Lava_Lagoon_2.ogg")
|
||||||
(screenshot "sshot-bsodcastle.rgb")
|
(screenshot "sshot-bsodcastle.rgb")
|
||||||
(topview "topview-bsodcastle.rgb")
|
(topview "topview-bsodcastle.rgb")
|
||||||
|
(AI-curve-speed-adjust 2.0)
|
||||||
|
(AI-angle-adjust 2.0)
|
||||||
)
|
)
|
||||||
|
|
||||||
;; EOF ;;
|
;; EOF ;;
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
(music "oggs/tk2.ogg")
|
(music "oggs/tk2.ogg")
|
||||||
(screenshot "sshot-geekopeak.rgb")
|
(screenshot "sshot-geekopeak.rgb")
|
||||||
(topview "topview-geekopeak.rgb")
|
(topview "topview-geekopeak.rgb")
|
||||||
|
(AI-curve-speed-adjust 2.0)
|
||||||
|
(AI-angle-adjust 4.0)
|
||||||
)
|
)
|
||||||
|
|
||||||
;; EOF ;;
|
;; EOF ;;
|
||||||
|
@ -7,6 +7,8 @@
|
|||||||
(music "oggs/another_caribbean_beat.ogg")
|
(music "oggs/another_caribbean_beat.ogg")
|
||||||
(screenshot "sshot-gownsbow.rgb")
|
(screenshot "sshot-gownsbow.rgb")
|
||||||
(topview "topview-gownsbow.rgb")
|
(topview "topview-gownsbow.rgb")
|
||||||
|
(AI-curve-speed-adjust 1.3)
|
||||||
|
(AI-angle-adjust 2.3)
|
||||||
)
|
)
|
||||||
|
|
||||||
;; EOF ;;
|
;; EOF ;;
|
||||||
|
@ -9,7 +9,8 @@
|
|||||||
(start-heading 0.0 3.7 9.5 11.5 15.1 17.0 20.2 22.0 26.0 36.0 )
|
(start-heading 0.0 3.7 9.5 11.5 15.1 17.0 20.2 22.0 26.0 36.0 )
|
||||||
(start-x -1.2 1.6 -0.9 2.3 0.0 3.4 1.2 4.2 2.6 6.2 )
|
(start-x -1.2 1.6 -0.9 2.3 0.0 3.4 1.2 4.2 2.6 6.2 )
|
||||||
(start-y -0.5 -1.5 -3.8 -5.0 -7.0 -8.0 -10.4 -10.9 -13.4 -14.1 )
|
(start-y -0.5 -1.5 -3.8 -5.0 -7.0 -8.0 -10.4 -10.9 -13.4 -14.1 )
|
||||||
|
(AI-curve-speed-adjust 1.7)
|
||||||
|
(AI-angle-adjust 1.7)
|
||||||
)
|
)
|
||||||
|
|
||||||
;; EOF ;;
|
;; EOF ;;
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
(music "oggs/tk2.ogg")
|
(music "oggs/tk2.ogg")
|
||||||
(screenshot "sshot-lighthouse.rgb")
|
(screenshot "sshot-lighthouse.rgb")
|
||||||
(topview "topview-lighthouse.rgb")
|
(topview "topview-lighthouse.rgb")
|
||||||
|
(AI-curve-speed-adjust 1.7)
|
||||||
|
(AI-angle-adjust 1.7)
|
||||||
)
|
)
|
||||||
|
|
||||||
;; EOF ;;
|
;; EOF ;;
|
||||||
|
@ -18,6 +18,8 @@
|
|||||||
(music "oggs/tk5a.ogg")
|
(music "oggs/tk5a.ogg")
|
||||||
(screenshot "sshot-littlevolcano.rgb")
|
(screenshot "sshot-littlevolcano.rgb")
|
||||||
(topview "topview-littlevolcano.rgb")
|
(topview "topview-littlevolcano.rgb")
|
||||||
|
(AI-curve-speed-adjust 3.0)
|
||||||
|
(AI-angle-adjust 3.3)
|
||||||
)
|
)
|
||||||
|
|
||||||
;; EOF ;;
|
;; EOF ;;
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
(music "oggs/Boom_boom_boom.ogg")
|
(music "oggs/Boom_boom_boom.ogg")
|
||||||
(screenshot "sshot-olivermath.rgb")
|
(screenshot "sshot-olivermath.rgb")
|
||||||
(topview "topview-olivermath.rgb")
|
(topview "topview-olivermath.rgb")
|
||||||
|
(AI-curve-speed-adjust 1.3)
|
||||||
|
(AI-angle-adjust 1.7)
|
||||||
)
|
)
|
||||||
|
|
||||||
;; EOF ;;
|
;; EOF ;;
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
(music "oggs/tk5a.ogg" "oggs/tk2.ogg")
|
(music "oggs/tk5a.ogg" "oggs/tk2.ogg")
|
||||||
(screenshot "sshot-race.rgb")
|
(screenshot "sshot-race.rgb")
|
||||||
(topview "topview-race.rgb")
|
(topview "topview-race.rgb")
|
||||||
|
(AI-curve-speed-adjust 1.3)
|
||||||
|
(AI-angle-adjust 2.0)
|
||||||
)
|
)
|
||||||
|
|
||||||
;; EOF ;;
|
;; EOF ;;
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
(music "oggs/desert_dunes.ogg" "oggs/tk7.ogg")
|
(music "oggs/desert_dunes.ogg" "oggs/tk7.ogg")
|
||||||
(screenshot "sshot-sandtrack.rgb")
|
(screenshot "sshot-sandtrack.rgb")
|
||||||
(topview "topview-sandtrack.rgb")
|
(topview "topview-sandtrack.rgb")
|
||||||
|
(AI-curve-speed-adjust 1.0)
|
||||||
|
(AI-angle-adjust 3.0)
|
||||||
)
|
)
|
||||||
|
|
||||||
;; EOF ;;
|
;; EOF ;;
|
||||||
|
@ -7,6 +7,8 @@
|
|||||||
(music "oggs/Ethereal_Spectrum_\(ver_loop\).ogg")
|
(music "oggs/Ethereal_Spectrum_\(ver_loop\).ogg")
|
||||||
(screenshot "sshot-startrack.rgb")
|
(screenshot "sshot-startrack.rgb")
|
||||||
(topview "topview-startrack.rgb")
|
(topview "topview-startrack.rgb")
|
||||||
|
(AI-curve-speed-adjust 1.7)
|
||||||
|
(AI-angle-adjust 2.0)
|
||||||
)
|
)
|
||||||
|
|
||||||
;; EOF ;;
|
;; EOF ;;
|
||||||
|
@ -18,6 +18,8 @@
|
|||||||
(music "oggs/tuxr.ogg")
|
(music "oggs/tuxr.ogg")
|
||||||
(screenshot "sshot-subseatrack.rgb")
|
(screenshot "sshot-subseatrack.rgb")
|
||||||
(topview "topview-subseatrack.rgb")
|
(topview "topview-subseatrack.rgb")
|
||||||
|
(AI-curve-speed-adjust 2.3)
|
||||||
|
(AI-angle-adjust 4.0)
|
||||||
)
|
)
|
||||||
|
|
||||||
;; EOF ;;
|
;; EOF ;;
|
||||||
|
@ -9,6 +9,8 @@
|
|||||||
(start-heading -25.0 -25.0 -25.0 -25.0 -25.0 -25.0 -25.0 -25.0 -25.0 -25.0 )
|
(start-heading -25.0 -25.0 -25.0 -25.0 -25.0 -25.0 -25.0 -25.0 -25.0 -25.0 )
|
||||||
(start-x 0.1 -3.3 -1.5 -4.8 -3.0 -6.3 -4.5 -7.8 -6.0 -9.3 )
|
(start-x 0.1 -3.3 -1.5 -4.8 -3.0 -6.3 -4.5 -7.8 -6.0 -9.3 )
|
||||||
(start-y -2.0 -1.8 -4.6 -4.4 -7.2 -7.0 -9.8 -9.6 -12.4 -12.2 )
|
(start-y -2.0 -1.8 -4.6 -4.4 -7.2 -7.0 -9.8 -9.6 -12.4 -12.2 )
|
||||||
|
(AI-curve-speed-adjust 1.7)
|
||||||
|
(AI-angle-adjust 2.3)
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -6,6 +6,8 @@
|
|||||||
(music "oggs/Boom_boom_boom.ogg")
|
(music "oggs/Boom_boom_boom.ogg")
|
||||||
(screenshot "sshot-volcano.rgb")
|
(screenshot "sshot-volcano.rgb")
|
||||||
(topview "topview-volcano.rgb")
|
(topview "topview-volcano.rgb")
|
||||||
|
(AI-curve-speed-adjust 2.0)
|
||||||
|
(AI-angle-adjust 2.3)
|
||||||
)
|
)
|
||||||
|
|
||||||
;; EOF ;;
|
;; EOF ;;
|
||||||
|
@ -170,8 +170,10 @@ void DefaultRobot::handle_braking()
|
|||||||
//Brake if the kart's speed is bigger than the speed we need
|
//Brake if the kart's speed is bigger than the speed we need
|
||||||
//to go through the curve at the widest angle, or if the kart
|
//to go through the curve at the widest angle, or if the kart
|
||||||
//is not going straight in relation to the road.
|
//is not going straight in relation to the road.
|
||||||
if(getVelocityLC().getY() > m_curve_target_speed ||
|
float angle_adjust = world->m_track->getAIAngleAdjustment();
|
||||||
kart_ang_diff > MIN_TRACK_ANGLE )
|
float speed_adjust = world->m_track->getAICurveSpeedAdjustment();
|
||||||
|
if(getVelocityLC().getY() > speed_adjust*m_curve_target_speed ||
|
||||||
|
kart_ang_diff > angle_adjust*MIN_TRACK_ANGLE )
|
||||||
{
|
{
|
||||||
#ifdef AI_DEBUG
|
#ifdef AI_DEBUG
|
||||||
std::cout << "BRAKING" << std::endl;
|
std::cout << "BRAKING" << std::endl;
|
||||||
|
@ -781,6 +781,8 @@ void Track::loadTrack(std::string filename_)
|
|||||||
m_fog_start = 0.0f;
|
m_fog_start = 0.0f;
|
||||||
m_fog_end = 1000.0f;
|
m_fog_end = 1000.0f;
|
||||||
m_gravity = 9.80665f;
|
m_gravity = 9.80665f;
|
||||||
|
m_AI_angle_adjustment = 1.0f;
|
||||||
|
m_AI_curve_speed_adjustment = 1.0f;
|
||||||
|
|
||||||
sgSetVec3 ( m_sun_position, 0.4f, 0.4f, 0.4f );
|
sgSetVec3 ( m_sun_position, 0.4f, 0.4f, 0.4f );
|
||||||
sgSetVec4 ( m_sky_color, 0.3f, 0.7f, 0.9f, 1.0f );
|
sgSetVec4 ( m_sky_color, 0.3f, 0.7f, 0.9f, 1.0f );
|
||||||
@ -814,18 +816,19 @@ void Track::loadTrack(std::string filename_)
|
|||||||
LISP->getVector("start-y", m_start_y);
|
LISP->getVector("start-y", m_start_y);
|
||||||
LISP->getVector("start-z", m_start_z);
|
LISP->getVector("start-z", m_start_z);
|
||||||
LISP->getVector("start-heading", m_start_heading);
|
LISP->getVector("start-heading", m_start_heading);
|
||||||
|
|
||||||
LISP->get ("use-fog", m_use_fog);
|
LISP->get ("use-fog", m_use_fog);
|
||||||
LISP->get ("fog-color", m_fog_color);
|
LISP->get ("fog-color", m_fog_color);
|
||||||
LISP->get ("fog-density", m_fog_density);
|
LISP->get ("fog-density", m_fog_density);
|
||||||
LISP->get ("fog-start", m_fog_start);
|
LISP->get ("fog-start", m_fog_start);
|
||||||
LISP->get ("fog-end", m_fog_end);
|
LISP->get ("fog-end", m_fog_end);
|
||||||
|
|
||||||
LISP->get ("sun-position", m_sun_position);
|
LISP->get ("sun-position", m_sun_position);
|
||||||
LISP->get ("sun-ambient", m_ambient_col);
|
LISP->get ("sun-ambient", m_ambient_col);
|
||||||
LISP->get ("sun-specular", m_specular_col);
|
LISP->get ("sun-specular", m_specular_col);
|
||||||
LISP->get ("sun-diffuse", m_diffuse_col);
|
LISP->get ("sun-diffuse", m_diffuse_col);
|
||||||
LISP->get ("gravity", m_gravity);
|
LISP->get ("gravity", m_gravity);
|
||||||
|
LISP->get ("AI-angle-adjust", m_AI_angle_adjustment);
|
||||||
|
LISP->get ("AI-curve-speed-adjust", m_AI_curve_speed_adjustment);
|
||||||
|
|
||||||
delete ROOT;
|
delete ROOT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,7 +52,11 @@ private:
|
|||||||
ssgBranch* m_model;
|
ssgBranch* m_model;
|
||||||
TriangleMesh* m_track_mesh;
|
TriangleMesh* m_track_mesh;
|
||||||
TriangleMesh* m_non_collision_mesh;
|
TriangleMesh* m_non_collision_mesh;
|
||||||
|
// The next two variables are for AI improvements: the AI sometimes does
|
||||||
|
// not estimate curve speed and/or angle correctly, resulting in too much
|
||||||
|
// braking. These factors are used to adjust this.
|
||||||
|
float m_AI_angle_adjustment;
|
||||||
|
float m_AI_curve_speed_adjustment;
|
||||||
public:
|
public:
|
||||||
enum RoadSide{ RS_DONT_KNOW = -1, RS_LEFT = 0, RS_RIGHT = 1 };
|
enum RoadSide{ RS_DONT_KNOW = -1, RS_LEFT = 0, RS_RIGHT = 1 };
|
||||||
|
|
||||||
@ -175,6 +179,8 @@ public:
|
|||||||
const float& getFogDensity () const {return m_fog_density; }
|
const float& getFogDensity () const {return m_fog_density; }
|
||||||
const float& getFogStart () const {return m_fog_start; }
|
const float& getFogStart () const {return m_fog_start; }
|
||||||
const float& getFogEnd () const {return m_fog_end; }
|
const float& getFogEnd () const {return m_fog_end; }
|
||||||
|
const float& getAIAngleAdjustment () const {return m_AI_angle_adjustment;}
|
||||||
|
const float& getAICurveSpeedAdjustment() const {return m_AI_curve_speed_adjustment;}
|
||||||
const sgVec4& getSkyColor () const {return m_sky_color; }
|
const sgVec4& getSkyColor () const {return m_sky_color; }
|
||||||
const std::string& getDescription () const {return m_description; }
|
const std::string& getDescription () const {return m_description; }
|
||||||
const std::string& getTopviewFile () const {return m_top_view; }
|
const std::string& getTopviewFile () const {return m_top_view; }
|
||||||
@ -183,7 +189,6 @@ public:
|
|||||||
const std::vector<SGfloat>& getWidth() const {return m_path_width; }
|
const std::vector<SGfloat>& getWidth() const {return m_path_width; }
|
||||||
const std::string& getHerringStyle () const {return m_herring_style; }
|
const std::string& getHerringStyle () const {return m_herring_style; }
|
||||||
void getStartCoords (unsigned int pos, sgCoord* coords) const;
|
void getStartCoords (unsigned int pos, sgCoord* coords) const;
|
||||||
// static const Material* getMaterial (unsigned int n) {return m_triangleIndex2Material[n];}
|
|
||||||
void getTerrainInfo(btVector3 &pos, float *hot, btVector3* normal,
|
void getTerrainInfo(btVector3 &pos, float *hot, btVector3* normal,
|
||||||
const Material **material) const;
|
const Material **material) const;
|
||||||
void createPhysicsModel ();
|
void createPhysicsModel ();
|
||||||
|
@ -510,7 +510,7 @@ void World::updateRaceStatus(float dt)
|
|||||||
printf("min %f max %f av %f\n",min_t, max_t, av_t/m_kart.size());
|
printf("min %f max %f av %f\n",min_t, max_t, av_t/m_kart.size());
|
||||||
std::exit(-2);
|
std::exit(-2);
|
||||||
}
|
}
|
||||||
}
|
} // if all karts are finished
|
||||||
|
|
||||||
// 2) All player karts are finished --> wait some
|
// 2) All player karts are finished --> wait some
|
||||||
// time for AI karts to arrive before finishing
|
// time for AI karts to arrive before finishing
|
||||||
|
Loading…
x
Reference in New Issue
Block a user