SuperTuxKart
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | Protected Attributes | Private Attributes | List of all members
STKConfig Class Reference

Global STK configuration information. More...

#include <stk_config.hpp>

Inheritance diagram for STKConfig:
Inheritance graph
[legend]

Public Types

enum  { POWERUP_MODE_NEW, POWERUP_MODE_SAME, POWERUP_MODE_ONLY_IF_SAME }
 What to do if a kart already has a powerup when it hits a bonus box: More...
 

Public Member Functions

 STKConfig ()
 Constructor, which only initialises the object. More...
 
void init_defaults ()
 Init all values with invalid defaults, which are tested later. More...
 
void getAllData (const XMLNode *root)
 Extracts the actual information from a xml file. More...
 
void load (const std::string &filename)
 Loads the stk configuration file. More...
 
const std::string & getMainMenuPicture (int n)
 
const std::string & getBackgroundPicture (int n)
 
void initMusicFiles ()
 Init the music files after downloading assets.
 
void getAllScores (std::vector< int > *all_scores, int num_karts)
 Defines the points for each position for a race with a given number of karts. More...
 
const KartPropertiesgetDefaultKartProperties () const
 Returns the default kart properties for each kart. More...
 
const KartPropertiesgetKartProperties (const std::string &type)
 Returns the kart properties for a certain type of kart. More...
 
float ticks2Time (int ticks)
 Converts a tick value (in physics time step size) into seconds. More...
 
int time2Ticks (float t)
 Converts a time value into ticks (of physics time steps). More...
 
int getPhysicsFPS () const
 Returns the physics frame per seconds rate. More...
 

Public Attributes

enum STKConfig:: { ... }  m_same_powerup_mode
 What to do if a kart already has a powerup when it hits a bonus box: More...
 
float m_bomb_time
 Time before a bomb explodes. More...
 
float m_bomb_time_increase
 Time added to bomb timer when it's passed on. More...
 
int m_item_switch_ticks
 Time items will be switched. More...
 
int m_bubblegum_counter
 How many times bubble gums must be driven over before they disappear. More...
 
bool m_shield_restrict_weapons
 Wether weapon usage is punished. More...
 
float m_explosion_impulse_objects
 Impulse of explosion on moving objects, e.g. More...
 
int m_penalty_ticks
 Penalty time when starting too early. More...
 
float m_delay_finish_time
 Delay after a race finished before the results are displayed. More...
 
float m_music_credit_time
 Time the music credits are displayed. More...
 
int m_max_karts
 Maximum number of karts. More...
 
bool m_smooth_normals
 If normals for raycasts for wheels should be interpolated. More...
 
float m_no_explosive_items_timeout
 Prevent early explosive items before this world time. More...
 
int m_max_moveable_objects
 Maximum number of moveable objects in a track when networking is on. More...
 
float m_network_steering_reduction
 In case of a network race, remote karts will get their steering somewhat reduced each frame. More...
 
float m_smooth_angle_limit
 If the angle between a normal on a vertex and the normal of the triangle are more than this value, the physics will use the normal of the triangle in smoothing normal. More...
 
float m_default_track_friction
 Default friction for the track and any track/library object. More...
 
float m_default_moveable_friction
 Default friction to be used for any moveable, e.g. More...
 
int m_solver_iterations
 Number of solver iterations. More...
 
bool m_solver_split_impulse
 If position and velocity constraints are solved separately. More...
 
float m_solver_split_impulse_thresh
 Threshold when to use the split impulse approach. More...
 
int m_solver_set_flags
 Bit flags to modify the solver mode. More...
 
int m_solver_reset_flags
 
int m_max_skidmarks
 Maximum number of skid marks/kart. More...
 
float m_skid_fadeout_time
 Time till skidmarks fade away. More...
 
float m_near_ground
 Determines when a kart is not near ground anymore and the upright constraint is disabled to allow for more violent explosions. More...
 
int m_min_kart_version
 The minimum and maximum .kart file.
 
int m_max_kart_version
 version supported by this binary. More...
 
int m_min_track_version
 The minimum and maximum .track file.
 
int m_max_track_version
 version supported by this binary. More...
 
int m_min_server_version
 The minimum and maximum server.
 
int m_max_server_version
 version supported by this binary. More...
 
int m_max_display_news
 How often a news message is displayed before it is ignored. More...
 
bool m_disable_steer_while_unskid
 Disable steering if skidding is stopped. More...
 
bool m_camera_follow_skid
 If true the camera will stay behind the kart, potentially making it easier to see where the kart is going to after the skid. More...
 
float m_ai_acceleration
 Between 0 and 1, default being 1, can be used to give a handicap to AIs.
 
std::vector< float > m_leader_intervals
 Interval in follow the leader till last kart is reomved. More...
 
float m_leader_time_per_kart
 Additional time to each leader interval for each additional kart. More...
 
std::vector< int > m_switch_items
 How to switch items. More...
 
std::vector< int > m_score_increase
 The number of points a kart on position X has more than the next kart. More...
 
MusicInformationm_title_music
 Filename of the title music to play. More...
 
MusicInformationm_default_music
 Filename of the music that is played when the track's music was not found.
 
int m_replay_max_frames
 Maximum number of transform events of a replay. More...
 
float m_replay_dt
 Maximum time between consecutive saved tranform events. More...
 
float m_replay_delta_speed
 If the speed difference with the last transform event is larger than this, a new event is generated. More...
 
float m_replay_delta_steering
 A steering difference of more than that will trigger a new event to be generated. More...
 
float m_minimap_size
 The minimap size.
 
float m_minimap_ai_icon
 
float m_minimap_player_icon
 
float m_camera_fov [MAX_PLAYER_COUNT]
 The field of view for 1, 2, 3, 4 player split screen. More...
 
float m_cutscene_fov
 
unsigned m_max_skinning_bones
 
unsigned m_tc_quality
 
uint16_t m_server_discovery_port
 Client and server port use random ports if enabled in user config. More...
 
uint16_t m_client_port
 
uint16_t m_server_port
 
std::string m_donate_url
 
std::string m_password_reset_url
 
std::string m_assets_download_url
 
std::vector< std::string > m_normal_ttf
 Lists of TTF files used in STK. More...
 
std::vector< std::string > m_digit_ttf
 
std::string m_color_emoji_ttf
 
float m_snb_min_adjust_length
 Configurable values used in SmoothNetworkBody class. More...
 
float m_snb_max_adjust_length
 
float m_snb_min_adjust_speed
 
float m_snb_max_adjust_time
 
float m_snb_adjust_length_threshold
 
std::string m_server_api
 URL for the server used for the API multiplayer. More...
 
uint32_t m_server_api_version = 0
 Version of the server API to use.
 
std::string m_server_addons
 URL for the server used for the addons management. More...
 
std::string m_server_hardware_report
 URL for the server used for hardware reporting statistics.
 
bool m_allow_news_redirects = true
 If true we allow all the server urls to be redirected by the news.xml. More...
 
std::set< std::string > m_network_capabilities
 List of network capabilities to handle different servers with same version. More...
 

Static Public Attributes

static float UNDEFINED = -99.9f
 

Protected Attributes

KartPropertiesm_default_kart_properties
 Default kart properties. More...
 
std::map< std::string, KartProperties * > m_kart_properties
 

Private Attributes

bool m_has_been_loaded
 True if stk_config has been loaded. More...
 
int m_physics_fps
 Default FPS rate for physics. More...
 
std::string m_title_music_file
 
std::string m_default_music_file
 

Detailed Description

Global STK configuration information.

Parameters here can be tuned without recompilation, but the user shouldn't actually modify them. It also includes the list of default kart physics parameters which are used for each kart (but which can be overwritten for each kart, too).

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

What to do if a kart already has a powerup when it hits a bonus box:

  • NEW: give it a random new bonx box.
  • SAME: give it one more item of the type it currently has.
  • ONLY_IF_SAME: only give it one more item if the randomly chosen item has the same type as the currently held item.

Constructor & Destructor Documentation

◆ STKConfig()

STKConfig::STKConfig ( )

Constructor, which only initialises the object.

The actual work is done by calling load().

Member Function Documentation

◆ getAllData()

void STKConfig::getAllData ( const XMLNode root)

Extracts the actual information from a xml file.

Parameters
xmlPointer to the xml data structure.

◆ getAllScores()

void STKConfig::getAllScores ( std::vector< int > *  all_scores,
int  num_karts 
)

Defines the points for each position for a race with a given number of karts.

Parameters
all_scoresA vector which will be resized to take num_karts elements and which on return contains the number of points for each position.
num_kartsNumber of karts.

◆ getDefaultKartProperties()

const KartProperties& STKConfig::getDefaultKartProperties ( ) const
inline

Returns the default kart properties for each kart.

◆ getKartProperties()

const KartProperties& STKConfig::getKartProperties ( const std::string &  type)
inline

Returns the kart properties for a certain type of kart.

Exceptions
out_of_rangeif there is no data for 'type'.
Parameters
typeType of kart (e.g. heavy, medium, ...).

◆ getPhysicsFPS()

int STKConfig::getPhysicsFPS ( ) const
inline

Returns the physics frame per seconds rate.

◆ init_defaults()

void STKConfig::init_defaults ( )

Init all values with invalid defaults, which are tested later.

This guarantees that all parameters will indeed be initialised, and helps finding typos.

◆ load()

void STKConfig::load ( const std::string &  filename)

Loads the stk configuration file.

After loading it checks if all necessary values are actually defined, otherwise an error message is printed and STK is aborted. /param filename Name of the configuration file to load.

◆ ticks2Time()

float STKConfig::ticks2Time ( int  ticks)
inline

Converts a tick value (in physics time step size) into seconds.

◆ time2Ticks()

int STKConfig::time2Ticks ( float  t)
inline

Converts a time value into ticks (of physics time steps).

Member Data Documentation

◆ m_allow_news_redirects

bool STKConfig::m_allow_news_redirects = true

If true we allow all the server urls to be redirected by the news.xml.

◆ m_bomb_time

float STKConfig::m_bomb_time

Time before a bomb explodes.

◆ m_bomb_time_increase

float STKConfig::m_bomb_time_increase

Time added to bomb timer when it's passed on.

◆ m_bubblegum_counter

int STKConfig::m_bubblegum_counter

How many times bubble gums must be driven over before they disappear.

◆ m_camera_follow_skid

bool STKConfig::m_camera_follow_skid

If true the camera will stay behind the kart, potentially making it easier to see where the kart is going to after the skid.

◆ m_camera_fov

float STKConfig::m_camera_fov[MAX_PLAYER_COUNT]

The field of view for 1, 2, 3, 4 player split screen.

◆ m_default_kart_properties

KartProperties* STKConfig::m_default_kart_properties
protected

Default kart properties.

◆ m_default_moveable_friction

float STKConfig::m_default_moveable_friction

Default friction to be used for any moveable, e.g.

karts, balls.

◆ m_default_track_friction

float STKConfig::m_default_track_friction

Default friction for the track and any track/library object.

◆ m_delay_finish_time

float STKConfig::m_delay_finish_time

Delay after a race finished before the results are displayed.

◆ m_disable_steer_while_unskid

bool STKConfig::m_disable_steer_while_unskid

Disable steering if skidding is stopped.

This can help in making skidding more controllable (since otherwise when trying to steer while steering is reset to match the graphics it often results in the kart crashing).

◆ m_explosion_impulse_objects

float STKConfig::m_explosion_impulse_objects

Impulse of explosion on moving objects, e.g.

road cones, ...

◆ m_has_been_loaded

bool STKConfig::m_has_been_loaded
private

True if stk_config has been loaded.

This is necessary if the –stk-config command line parameter has been specified to avoid that stk loads the default configuration after already having loaded a user specified config file.

◆ m_item_switch_ticks

int STKConfig::m_item_switch_ticks

Time items will be switched.

◆ m_leader_intervals

std::vector<float> STKConfig::m_leader_intervals

Interval in follow the leader till last kart is reomved.

◆ m_leader_time_per_kart

float STKConfig::m_leader_time_per_kart

Additional time to each leader interval for each additional kart.

◆ m_max_display_news

int STKConfig::m_max_display_news

How often a news message is displayed before it is ignored.

◆ m_max_kart_version

int STKConfig::m_max_kart_version

version supported by this binary.

◆ m_max_karts

int STKConfig::m_max_karts

Maximum number of karts.

◆ m_max_moveable_objects

int STKConfig::m_max_moveable_objects

Maximum number of moveable objects in a track when networking is on.

◆ m_max_server_version

int STKConfig::m_max_server_version

version supported by this binary.

◆ m_max_skidmarks

int STKConfig::m_max_skidmarks

Maximum number of skid marks/kart.

◆ m_max_track_version

int STKConfig::m_max_track_version

version supported by this binary.

◆ m_music_credit_time

float STKConfig::m_music_credit_time

Time the music credits are displayed.

◆ m_near_ground

float STKConfig::m_near_ground

Determines when a kart is not near ground anymore and the upright constraint is disabled to allow for more violent explosions.

◆ m_network_capabilities

std::set<std::string> STKConfig::m_network_capabilities

List of network capabilities to handle different servers with same version.

◆ m_network_steering_reduction

float STKConfig::m_network_steering_reduction

In case of a network race, remote karts will get their steering somewhat reduced each frame.

This reduces stutter when a kart only does small steering adjustments.

◆ m_no_explosive_items_timeout

float STKConfig::m_no_explosive_items_timeout

Prevent early explosive items before this world time.

◆ m_normal_ttf

std::vector<std::string> STKConfig::m_normal_ttf

Lists of TTF files used in STK.

◆ m_penalty_ticks

int STKConfig::m_penalty_ticks

Penalty time when starting too early.

◆ m_physics_fps

int STKConfig::m_physics_fps
private

Default FPS rate for physics.

◆ m_replay_delta_speed

float STKConfig::m_replay_delta_speed

If the speed difference with the last transform event is larger than this, a new event is generated.

◆ m_replay_delta_steering

float STKConfig::m_replay_delta_steering

A steering difference of more than that will trigger a new event to be generated.

◆ m_replay_dt

float STKConfig::m_replay_dt

Maximum time between consecutive saved tranform events.

◆ m_replay_max_frames

int STKConfig::m_replay_max_frames

Maximum number of transform events of a replay.

◆ m_same_powerup_mode

enum { ... } STKConfig::m_same_powerup_mode

What to do if a kart already has a powerup when it hits a bonus box:

  • NEW: give it a random new bonx box.
  • SAME: give it one more item of the type it currently has.
  • ONLY_IF_SAME: only give it one more item if the randomly chosen item has the same type as the currently held item.

◆ m_score_increase

std::vector<int> STKConfig::m_score_increase

The number of points a kart on position X has more than the next kart.

From this the actual number of points for each position is computed.

◆ m_server_addons

std::string STKConfig::m_server_addons

URL for the server used for the addons management.

◆ m_server_api

std::string STKConfig::m_server_api

URL for the server used for the API multiplayer.

◆ m_server_discovery_port

uint16_t STKConfig::m_server_discovery_port

Client and server port use random ports if enabled in user config.

◆ m_shield_restrict_weapons

bool STKConfig::m_shield_restrict_weapons

Wether weapon usage is punished.

◆ m_skid_fadeout_time

float STKConfig::m_skid_fadeout_time

Time till skidmarks fade away.

◆ m_smooth_angle_limit

float STKConfig::m_smooth_angle_limit

If the angle between a normal on a vertex and the normal of the triangle are more than this value, the physics will use the normal of the triangle in smoothing normal.

◆ m_smooth_normals

bool STKConfig::m_smooth_normals

If normals for raycasts for wheels should be interpolated.

◆ m_snb_min_adjust_length

float STKConfig::m_snb_min_adjust_length

Configurable values used in SmoothNetworkBody class.

◆ m_solver_iterations

int STKConfig::m_solver_iterations

Number of solver iterations.

◆ m_solver_set_flags

int STKConfig::m_solver_set_flags

Bit flags to modify the solver mode.

Bits set in set_flags are added to the solver mode, bits set in reset_flags are removed.

◆ m_solver_split_impulse

bool STKConfig::m_solver_split_impulse

If position and velocity constraints are solved separately.

◆ m_solver_split_impulse_thresh

float STKConfig::m_solver_split_impulse_thresh

Threshold when to use the split impulse approach.

◆ m_switch_items

std::vector<int> STKConfig::m_switch_items

How to switch items.

◆ m_title_music

MusicInformation* STKConfig::m_title_music

Filename of the title music to play.


The documentation for this class was generated from the following files: