1) Zipper now get an immediate speed boost when they are activated (instead
of only a higher acceleration). 2) Code cleanup (removed unused functions and config parameters). git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@1636 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
ced812161c
commit
6324285de8
@ -20,8 +20,9 @@
|
||||
(bomb-time 30.0 ) ;; time till a bomb explodes
|
||||
(bomb-time-increase -5.0 ) ;; time added to timer when bomb is passed on
|
||||
(anvil-time 2.0 ) ;; time an anvil is active
|
||||
(zipper-time 5.0 ) ;; time a zipper is active
|
||||
(zipper-force 800.0 ) ;; additional zipper force
|
||||
(zipper-time 3.0 ) ;; time a zipper is active
|
||||
(zipper-force 800.0 ) ;; additional zipper force
|
||||
(zipper-speed-gain 10.0 ) ;; one time additional speed boost given by zippers
|
||||
(shortcut-skipped-segments 5 ) ;; skipping more than this number of segments
|
||||
;; is considered to be a shortcut
|
||||
(explosion-impulse 10000.0 ) ;; explosion impulse on not directly hit karts
|
||||
@ -32,9 +33,6 @@
|
||||
;; -------------------------
|
||||
(jump-impulse 5400.0 ) ;; percentage of gravity!
|
||||
|
||||
(reduce-air-resistance-racer 0.6) ;; reduce air-resistance for hard
|
||||
(reduce-air-resistance-driver 0.8) ;; and medium skill level
|
||||
|
||||
;; The following files are the defaults for karts
|
||||
;; ----------------------------------------------
|
||||
(kart-defaults
|
||||
@ -44,9 +42,6 @@
|
||||
(brake-factor 2.75)
|
||||
(brake-force 2.5 )
|
||||
(mass 125 )
|
||||
(air-resistance 1.8 )
|
||||
(roll-resistance 1.05)
|
||||
(tire-grip 0.9 )
|
||||
(max-steer-angle 55 )
|
||||
(time-full-steer 0.3 )
|
||||
(corn-f 4 )
|
||||
|
33
src/kart.cpp
33
src/kart.cpp
@ -699,9 +699,16 @@ void Kart::update (float dt)
|
||||
} // update
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Set zipper time, and apply one time additional speed boost
|
||||
void Kart::handleZipper()
|
||||
{
|
||||
m_zipper_time_left = stk_config->m_zipper_time;
|
||||
m_zipper_time_left = stk_config->m_zipper_time;
|
||||
const btVector3& v = m_body->getLinearVelocity();
|
||||
float current_speed = v.length();
|
||||
float speed = std::min(current_speed+stk_config->m_zipper_speed_gain,
|
||||
getMaxSpeed());
|
||||
|
||||
m_body->setLinearVelocity(v/current_speed*speed);
|
||||
} // handleZipper
|
||||
//-----------------------------------------------------------------------------
|
||||
#define sgn(x) ((x<0)?-1.0f:((x>0)?1.0f:0.0f))
|
||||
@ -875,21 +882,6 @@ void Kart::updatePhysics (float dt)
|
||||
m_speed = 0;
|
||||
} // updatePhysics
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// PHORS recommends: f=B*alpha/(1+fabs(A*alpha)^p), where A, B, and p
|
||||
// are appropriately chosen constants.
|
||||
float Kart::NormalizedLateralForce(float alpha, float corner) const
|
||||
{
|
||||
float const MAX_ALPHA=3.14f/4.0f;
|
||||
if(fabsf(alpha)<MAX_ALPHA)
|
||||
{
|
||||
return corner*alpha;
|
||||
}
|
||||
else
|
||||
{
|
||||
return alpha>0.0f ? corner*MAX_ALPHA : -corner*MAX_ALPHA;
|
||||
}
|
||||
} // NormalizedLateralForce
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void Kart::forceRescue(bool is_shortcut)
|
||||
@ -934,15 +926,6 @@ void Kart::endRescue()
|
||||
setTrans(pos);
|
||||
} // endRescue
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
float Kart::getAirResistance() const
|
||||
{
|
||||
return (m_kart_properties->getAirResistance() +
|
||||
m_attachment.AirResistanceAdjust() )
|
||||
* stk_config->m_air_res_reduce[world->m_race_setup.m_difficulty];
|
||||
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
void Kart::processSkidMarks()
|
||||
{
|
||||
|
@ -169,7 +169,6 @@ public:
|
||||
void processSkidMarks ();
|
||||
void getClosestKart (float *cdist, int *closest);
|
||||
void updatePhysics (float dt);
|
||||
float NormalizedLateralForce(float alpha, float corner) const;
|
||||
|
||||
// Functions to access the current kart properties (which might get changed,
|
||||
// e.g. mass increase or air_friction increase depending on attachment etc.)
|
||||
@ -180,14 +179,11 @@ public:
|
||||
return m_kart_properties->getMass()
|
||||
+ m_attachment.WeightAdjust();
|
||||
}
|
||||
float getRollResistance() const {return m_kart_properties->getRollResistance();}
|
||||
float getMaxPower () const {return m_kart_properties->getMaxPower();}
|
||||
float getTimeFullSteer () const {return m_kart_properties->getTimeFullSteer();}
|
||||
float getBrakeFactor () const {return m_kart_properties->getBrakeFactor();}
|
||||
float getBrakeForce () const {return m_kart_properties->getBrakeForce();}
|
||||
float getWheelBase () const {return m_kart_properties->getWheelBase();}
|
||||
float getHeightCOG () const {return m_kart_properties->getHeightCOG();}
|
||||
float getTireGrip () const {return m_kart_properties->getTireGrip();}
|
||||
float getFrictionSlip () const {return m_kart_properties->getFrictionSlip();}
|
||||
float getMaxSteerAngle () const {return m_kart_properties->getMaxSteerAngle();}
|
||||
float getCornerStiffF () const {return m_kart_properties->getCornerStiffF();}
|
||||
@ -207,7 +203,6 @@ public:
|
||||
{return m_kart_properties->getWheelieSpeedBoost(); }
|
||||
float getSteerAngle () const
|
||||
{return m_controls.lr*m_kart_properties->getMaxSteerAngle(); }
|
||||
float getAirResistance () const;
|
||||
float getSteerPercent () const {return m_controls.lr; }
|
||||
float getMaxSpeed () const {return m_max_speed; }
|
||||
void setTimeAtLap (float t){m_time_at_last_lap=t; }
|
||||
|
@ -137,10 +137,7 @@ void KartProperties::getAllData(const lisp::Lisp* lisp)
|
||||
lisp->get("bullet-engine-power", m_engine_power);
|
||||
lisp->get("time-full-steer", m_time_full_steer);
|
||||
lisp->get("brake-factor", m_brake_factor);
|
||||
lisp->get("brake-force", m_brake_force);
|
||||
lisp->get("roll-resistance", m_roll_resistance);
|
||||
lisp->get("bullet-mass", m_mass);
|
||||
lisp->get("air-resistance", m_air_resistance);
|
||||
lisp->get("tire-grip", m_tire_grip);
|
||||
lisp->get("bullet-max-steer-angle", m_max_steer_angle);
|
||||
lisp->get("corn-f", m_corn_f);
|
||||
@ -200,10 +197,7 @@ void KartProperties::init_defaults()
|
||||
m_engine_power = stk_config->m_engine_power;
|
||||
m_time_full_steer = stk_config->m_time_full_steer;
|
||||
m_brake_factor = stk_config->m_brake_factor;
|
||||
m_brake_force = stk_config->m_brake_force;
|
||||
m_roll_resistance = stk_config->m_roll_resistance;
|
||||
m_mass = stk_config->m_mass;
|
||||
m_air_resistance = stk_config->m_air_resistance;
|
||||
m_tire_grip = stk_config->m_tire_grip;
|
||||
m_max_steer_angle = stk_config->m_max_steer_angle;
|
||||
m_corn_f = stk_config->m_corn_f;
|
||||
|
@ -53,13 +53,10 @@ protected:
|
||||
float m_kart_width; // width of kart
|
||||
float m_kart_length; // length of kart
|
||||
float m_mass; // weight of kart
|
||||
float m_air_resistance; // air resistance
|
||||
float m_roll_resistance; // rolling resistance etc
|
||||
float m_wheel_base; // distance between front and read wheels
|
||||
float m_height_cog; // height of center of gravity
|
||||
float m_engine_power; // maximum force from engine
|
||||
float m_brake_factor; // braking factor * engine_power = braking force
|
||||
float m_brake_force; // braking force
|
||||
float m_tire_grip; // grip of tires in longitudinal direction
|
||||
float m_max_steer_angle; // maximum steering angle
|
||||
float m_time_full_steer; // time for player karts to reach full steer angle
|
||||
@ -119,15 +116,11 @@ public:
|
||||
const char* getIconFile () const {return m_icon_file.c_str(); }
|
||||
const sgVec3* getColor () const {return &m_color; }
|
||||
float getMass () const {return m_mass; }
|
||||
float getAirResistance () const {return m_air_resistance; }
|
||||
float getRollResistance () const {return m_roll_resistance; }
|
||||
float getMaxPower () const {return m_engine_power; }
|
||||
float getTimeFullSteer () const {return m_time_full_steer; }
|
||||
float getBrakeFactor () const {return m_brake_factor; }
|
||||
float getBrakeForce () const {return m_brake_force; }
|
||||
float getWheelBase () const {return m_wheel_base; }
|
||||
float getHeightCOG () const {return m_height_cog; }
|
||||
float getTireGrip () const {return m_tire_grip; }
|
||||
float getMaxSteerAngle () const {return m_max_steer_angle; }
|
||||
float getCornerStiffF () const {return m_corn_f; }
|
||||
float getCornerStiffR () const {return m_corn_r; }
|
||||
|
@ -906,5 +906,8 @@ void DefaultRobot::find_curve()
|
||||
|
||||
m_curve_angle = normalize_angle(world->m_track->m_angle[i] - world->m_track->m_angle[m_track_sector]);
|
||||
m_inner_curve = m_curve_angle > 0.0 ? -1 : 1;
|
||||
m_curve_target_speed = sgSqrt(get_approx_radius(m_track_sector, i) * world->getGravity() * getTireGrip());
|
||||
// FIXME: 0.9 is the tire grip - but this was never used. For now this
|
||||
// 0.9 is left in place to reproduce the same results and AI behaviour,
|
||||
// but this function should be updated to bullet physics
|
||||
m_curve_target_speed = sgSqrt(get_approx_radius(m_track_sector, i) * world->getGravity() * 0.9f);
|
||||
}
|
||||
|
@ -64,20 +64,13 @@ void STKConfig::load(const std::string filename)
|
||||
|
||||
CHECK_NEG(m_mass, "mass" );
|
||||
CHECK_NEG(m_inertia, "m_inertia" );
|
||||
CHECK_NEG(m_tire_grip, "tire-grip" );
|
||||
CHECK_NEG(m_height_cog, "heightCOG" );
|
||||
CHECK_NEG(m_wheel_base, "wheel-base" );
|
||||
CHECK_NEG(m_engine_power, "engine-power" );
|
||||
CHECK_NEG(m_air_resistance, "air-resistance" );
|
||||
CHECK_NEG(m_max_steer_angle, "max-steer-angle" );
|
||||
CHECK_NEG(m_roll_resistance, "roll-resistance" );
|
||||
CHECK_NEG(m_brake_factor, "brake-factor" );
|
||||
CHECK_NEG(m_brake_force, "brake-force" );
|
||||
CHECK_NEG(m_jump_impulse, "jump-impulse" );
|
||||
|
||||
CHECK_NEG(m_air_res_reduce[1], "reduce-air-resistance-driver" );
|
||||
CHECK_NEG(m_air_res_reduce[2], "reduce-air-resistance-racer" );
|
||||
|
||||
CHECK_NEG(m_wheelie_max_speed_ratio, "wheelie-max-speed-ratio" );
|
||||
CHECK_NEG(m_wheelie_max_pitch, "wheelie-max-pitch" );
|
||||
CHECK_NEG(m_wheelie_pitch_rate, "wheelie-pitch-rate" );
|
||||
@ -111,6 +104,7 @@ void STKConfig::load(const std::string filename)
|
||||
CHECK_NEG(m_anvil_time, "anvil-time" );
|
||||
CHECK_NEG(m_zipper_time, "zipper-time" );
|
||||
CHECK_NEG(m_zipper_force, "zipper-force" );
|
||||
CHECK_NEG(m_zipper_speed_gain, "zipper-speed-gain" );
|
||||
CHECK_NEG(m_shortcut_segments, "shortcut-skipped-segments" );
|
||||
CHECK_NEG(m_suspension_rest, "suspension-rest" );
|
||||
CHECK_NEG(m_jump_velocity, "jump-velocity" );
|
||||
@ -126,27 +120,27 @@ void STKConfig::load(const std::string filename)
|
||||
*/
|
||||
void STKConfig::init_defaults()
|
||||
{
|
||||
m_wheel_base = m_height_cog = m_roll_resistance = m_mass =
|
||||
m_corn_r = m_air_resistance = m_tire_grip = m_max_steer_angle =
|
||||
m_corn_f = m_inertia = m_anvil_weight = m_parachute_friction =
|
||||
m_engine_power = m_jump_impulse = m_brake_factor =
|
||||
m_wheel_base = m_height_cog = m_mass =
|
||||
m_corn_r = m_max_steer_angle =
|
||||
m_corn_f = m_inertia = m_anvil_weight = m_parachute_friction =
|
||||
m_engine_power = m_jump_impulse = m_brake_factor =
|
||||
m_anvil_speed_factor = m_time_full_steer = m_wheelie_max_pitch =
|
||||
m_wheelie_max_speed_ratio = m_wheelie_pitch_rate = m_wheelie_restore_rate =
|
||||
m_wheelie_speed_boost = m_air_res_reduce[2] = m_air_res_reduce[1] =
|
||||
m_wheelie_speed_boost =
|
||||
m_parachute_time = m_bomb_time = m_bomb_time_increase= m_anvil_time =
|
||||
m_zipper_time = m_zipper_force = m_parachute_time_other = m_shortcut_segments =
|
||||
m_zipper_time = m_zipper_force = m_zipper_speed_gain =
|
||||
m_parachute_time_other = m_shortcut_segments =
|
||||
//bullet physics data
|
||||
m_suspension_stiffness = m_wheel_damping_relaxation = m_wheel_damping_compression =
|
||||
m_friction_slip = m_roll_influence = m_wheel_radius = m_wheel_width =
|
||||
m_wheelie_lean_recovery = m_wheelie_step = m_wheelie_balance_recovery =
|
||||
m_wheelie_power_boost = m_chassis_linear_damping = m_chassis_angular_damping =
|
||||
m_maximum_speed = m_brake_force = m_gravity_center_shift = m_suspension_rest =
|
||||
m_maximum_speed = m_gravity_center_shift = m_suspension_rest =
|
||||
m_max_speed_reverse_ratio = m_explosion_impulse = m_jump_velocity =
|
||||
m_explosion_impulse_objects = -99.9f;
|
||||
|
||||
m_max_karts = -100;
|
||||
m_grid_order = -100;
|
||||
m_air_res_reduce[0] = 1.0f;
|
||||
m_title_music = "";
|
||||
} // init_defaults
|
||||
|
||||
@ -161,8 +155,6 @@ void STKConfig::getAllData(const lisp::Lisp* lisp)
|
||||
lisp->get("anvil-speed-factor", m_anvil_speed_factor );
|
||||
lisp->get("parachute-friction", m_parachute_friction );
|
||||
lisp->get("jump-impulse", m_jump_impulse );
|
||||
lisp->get("reduce-air-resistance-racer", m_air_res_reduce[2] );
|
||||
lisp->get("reduce-air-resistance-driver", m_air_res_reduce[1] );
|
||||
lisp->get("parachute-time", m_parachute_time );
|
||||
lisp->get("parachute-time-other", m_parachute_time_other);
|
||||
lisp->get("bomb-time", m_bomb_time );
|
||||
@ -170,6 +162,7 @@ void STKConfig::getAllData(const lisp::Lisp* lisp)
|
||||
lisp->get("anvil-time", m_anvil_time );
|
||||
lisp->get("zipper-time", m_zipper_time );
|
||||
lisp->get("zipper-force", m_zipper_force );
|
||||
lisp->get("zipper-speed-gain", m_zipper_speed_gain );
|
||||
lisp->get("explosion-impulse", m_explosion_impulse );
|
||||
lisp->get("explosion-impulse-objects", m_explosion_impulse_objects);
|
||||
lisp->get("max-karts", m_max_karts );
|
||||
|
@ -30,7 +30,6 @@ public:
|
||||
float m_anvil_speed_factor; // To decrease speed once when attached
|
||||
float m_parachute_friction; // Increased air friction when parachute
|
||||
float m_jump_impulse; // percentage of gravity when jumping
|
||||
float m_air_res_reduce[3]; // air resistance reduction for the three levels
|
||||
float m_parachute_time; // time a parachute is active
|
||||
float m_parachute_time_other; // time a parachute attached to other karts is active
|
||||
float m_bomb_time; // time before a bomb explodes
|
||||
@ -38,6 +37,7 @@ public:
|
||||
float m_anvil_time; // time an anvil is active
|
||||
float m_zipper_time; // duration a zipper is active
|
||||
float m_zipper_force; // additional force added to the acceleration
|
||||
float m_zipper_speed_gain; // initial one time speed gain
|
||||
float m_shortcut_segments; // skipping more than this number of segments is
|
||||
// considered to be a shortcut
|
||||
float m_explosion_impulse; // impulse affecting each non-hit kart
|
||||
|
Loading…
x
Reference in New Issue
Block a user