Assumes the changes in PR #5642 of the main repository, which targets the BalanceSTK2 branch.
Go into the game's source code folder, let's assume it's called ``stk-code".
This is the (recommended by me, but also seems to be the originally intended) set of guidelines and procedures to add new Kart Characteristics to the code, that must be accordingly declared in the ``data/kart_characteristics.xml" file. It is quite terse and a product of the time it was designed, so no one is going to be opposing complete overhauls, but it is still infinitely better than implementing the parser changes manually every time.
The parser for these is automatically generated by a set of two python scripts, allowing kart classes and handicap levels to override only the needed parameters from the base parameters, or modify them with mathematical operations. Quite convenient.
Inside the ``tools/" folder, there are two relevant Python scripts.
After running ``tools/update_characteristics.py", you must make sure that ``data/kart_characteristics.xml" matches the edits you made to ``tools/create_kart_properties.py" as well.
If a category is called "NitroHack" or "Nitrohack", in the ``kart_characteristics.xml" file it should be declared as the <nitrohack ... /> XML element (caps will be ignored). The getter for all its parameters will have the form ``getNitroHackXXX()" (caps will be preserved)
If a parameter is called "timeResetSteer", in the in the ``kart_characteristics.xml" file it should be declared as the <... time-reset-steer ... /> XML parameter (change in capitalization results in a dash). The getter for the parameter will have the form ``getXXXTimeResetSteer()" (caps will be preserved, AND the first letter will be forcibly capitalized)
After running ``tools/update_characteristics.py", the KartProperties class will have getters for all the new characteristics as per the description above. You must have a kart's KartProperties instance to access them, since different classes can override the default ones (the overrides are ALSO defined further below in the ``kart_characteristics.xml" file, in the form of classes and handicap levels).
The ``characteristics" variable format
Categories are at the start of the line, have no special characters, and are separated from the parameters by a colon ":".
Parameters are after the colon, separated by spaces, with type annotations in parantheses immediatly following the parameter name.
An example from the file:
The types supported are:
Go into the game's source code folder, let's assume it's called ``stk-code".
This is the (recommended by me, but also seems to be the originally intended) set of guidelines and procedures to add new Kart Characteristics to the code, that must be accordingly declared in the ``data/kart_characteristics.xml" file. It is quite terse and a product of the time it was designed, so no one is going to be opposing complete overhauls, but it is still infinitely better than implementing the parser changes manually every time.
The parser for these is automatically generated by a set of two python scripts, allowing kart classes and handicap levels to override only the needed parameters from the base parameters, or modify them with mathematical operations. Quite convenient.
Inside the ``tools/" folder, there are two relevant Python scripts.
- ``tools/create_kart_properties": Edit the "characteristics" global variable at the start of this file to add new characteristic categories and/or parameters for these categories. The format is described at the end of the post
- ``tools/update_characteristics.py": Run it with ``stk-code" as your working directory, with the command ``python3 tools/update_characteristics.py".
It will automatically edit these files inside ``src/karts": abstract_characteristic.cpp, abstract_characteristic.hpp, kart_properties.cpp, kart_properties.hpp, xml_characteristic.cppThe edits will be made to match the new contents of ``tools/create_kart_properties.py".
After running ``tools/update_characteristics.py", you must make sure that ``data/kart_characteristics.xml" matches the edits you made to ``tools/create_kart_properties.py" as well.
If a category is called "NitroHack" or "Nitrohack", in the ``kart_characteristics.xml" file it should be declared as the <nitrohack ... /> XML element (caps will be ignored). The getter for all its parameters will have the form ``getNitroHackXXX()" (caps will be preserved)
If a parameter is called "timeResetSteer", in the in the ``kart_characteristics.xml" file it should be declared as the <... time-reset-steer ... /> XML parameter (change in capitalization results in a dash). The getter for the parameter will have the form ``getXXXTimeResetSteer()" (caps will be preserved, AND the first letter will be forcibly capitalized)
After running ``tools/update_characteristics.py", the KartProperties class will have getters for all the new characteristics as per the description above. You must have a kart's KartProperties instance to access them, since different classes can override the default ones (the overrides are ALSO defined further below in the ``kart_characteristics.xml" file, in the form of classes and handicap levels).
The ``characteristics" variable format
Categories are at the start of the line, have no special characters, and are separated from the parameters by a colon ":".
Parameters are after the colon, separated by spaces, with type annotations in parantheses immediatly following the parameter name.
An example from the file:
Code:
Turn: radius(InterpolationArray), timeResetSteer, timeFullSteer(InterpolationArray), brakeMultiplier- float (don't annotate the parameter, e.g. ``param")
- list of floats (annotate the parameter like so ``param(std::vector<float>/floatVector)")
- bool (annotate the parameter like so ``param(bool)")
- InterpolationArray (annotate the parameter like so ``param(InterpolationArray)")
- STK Tyre Mod Edition (not regular STK 2.X) also has string, annotated like so:
Code:param(std::string/string)

