SuperTuxKart
Loading...
Searching...
No Matches
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.
 
void init_defaults ()
 Init all values with invalid defaults, which are tested later.
 
void getAllData (const XMLNode *root)
 Extracts the actual information from a xml file.
 
void load (const std::string &filename)
 Loads the stk configuration file.
 
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.
 
const KartPropertiesgetDefaultKartProperties () const
 Returns the default kart properties for each kart.
 
const KartPropertiesgetKartProperties (const std::string &type)
 Returns the kart properties for a certain type of kart.
 
float ticks2Time (int ticks)
 Converts a tick value (in physics time step size) into seconds.
 
int time2Ticks (float t)
 Converts a time value into ticks (of physics time steps).
 
int getPhysicsFPS () const
 Returns the physics frame per seconds rate.
 

Public Attributes

enum STKConfig:: { ... }  m_same_powerup_mode
 What to do if a kart already has a powerup when it hits a bonus box:
 
int m_bonusbox_item_return_ticks
 
int m_nitro_item_return_ticks
 Time until a bonus box collected by a kart returns.
 
int m_banana_item_return_ticks
 Time until a nitro collected by a kart returns.
 
int m_bubblegum_item_return_ticks
 Time until a banana collected by a kart return.
 
float m_bomb_time
 Time before a bomb explodes.
 
float m_bomb_time_increase
 Time added to bomb timer when it's passed on.
 
int m_item_switch_ticks
 Time items will be switched.
 
int m_bubblegum_counter
 How many times bubble gums must be driven over before they disappear.
 
bool m_shield_restrict_weapons
 Wether weapon usage is punished.
 
float m_explosion_impulse_objects
 Impulse of explosion on moving objects, e.g.
 
int m_penalty_ticks
 Penalty time when starting too early.
 
float m_delay_finish_time
 Delay after a race finished before the results are displayed.
 
float m_music_credit_time
 Time the music credits are displayed.
 
int m_max_karts
 Maximum number of karts.
 
bool m_smooth_normals
 If normals for raycasts for wheels should be interpolated.
 
float m_no_explosive_items_timeout
 Prevent early explosive items before this world time.
 
int m_max_moveable_objects
 Maximum number of moveable objects in a track when networking is on.
 
float m_network_steering_reduction
 In case of a network race, remote karts will get their steering somewhat reduced each frame.
 
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.
 
float m_default_track_friction
 Default friction for the track and any track/library object.
 
float m_default_moveable_friction
 Default friction to be used for any moveable, e.g.
 
int m_solver_iterations
 Number of solver iterations.
 
bool m_solver_split_impulse
 If position and velocity constraints are solved separately.
 
float m_solver_split_impulse_thresh
 Threshold when to use the split impulse approach.
 
int m_solver_set_flags
 Bit flags to modify the solver mode.
 
int m_solver_reset_flags
 
int m_max_skidmarks
 Maximum number of skid marks/kart.
 
float m_skid_fadeout_time
 Time till skidmarks fade away.
 
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.
 
int m_min_kart_version
 The minimum and maximum .kart file

 
int m_max_kart_version
 version supported by this binary.
 
int m_min_track_version
 The minimum and maximum .track file.
 
int m_max_track_version
 version supported by this binary.
 
int m_min_server_version
 The minimum and maximum server.
 
int m_max_server_version
 version supported by this binary.
 
int m_max_display_news
 How often a news message is displayed before it is ignored.
 
bool m_disable_steer_while_unskid
 Disable steering if skidding is stopped.
 
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.
 
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.
 
float m_leader_time_per_kart
 Additional time to each leader interval for each additional kart.
 
std::vector< int > m_switch_items
 How to switch items.
 
std::vector< int > m_score_increase
 The number of points a kart on position X has more than the next kart.
 
MusicInformationm_title_music
 Filename of the title music to play.
 
MusicInformationm_default_music
 Filename of the music that is played when the track's music was not found.
 
MusicInformationm_race_win_music
 Filename of the music to play when a player finishes in 1st place.
 
MusicInformationm_race_neutral_music
 Filename of the music to play when a player finishes anywhere in the top half of the total karts but 1st place, rounded down.
 
MusicInformationm_race_lose_music
 Filename of the music to play when a player finishes in the bottom half of the total karts.
 
MusicInformationm_gp_win_music
 Filename of the grand prix win music to play.
 
MusicInformationm_gp_lose_music
 Filename of the grand prix lose music to play.
 
MusicInformationm_unlock_music
 Filename of the feature unlock music to play.
 
int m_replay_max_frames
 Maximum number of transform events of a replay.
 
float m_replay_dt
 Maximum time between consecutive saved tranform events.
 
float m_replay_delta_speed
 If the speed difference with the last transform event is larger than this, a new event is generated.
 
float m_replay_delta_steering
 A steering difference of more than that will trigger a new event to be generated.
 
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.
 
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.
 
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::string m_stun_ipv4
 
std::string m_stun_ipv6
 
std::vector< std::string > m_normal_ttf
 Lists of TTF files used in STK.
 
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.
 
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.
 
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.
 
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.
 
std::set< std::string > m_network_capabilities
 List of network capabilities to handle different servers with same version.
 

Static Public Attributes

static float UNDEFINED = -99.9f
 Time until a bubble gum collected bý a kart returns.
 

Protected Attributes

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

Private Attributes

bool m_has_been_loaded
 True if stk_config has been loaded.
 
int m_physics_fps
 Default FPS rate for physics.
 
std::string m_title_music_file
 
std::string m_default_music_file
 
std::string m_race_win_music_file
 
std::string m_race_neutral_music_file
 
std::string m_race_lose_music_file
 
std::string m_gp_win_music_file
 
std::string m_gp_lose_music_file
 
std::string m_unlock_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.

◆ 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, ...).

◆ 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.

Member Data Documentation

◆ 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_default_moveable_friction

float STKConfig::m_default_moveable_friction

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

karts, balls.

◆ 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_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_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_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_penalty_ticks

int STKConfig::m_penalty_ticks

Penalty time when starting too early.


◆ m_replay_dt

float STKConfig::m_replay_dt

Maximum time between consecutive saved tranform events.


◆ 

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_skid_fadeout_time

float STKConfig::m_skid_fadeout_time

Time till skidmarks fade away.


◆ m_smooth_normals

bool STKConfig::m_smooth_normals

If normals for raycasts for wheels should be interpolated.


◆ 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_switch_items

std::vector<int> STKConfig::m_switch_items

How to switch items.



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