Change characteristics to characteristic and add player characteristics

This commit is contained in:
Flakebi 2015-07-10 00:36:50 +02:00
parent cb797c3145
commit a305b357a3
13 changed files with 526 additions and 492 deletions

View File

@ -1,292 +1,312 @@
<?xml version="1.0"?>
<kart-properties>
<!-- ********** Physics ********** -->
<characteristics>
<characteristic name="base">
<!-- ********** Physics ********** -->
<!-- Suspension
stiffness: kart's suspension stiffness.
rest: Length of suspension when at rest.
travel-cm: maximum movement of suspension - in cm!!
exp-string-response: dampen the suspension spring reaction
exponentially. See
http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?f=9&t=7369\&p=25236&hilit=vehicle#p25236
for details.
max-force: Maximum suspension force -->
<suspension stiffness="140" rest="0.3" travel-cm="29"
exp-spring-response="false" max-force="12000" />
<!-- Suspension
stiffness: kart's suspension stiffness.
rest: Length of suspension when at rest.
travel-cm: maximum movement of suspension - in cm!!
exp-string-response: dampen the suspension spring reaction
exponentially. See
http://bulletphysics.org/Bullet/phpBB3/viewtopic.php?f=9&t=7369\&p=25236&hilit=vehicle#p25236
for details.
max-force: Maximum suspension force -->
<suspension stiffness="140" rest="0.3" travel-cm="29"
exp-spring-response="false" max-force="12000" />
<!-- Values related to stability of the chassis: damping, and reduced
impact of roll.
downward-impulse-factor: A speed proportional impulse applied each
frame that pushes the vehicle onto the ground.
track-connection-accel: An artificial force that pulls a wheel to
the ground if its off ground. Reduces the affect if a kart loses
contact with the ground (i.e. it then can't steer or accelerate
anymore).
smooth-flying-impulse: apply a torque impulse to flying kart to keep
them parallel to the ground. -->
<stability roll-influence="0.3"
chassis-linear-damping="0.2"
chassis-angular-damping="0"
downward-impulse-factor="5"
track-connection-accel="2"
smooth-flying-impulse="25" />
<!-- Values related to stability of the chassis: damping, and reduced
impact of roll.
downward-impulse-factor: A speed proportional impulse applied each
frame that pushes the vehicle onto the ground.
track-connection-accel: An artificial force that pulls a wheel to
the ground if its off ground. Reduces the affect if a kart loses
contact with the ground (i.e. it then can't steer or accelerate
anymore).
smooth-flying-impulse: apply a torque impulse to flying kart to keep
them parallel to the ground. -->
<stability roll-influence="0.3"
chassis-linear-damping="0.2"
chassis-angular-damping="0"
downward-impulse-factor="5"
track-connection-accel="2"
smooth-flying-impulse="25" />
<!-- Turning
turn-radius: The turn radius of the kart at
a given speed. The actual steering angle is dependent on the
wheel base of the kart: radius = wheel_base/sin(steering_angle).
The values below define that at speed 0 the turn radius is 2, at
speed 10 the radius is 7.5 etc.
The actual turn radius is piece-wise linearly interpolated. This
allows for tighter turning at lower speeds, and also avoids that
the kart becomes too hard to control at high speed (speeds of higher
than 23 can only be reached with powerups).
time-full-steer: This is the amount of change in steering depending
on current steering. So if the steering is between 0 and 0.5,
the time-for-steering-change is 0.15. If the current steering is
between 0.5 and 1.0, the time-for-steering-change is 0.25.
The speed is used as dt/time-for-steering-change.
In short: steering at less than halfway is somewhat faster,
which should avoid oversteering (by pressing the key for too long),
but slower when you want to steer more. Overwall with the current
settings the expected time-to-full-steer is:
0.5 * 0.25 + 0.5 * 0.15 = 0.2 ... which is overall the same
time we had previously. -->
<turn turn-radius="0:2.0 10:7.5 25:15 45:30"
time-full-steer ="0:0.15 0.5:0.15 0.5:0.25 1.0:0.25"
time-reset-steer="0.1" />
<!-- Turning
turn-radius: The turn radius of the kart at
a given speed. The actual steering angle is dependent on the
wheel base of the kart: radius = wheel_base/sin(steering_angle).
The values below define that at speed 0 the turn radius is 2, at
speed 10 the radius is 7.5 etc.
The actual turn radius is piece-wise linearly interpolated. This
allows for tighter turning at lower speeds, and also avoids that
the kart becomes too hard to control at high speed (speeds of higher
than 23 can only be reached with powerups).
time-full-steer: This is the amount of change in steering depending
on current steering. So if the steering is between 0 and 0.5,
the time-for-steering-change is 0.15. If the current steering is
between 0.5 and 1.0, the time-for-steering-change is 0.25.
The speed is used as dt/time-for-steering-change.
In short: steering at less than halfway is somewhat faster,
which should avoid oversteering (by pressing the key for too long),
but slower when you want to steer more. Overwall with the current
settings the expected time-to-full-steer is:
0.5 * 0.25 + 0.5 * 0.15 = 0.2 ... which is overall the same
time we had previously. -->
<turn turn-radius="0:2.0 10:7.5 25:15 45:30"
time-full-steer ="0:0.15 0.5:0.15 0.5:0.25 1.0:0.25"
time-reset-steer="0.1" />
<!-- Speed and acceleration
power and max-speed (in m/s) have 3 values, one for low, medium, and hard.
brake-factor: Value used when braking.
brake-time-increase: The brake force is multiplied by
(1+brake_time*brake_time_increase - i.e. the longer the brake was
pressed, the harder the kart will brake.
max-speed-reverse-ratio is the percentage of max speed for reverse gear.
-->
<engine power="450 475 500 510" max-speed="17 21 23 25" brake-factor="11.0"
brake-time-increase="6" max-speed-reverse-ratio="0.3" />
<!-- Speed and acceleration
power and max-speed (in m/s) have 3 values, one for low, medium, and hard.
brake-factor: Value used when braking.
brake-time-increase: The brake force is multiplied by
(1+brake_time*brake_time_increase - i.e. the longer the brake was
pressed, the harder the kart will brake.
max-speed-reverse-ratio is the percentage of max speed for reverse gear.
-->
<engine power="450 475 500 510" max-speed="17 21 23 25" brake-factor="11.0"
brake-time-increase="6" max-speed-reverse-ratio="0.3" />
<!-- Simulated gears
switch-ratio defines at what ratio of the maximum
speed what gear is selected, e.g. 0.25 means that if the speed is
bigger or equal to 0.25 x maxSpeed then use gear 1, 0.5 means if
the speed is bigger or equal to 0.5 x maxSpeed then gear 2.
gear-power-increase contains the increase in max power (to simulate
different gears), e.g. 2.5 as first entry means: 2.5*maxPower in gear 1
| first | second | third | . -->
<gear switch-ratio="0.25 0.7 1.0" power-increase="2.2 1.7 1.3" />
<!-- Simulated gears
switch-ratio defines at what ratio of the maximum
speed what gear is selected, e.g. 0.25 means that if the speed is
bigger or equal to 0.25 x maxSpeed then use gear 1, 0.5 means if
the speed is bigger or equal to 0.5 x maxSpeed then gear 2.
gear-power-increase contains the increase in max power (to simulate
different gears), e.g. 2.5 as first entry means: 2.5*maxPower in gear 1
| first | second | third | . -->
<gear switch-ratio="0.25 0.7 1.0" power-increase="2.2 1.7 1.3" />
<!-- Mass of a kart -->
<mass value="225" />
<!-- Mass of a kart -->
<mass value="225" />
<!-- Wheels
damping-relaxation/compression: for bullet
damping parameters
Radius and width of wheel
front-right, front-left, rear-right and rear-left give the
position of the physics raycast wheels relative to the center of
gravity. Default is to use the corners of the chassis to attach
the wheels to. -->
<wheels damping-relaxation="35" damping-compression="5" radius="0.25">
<front-right position="0.38 0 0.6" />
<front-left position="-0.38 0 0.6" />
<rear-right position="0.38 0 -0.6" />
<rear-left position="-0.38 0 -0.6" />
</wheels>
<!-- Wheels
damping-relaxation/compression: for bullet
damping parameters
Radius and width of wheel
front-right, front-left, rear-right and rear-left give the
position of the physics raycast wheels relative to the center of
gravity. Default is to use the corners of the chassis to attach
the wheels to. -->
<wheels damping-relaxation="35" damping-compression="5" radius="0.25">
<front-right position="0.38 0 0.6" />
<front-left position="-0.38 0 0.6" />
<rear-right position="0.38 0 -0.6" />
<rear-left position="-0.38 0 -0.6" />
</wheels>
<!-- ********** Visuals ********** -->
<!-- ********** Visuals ********** -->
<!-- Skidding
increase: multiplicative increase of skidding factor in each frame.
decrease: multiplicative decrease of skidding factor in each frame.
max: maximum skidding factor = maximum increase of steering angle.
time-till-max: Time till maximum skidding is reached.
visual: Additional graphical rotation of kart. The graphical rotation
of the kart also determines the direction the kart is driving to
when skidding is stopped.
visual-time: How long it takes for the visual skid to reach maximum.
revert-visual-time: how long it takes when stopping a skid to revert
the visual skid and bring visuals and physics in sync again.
angular-velocity: Angular velocity to be used for the kart when skidding.
min-speed: Minimum speed a kart must have before it can skid. Must be
>0, otherwise the kart can skid at the start of the race.
time-till-bonus: How long a kart needs to skid in order to get a bonus.
bonus-force: A speedup applied to the kart whick skidded for a while.
bonus-time: How long the bonus-force is applied.
bonus-force: Additional engine force (this is used to offset the fact
that turning after skidding (e.g. to correct direction) often uses
up the skid bonus).
post-skid-rotate-factor: a factor to be used to determine how much
the chassis of a kart should rotate to match the graphical view.
A factor of 1 is identical, a smaller factor will rotate the kart
less (which might feel better).
physical-jump-time: Time for a physical jump at the beginning of a skid.
graphical-jump-time: Time for a graphics-only jump at the beginning
of a skid.
reduce-turn-min/max: The steering done by the controller (which is in
[-1,1]) is mapped to [reduce-turn-min, reduce-turn-max] when skidding
is active (for left turn, right turn will use [-max, -min]). The
effect is that while you skid (say left) you can adjust the direction
of the turn the kart is doing somewhat by steering to the left and right,
but you will always keep on doing a left turn, just more or less. -->
<skid increase="1.05" decrease="0.95" max="2.5" time-till-max="0.5"
visual="1.25" visual-time="0.7" revert-visual-time="0.7"
min-speed="10" time-till-bonus="1.0 3.0"
bonus-speed="4.5 6.5" bonus-time="3.0 4.0"
bonus-force="250 350"
physical-jump-time="0" graphical-jump-time="0.4"
post-skid-rotate-factor="1"
reduce-turn-min="0.2" reduce-turn-max="0.8" />
<!-- Skidding
increase: multiplicative increase of skidding factor in each frame.
decrease: multiplicative decrease of skidding factor in each frame.
max: maximum skidding factor = maximum increase of steering angle.
time-till-max: Time till maximum skidding is reached.
visual: Additional graphical rotation of kart. The graphical rotation
of the kart also determines the direction the kart is driving to
when skidding is stopped.
visual-time: How long it takes for the visual skid to reach maximum.
revert-visual-time: how long it takes when stopping a skid to revert
the visual skid and bring visuals and physics in sync again.
angular-velocity: Angular velocity to be used for the kart when skidding.
min-speed: Minimum speed a kart must have before it can skid. Must be
>0, otherwise the kart can skid at the start of the race.
time-till-bonus: How long a kart needs to skid in order to get a bonus.
bonus-force: A speedup applied to the kart whick skidded for a while.
bonus-time: How long the bonus-force is applied.
bonus-force: Additional engine force (this is used to offset the fact
that turning after skidding (e.g. to correct direction) often uses
up the skid bonus).
post-skid-rotate-factor: a factor to be used to determine how much
the chassis of a kart should rotate to match the graphical view.
A factor of 1 is identical, a smaller factor will rotate the kart
less (which might feel better).
physical-jump-time: Time for a physical jump at the beginning of a skid.
graphical-jump-time: Time for a graphics-only jump at the beginning
of a skid.
reduce-turn-min/max: The steering done by the controller (which is in
[-1,1]) is mapped to [reduce-turn-min, reduce-turn-max] when skidding
is active (for left turn, right turn will use [-max, -min]). The
effect is that while you skid (say left) you can adjust the direction
of the turn the kart is doing somewhat by steering to the left and right,
but you will always keep on doing a left turn, just more or less. -->
<skid increase="1.05" decrease="0.95" max="2.5" time-till-max="0.5"
visual="1.25" visual-time="0.7" revert-visual-time="0.7"
min-speed="10" time-till-bonus="1.0 3.0"
bonus-speed="4.5 6.5" bonus-time="3.0 4.0"
bonus-force="250 350"
physical-jump-time="0" graphical-jump-time="0.4"
post-skid-rotate-factor="1"
reduce-turn-min="0.2" reduce-turn-max="0.8" />
<!-- Camera
Distance between kart and camera.
forward-up-angle: Angle between camera and plane of kart (pitch)
when the camera is pointing forward
backward-up-angle: Angle between camera and plane of kart (pitch)
when the camera is pointing backwards. This is usually
larger than the forward-up-angle, since the kart itself
otherwise obstricts too much of the view. -->
<camera distance="1.0" forward-up-angle="15"
backward-up-angle="5" />
<!-- Camera
Distance between kart and camera.
forward-up-angle: Angle between camera and plane of kart (pitch)
when the camera is pointing forward
backward-up-angle: Angle between camera and plane of kart (pitch)
when the camera is pointing backwards. This is usually
larger than the forward-up-angle, since the kart itself
otherwise obstricts too much of the view. -->
<camera distance="1.0" forward-up-angle="15"
backward-up-angle="5" />
<!-- Jump animation
animation-time: only if the estimated time for a jump is larger
than this value will the jump animation being
shown. -->
<jump animation-time="0.5" />
<!-- Jump animation
animation-time: only if the estimated time for a jump is larger
than this value will the jump animation being
shown. -->
<jump animation-time="0.5" />
<!-- Leaning related parameters, i.e. slightly leaning the karts when
driving a fast curve.
max: maximum leaning (i.e. when steering as much as possible at highest
speed), in degrees.
speed: Speed with which the leaning changes (in degree/second). -->
<lean max="8.6" speed="5.0" />
<!-- Leaning related parameters, i.e. slightly leaning the karts when
driving a fast curve.
max: maximum leaning (i.e. when steering as much as possible at highest
speed), in degrees.
speed: Speed with which the leaning changes (in degree/second). -->
<lean max="8.6" speed="5.0" />
<!-- ********** Items ********** -->
<!-- ********** Items ********** -->
<!-- Anvil
weight: The additional weight an anvil adds to a kart.
speed-factor: The additional slowdown caused by the anvil.
duration: The time an anvil is active. -->
<anvil duration="2.0" weight="150" speed-factor="0.2" />
<!-- Anvil
weight: The additional weight an anvil adds to a kart.
speed-factor: The additional slowdown caused by the anvil.
duration: The time an anvil is active. -->
<anvil duration="2.0" weight="150" speed-factor="0.2" />
<!-- Parachute
friction: The friction increase when a parachute is attached.
duration: The time an attached parachute is active
duration-other: The time a parachute attached from other kart works
lbound-fraction: The lower bound fraction of speed when lost will
detach parachute. E.g. at nearly 0 speed, only 5% of speed
need to be lost.
ubound-fraction: The upper bound fraction of speed when lost will
detach parachute. E.g. at max-speed 30% of speed must be lost.
max-speed: A factor that decides the impact of rate of speed
(distance between bounds) -->
<parachute friction="2.0" duration="4.0" duration-other="8.0"
lbound-fraction="0.95" ubound-fraction="0.7" max-speed="23" />
<!-- Parachute
friction: The friction increase when a parachute is attached.
duration: The time an attached parachute is active
duration-other: The time a parachute attached from other kart works
lbound-fraction: The lower bound fraction of speed when lost will
detach parachute. E.g. at nearly 0 speed, only 5% of speed
need to be lost.
ubound-fraction: The upper bound fraction of speed when lost will
detach parachute. E.g. at max-speed 30% of speed must be lost.
max-speed: A factor that decides the impact of rate of speed
(distance between bounds) -->
<parachute friction="2.0" duration="4.0" duration-other="8.0"
lbound-fraction="0.95" ubound-fraction="0.7" max-speed="23" />
<!-- Bubblegum
duration: How long the bubblegum lasts.
speed-fraction: To what fraction of top-speed the speed is reduced.
torque: To rotate the kart somewhat.
fade-in-time: How quick the slowdown takes effect.
shield-duration: How long the bubblegum shield lasts -->
<bubblegum duration="1" speed-fraction="0.3" torque="500" fade-in-time="0.01"
shield-duration="10.0" />
<!-- Bubblegum
duration: How long the bubblegum lasts.
speed-fraction: To what fraction of top-speed the speed is reduced.
torque: To rotate the kart somewhat.
fade-in-time: How quick the slowdown takes effect.
shield-duration: How long the bubblegum shield lasts -->
<bubblegum duration="1" speed-fraction="0.3" torque="500" fade-in-time="0.01"
shield-duration="10.0" />
<!-- Zipper
duration: Time a zipper is active.
force: Additional zipper force.
speed-gain: One time additional speed.
max-speed-increase: Additional speed allowed on top of the
kart-specific maximum kart speed.
fade-out-time: determines how long it takes for a zipper
to fade out (after 'time'). -->
<zipper duration="3.5" force="250.0" speed-gain="4.5" max-speed-increase="15"
fade-out-time="1.0" />
<!-- Zipper
duration: Time a zipper is active.
force: Additional zipper force.
speed-gain: One time additional speed.
max-speed-increase: Additional speed allowed on top of the
kart-specific maximum kart speed.
fade-out-time: determines how long it takes for a zipper
to fade out (after 'time'). -->
<zipper duration="3.5" force="250.0" speed-gain="4.5" max-speed-increase="15"
fade-out-time="1.0" />
<!-- Swatter
duration: how long can the swatter be active.
distance: How close a kart or an item must be before it can be hit.
squash-duration: How long a kart will remain squashed.
squash-slowdown: percentage of max speed that a kart is
restricted to. -->
<swatter duration="10" distance="3" squash-duration="5"
squash-slowdown="0.5" />
<!-- Swatter
duration: how long can the swatter be active.
distance: How close a kart or an item must be before it can be hit.
squash-duration: How long a kart will remain squashed.
squash-slowdown: percentage of max speed that a kart is
restricted to. -->
<swatter duration="10" distance="3" squash-duration="5"
squash-slowdown="0.5" />
<!-- Plunger and rubber band handling
max-length: Te maximum length of rubber band before it snaps.
force: The force a plunger/rubber band applies to the kart(s).
duration: The duration a rubber band acts.
in-face-time determines how long it takes before a plunger
in your face is removed. -->
<plunger band-max-length="50" band-force="1500" band-duration="1"
band-speed-increase="7" band-fade-out-time="3"
in-face-time="3 4 4.5 4.5" />
<!-- Plunger and rubber band handling
max-length: Te maximum length of rubber band before it snaps.
force: The force a plunger/rubber band applies to the kart(s).
duration: The duration a rubber band acts.
in-face-time determines how long it takes before a plunger
in your face is removed. -->
<plunger band-max-length="50" band-force="1500" band-duration="1"
band-speed-increase="7" band-fade-out-time="3"
in-face-time="3 4 4.5 4.5" />
<!-- ********** Miscellaneous ********** -->
<!-- ********** Miscellaneous ********** -->
<!-- Startup
If a kart starts within the specified time after 'go',
it receives the corresponding bonus from 'boost'. Those
fields must have the same size, and must be sorted by
increasing times. -->
<startup time="0.3 0.5"
boost="6 3" />
<!-- Startup
If a kart starts within the specified time after 'go',
it receives the corresponding bonus from 'boost'. Those
fields must have the same size, and must be sorted by
increasing times. -->
<startup time="0.3 0.5"
boost="6 3" />
<!-- Rescue
duration: How long it takes the kart to be raised.
height: how height the kart will be raised before it is
dropped back onto the track.
vert rescue offset: used to raise karts a bit higher before
releasing them on the ground after a rescue. Used to avoid
resetting karts into the track. Not sure if this is still
necessary. -->
<rescue vert-offset="0.0" duration="1.2" height="2" />
<!-- Rescue
duration: How long it takes the kart to be raised.
height: how height the kart will be raised before it is
dropped back onto the track.
vert rescue offset: used to raise karts a bit higher before
releasing them on the ground after a rescue. Used to avoid
resetting karts into the track. Not sure if this is still
necessary. -->
<rescue vert-offset="0.0" duration="1.2" height="2" />
<!-- Explosion
duration: how long it takes before the kart can drive again (this
determines how height the kart is being thrown).
invulnerability-time: how long a kart will be invulnerable
after being hit by an explosion.
radius: Kart closer to this value will be affected by
an explosion as well. -->
<explosion duration="2" radius="5"
invulnerability-time="6" />
<!-- Explosion
duration: how long it takes before the kart can drive again (this
determines how height the kart is being thrown).
invulnerability-time: how long a kart will be invulnerable
after being hit by an explosion.
radius: Kart closer to this value will be affected by
an explosion as well. -->
<explosion duration="2" radius="5"
invulnerability-time="6" />
<!-- Nitro
engine-force: additional engine power
consumption: nitro consumption - heavier characters can be set
to need more nitro than lighter character.
small-container: how much energy a small container gives.
big-container: how much energy a big container gives.
max-speed-increase: How much the speed of a kart might exceed
its maximum speed (in m/s).
duration: How long the increased speed will be valid after
the kart stops using nitro (and the fade-out-time starts).
fade-out-time: Duration during which the increased maximum
speed due to nitro fades out.
max: How much nitro a kart can store. -->
<nitro engine-force="500" consumption="1" small-container="1" big-container="3"
max-speed-increase="5" duration="1" fade-out-time="2" max="20" />
<!-- Nitro
engine-force: additional engine power
consumption: nitro consumption - heavier characters can be set
to need more nitro than lighter character.
small-container: how much energy a small container gives.
big-container: how much energy a big container gives.
max-speed-increase: How much the speed of a kart might exceed
its maximum speed (in m/s).
duration: How long the increased speed will be valid after
the kart stops using nitro (and the fade-out-time starts).
fade-out-time: Duration during which the increased maximum
speed due to nitro fades out.
max: How much nitro a kart can store. -->
<nitro engine-force="500" consumption="1" small-container="1" big-container="3"
max-speed-increase="5" duration="1" fade-out-time="2" max="20" />
<!-- Slipstream
length: How far behind a kart slipstream works
width: how wide slipstream works furthest away from the kart.
collect-time: How many seconds of sstream give maximum benefit
use-time: How long the benefit will last.
add-power: Additional power due to sstreaming. 1 = +100%
min-speed: Minimum speed necessary for slipstream to take effect.
max-speed-increase: How much the speed of the kart might exceed
its normal maximum speed.
duration: How long the higher speed lasts after slipstream stopped
working.
fade-out-time: How long the slip stream speed increase will
gradually be reduced. -->
<slipstream length="10" width="2" collect-time="2" use-time="5"
add-power="3" min-speed="10" max-speed-increase="5"
duration="1" fade-out-time="2" />
</kart-properties>
<!-- Slipstream
length: How far behind a kart slipstream works
width: how wide slipstream works furthest away from the kart.
collect-time: How many seconds of sstream give maximum benefit
use-time: How long the benefit will last.
add-power: Additional power due to sstreaming. 1 = +100%
min-speed: Minimum speed necessary for slipstream to take effect.
max-speed-increase: How much the speed of the kart might exceed
its normal maximum speed.
duration: How long the higher speed lasts after slipstream stopped
working.
fade-out-time: How long the slip stream speed increase will
gradually be reduced. -->
<slipstream length="10" width="2" collect-time="2" use-time="5"
add-power="3" min-speed="10" max-speed-increase="5"
duration="1" fade-out-time="2" />
</characteristic>
<!-- Per-player settings/handicaps (or boosts) -->
<player-characteristics>
<characteristic name="normal" />
<characteristic name="handicap">
<engine brake-factor="*0.8" brake-time-increase="*0.85" max-speed-reverse-ratio="*0.8" />
<bubblegum duration="*1.5" speed-fraction="*1.5" torque="*1.5" />
<zipper duration="*0.8" force="*0.8" speed-gain="*0.8" max-speed-increase="*0.8" />
<swatter duration="*0.8" squash-duration="*1.5" squash-slowdown="*1.8" />
<plunger band-max-length="*0.8" band-speed-increase="*0.8" in-face-time="*1.3" />
<startup time="*0.8 0.8" boost="*0.8 0.8" />
<rescue duration="*1.5" />
<explosion duration="*1.3" invulnerability-time="*0.7" />
<nitro engine-force="*0.8" consumption="*1.1" max-speed-increase="*0.9" max="*0.8" />
<slipstream length="*0.8" width="*0.8" collect-time="*1.5" use-time="*0.8"
add-power="*0.8" min-speed="*0.8" max-speed-increase="*0.9" duration="*0.8" />
</characteristic>
</player-characteristics>
</characteristics>

View File

@ -36,8 +36,11 @@ class InterpolationArray;
*
* The documentation of these properties can be found in
* the kart_characteristics.xml file.
* Large parts of this file are generated by tools/create_kart_properties.py.
* Please don't change the generated code here, instead change the script,
* regenerate the code and overwrite the whole generated part with the result.
*/
class AbstractCharacteristics
class AbstractCharacteristic
{
public:
union Value
@ -200,7 +203,7 @@ private:
//SkiddingProperties *m_skidding;
public:
AbstractCharacteristics();
AbstractCharacteristic();
virtual const SkiddingProperties* getSkiddingProperties() const;

View File

@ -33,6 +33,7 @@ namespace irr
}
}
class AbstractCharacteristics;
class AbstractKartAnimation;
class Attachment;
class btKart;
@ -74,6 +75,8 @@ protected:
/** The per-player difficulty. */
const PlayerDifficulty *m_difficulty;
/** The combined properties of the kart and the player. */
const AbstractCharacteristics *m_characteristics;
/** This stores a copy of the kart model. It has to be a copy
* since otherwise incosistencies can happen if the same kart

View File

@ -16,18 +16,18 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "karts/cached_characteristics.hpp"
#include "karts/cached_characteristic.hpp"
#include "utils/interpolation_array.hpp"
CachedCharacteristics::CachedCharacteristics(const AbstractCharacteristics *origin) :
CachedCharacteristic::CachedCharacteristic(const AbstractCharacteristic *origin) :
m_values(CHARACTERISTIC_COUNT),
m_origin(origin)
{
updateSource();
}
CachedCharacteristics::~CachedCharacteristics()
CachedCharacteristic::~CachedCharacteristic()
{
// Delete all not-null values
for (int i = 0; i < CHARACTERISTIC_COUNT; i++)
@ -52,7 +52,7 @@ CachedCharacteristics::~CachedCharacteristics()
}
}
void CachedCharacteristics::updateSource()
void CachedCharacteristic::updateSource()
{
for (int i = 0; i < CHARACTERISTIC_COUNT; i++)
{
@ -142,12 +142,12 @@ void CachedCharacteristics::updateSource()
}
}
const SkiddingProperties* CachedCharacteristics::getSkiddingProperties() const
const SkiddingProperties* CachedCharacteristic::getSkiddingProperties() const
{
return m_origin->getSkiddingProperties();
}
void CachedCharacteristics::process(CharacteristicType type, Value value, bool *is_set) const
void CachedCharacteristic::process(CharacteristicType type, Value value, bool *is_set) const
{
void *v = m_values[type].content;
if (v)

View File

@ -19,9 +19,9 @@
#ifndef HEADER_CACHED_CHARACTERISTICS_HPP
#define HEADER_CACHED_CHARACTERISTICS_HPP
#include "karts/abstract_characteristics.hpp"
#include "karts/abstract_characteristic.hpp"
class CachedCharacteristics : public AbstractCharacteristics
class CachedCharacteristic : public AbstractCharacteristic
{
private:
/** Used to store a value. */
@ -37,12 +37,12 @@ private:
std::vector<SaveValue> m_values;
/** The characteristics that hold the original values. */
const AbstractCharacteristics *m_origin;
const AbstractCharacteristic *m_origin;
public:
CachedCharacteristics(const AbstractCharacteristics *origin);
CachedCharacteristics(const CachedCharacteristics &characteristics) = delete;
virtual ~CachedCharacteristics();
CachedCharacteristic(const AbstractCharacteristic *origin);
CachedCharacteristic(const CachedCharacteristic &characteristics) = delete;
virtual ~CachedCharacteristic();
/** Fetches all cached values from the original source. */
void updateSource();

View File

@ -16,16 +16,16 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "karts/combined_characteristics.hpp"
#include "karts/combined_characteristic.hpp"
void CombinedCharacteristics::addCharacteristic(const AbstractCharacteristics *characteristic)
void CombinedCharacteristic::addCharacteristic(const AbstractCharacteristic *characteristic)
{
m_childs.push_back(characteristic);
}
const SkiddingProperties* CombinedCharacteristics::getSkiddingProperties() const
const SkiddingProperties* CombinedCharacteristic::getSkiddingProperties() const
{
for (const AbstractCharacteristics *characteristic : m_childs)
for (const AbstractCharacteristic *characteristic : m_childs)
{
const SkiddingProperties *skid = characteristic->getSkiddingProperties();
if (skid)
@ -34,9 +34,9 @@ const SkiddingProperties* CombinedCharacteristics::getSkiddingProperties() const
return nullptr;
}
void CombinedCharacteristics::process(CharacteristicType type, Value value, bool *is_set) const
void CombinedCharacteristic::process(CharacteristicType type, Value value, bool *is_set) const
{
for (const AbstractCharacteristics *characteristic : m_childs)
for (const AbstractCharacteristic *characteristic : m_childs)
characteristic->process(type, value, is_set);
}

View File

@ -19,15 +19,15 @@
#ifndef HEADER_COMBINDED_CHARACTERISTICS_HPP
#define HEADER_COMBINDED_CHARACTERISTICS_HPP
#include "karts/abstract_characteristics.hpp"
#include "karts/abstract_characteristic.hpp"
class CombinedCharacteristics : public AbstractCharacteristics
class CombinedCharacteristic : public AbstractCharacteristic
{
private:
std::vector<const AbstractCharacteristics*> m_childs;
std::vector<const AbstractCharacteristic*> m_childs;
public:
void addCharacteristic(const AbstractCharacteristics *characteristic);
void addCharacteristic(const AbstractCharacteristic *characteristic);
virtual const SkiddingProperties* getSkiddingProperties() const;
virtual void process(CharacteristicType type, Value value, bool *is_set) const;

View File

@ -27,6 +27,7 @@
#include "graphics/irr_driver.hpp"
#include "guiengine/engine.hpp"
#include "io/file_manager.hpp"
#include "karts/abstract_characteristic.hpp"
#include "karts/kart_properties.hpp"
#include "utils/log.hpp"
#include "utils/string_utils.hpp"

View File

@ -22,12 +22,14 @@
#include "utils/ptr_vector.hpp"
#include <map>
#include <memory>
#include "network/remote_kart_info.hpp"
#include "utils/no_copy.hpp"
#define ALL_KART_GROUPS_ID "all"
class AbstractCharacteristic;
class KartProperties;
/**
@ -58,6 +60,11 @@ private:
* all clients or not. */
std::vector<bool> m_kart_available;
std::unique_ptr<AbstractCharacteristic> m_base_characteristic;
std::vector<std::unique_ptr<AbstractCharacteristic> > m_kart_type_characteristics;
std::vector<std::unique_ptr<AbstractCharacteristic> > m_kart_characteristics;
std::vector<std::unique_ptr<AbstractCharacteristic> > m_player_characteristics;
protected:
typedef PtrVector<KartProperties> KartPropertiesVector;

View File

@ -24,7 +24,7 @@
#include "io/xml_node.hpp"
XmlCharacteristics::XmlCharacteristics(const XMLNode *node) :
XmlCharacteristic::XmlCharacteristic(const XMLNode *node) :
m_values(CHARACTERISTIC_COUNT),
m_skidding(nullptr)
{
@ -32,12 +32,12 @@ XmlCharacteristics::XmlCharacteristics(const XMLNode *node) :
load(node);
}
const SkiddingProperties* XmlCharacteristics::getSkiddingProperties() const
const SkiddingProperties* XmlCharacteristic::getSkiddingProperties() const
{
return m_skidding;
}
void XmlCharacteristics::process(CharacteristicType type, Value value, bool *is_set) const
void XmlCharacteristic::process(CharacteristicType type, Value value, bool *is_set) const
{
switch (getType(type))
{
@ -52,7 +52,7 @@ void XmlCharacteristics::process(CharacteristicType type, Value value, bool *is_
{
if (processors.size() != value.fv->size())
{
Log::error("XmlCharacteristics::process",
Log::error("XmlCharacteristic::process",
"FloatVectors have different sizes for %s",
getName(type).c_str());
break;
@ -74,7 +74,7 @@ void XmlCharacteristics::process(CharacteristicType type, Value value, bool *is_
if (!*is_set)
{
Log::error("XmlCharacteristics::process", "Can't process %s",
Log::error("XmlCharacteristic::process", "Can't process %s",
getName(type).c_str());
value.fv->clear();
break;
@ -91,7 +91,7 @@ void XmlCharacteristics::process(CharacteristicType type, Value value, bool *is_
{
if (processors.size() != value.fv->size())
{
Log::error("XmlCharacteristics::process",
Log::error("XmlCharacteristic::process",
"InterpolationArrays have different sizes for %s",
getName(type).c_str());
break;
@ -103,13 +103,13 @@ void XmlCharacteristics::process(CharacteristicType type, Value value, bool *is_
{
std::vector<std::string> pair = StringUtils::split(*it, ':');
if (pair.size() != 2)
Log::error("XmlCharacteristics::process",
Log::error("XmlCharacteristic::process",
"Can't process %s: Wrong format", getName(type).c_str());
else
{
float x;
if (!StringUtils::fromString(pair[0], x))
Log::error("XmlCharacteristics::process",
Log::error("XmlCharacteristic::process",
"Can't process %s: Not a float", getName(type).c_str());
else
{
@ -126,7 +126,7 @@ void XmlCharacteristics::process(CharacteristicType type, Value value, bool *is_
}
}
if (!found)
Log::error("XmlCharacteristics::process",
Log::error("XmlCharacteristic::process",
"Can't find the %f in %s", x,
getName(type).c_str());
}
@ -141,13 +141,13 @@ void XmlCharacteristics::process(CharacteristicType type, Value value, bool *is_
{
std::vector<std::string> pair = StringUtils::split(*it,':');
if (pair.size() != 2)
Log::error("XmlCharacteristics::process",
Log::error("XmlCharacteristic::process",
"Can't process %s: Wrong format", getName(type).c_str());
else
{
float x;
if (!StringUtils::fromString(pair[0], x))
Log::error("XmlCharacteristics::process",
Log::error("XmlCharacteristic::process",
"Can't process %s: Not a float", getName(type).c_str());
else
{
@ -156,7 +156,7 @@ void XmlCharacteristics::process(CharacteristicType type, Value value, bool *is_
processFloat(pair[1], &val, is_set);
if (!*is_set)
{
Log::error("XmlCharacteristics::process", "Can't process %s",
Log::error("XmlCharacteristic::process", "Can't process %s",
getName(type).c_str());
value.ia->clear();
break;
@ -171,7 +171,7 @@ void XmlCharacteristics::process(CharacteristicType type, Value value, bool *is_
}
}
void XmlCharacteristics::processFloat(const std::string &processor, float *value, bool *is_set)
void XmlCharacteristic::processFloat(const std::string &processor, float *value, bool *is_set)
{
// Split the string by operators
static const std::string operators = "*/+-";
@ -189,7 +189,7 @@ void XmlCharacteristics::processFloat(const std::string &processor, float *value
if (parts.empty())
{
Log::error("XmlCharacteristics::processFloat", "no content to process");
Log::error("XmlCharacteristic::processFloat", "no content to process");
return;
}
@ -201,7 +201,7 @@ void XmlCharacteristics::processFloat(const std::string &processor, float *value
{
if (!*is_set)
{
Log::error("XmlCharacteristics::processFloat", "x is unknown");
Log::error("XmlCharacteristic::processFloat", "x is unknown");
return;
}
else
@ -217,7 +217,7 @@ void XmlCharacteristics::processFloat(const std::string &processor, float *value
val = x;
else if (!StringUtils::fromString(parts[index], val))
{
Log::fatal("XmlCharacteristics::processFloat",
Log::fatal("XmlCharacteristic::processFloat",
"Can't process %s: Not a float", parts[index].c_str());
return;
}
@ -230,13 +230,13 @@ void XmlCharacteristics::processFloat(const std::string &processor, float *value
else if (operations[index - 1] == "-")
*value -= val;
else
Log::fatal("XmlCharacteristics::processFloat",
Log::fatal("XmlCharacteristic::processFloat",
"Unknown operator (%s)", operations[index - 1].c_str());
}
*is_set = true;
}
void XmlCharacteristics::load(const XMLNode *node)
void XmlCharacteristic::load(const XMLNode *node)
{
// Script-generated content
if (const XMLNode *sub_node = node->getNode("Suspension"))

View File

@ -19,13 +19,13 @@
#ifndef HEADER_XML_CHARACTERISTICS_HPP
#define HEADER_XML_CHARACTERISTICS_HPP
#include "karts/abstract_characteristics.hpp"
#include "karts/abstract_characteristic.hpp"
#include <string>
class XMLNode;
class XmlCharacteristics : public AbstractCharacteristics
class XmlCharacteristic : public AbstractCharacteristic
{
private:
/** The computation that was read from an xml file */
@ -33,7 +33,7 @@ private:
SkiddingProperties *m_skidding;
public:
XmlCharacteristics(const XMLNode *node = nullptr);
XmlCharacteristic(const XMLNode *node = nullptr);
virtual const SkiddingProperties* getSkiddingProperties() const;
virtual void process(CharacteristicType type, Value value, bool *is_set) const;

View File

@ -172,13 +172,13 @@ def main():
typeC = m.typeC
result = "result"
print("""{3} AbstractCharacteristics::get{1}() const
print("""{3} AbstractCharacteristic::get{1}() const
{{
{0} result;
bool is_set = false;
process({2}, &result, &is_set);
if (!is_set)
Log::fatal("AbstractCharacteristics", "Can't get characteristic %s", getName({2}).c_str());
Log::fatal("AbstractCharacteristic", "Can't get characteristic %s", getName({2}).c_str());
return {4};
}}
""".format(m.typeC, nameTitle, nameUnderscore.upper(), typeC, result))