New kart tutorial

This page is outdated. Please see New_kart_tutorial_2 for the latest tutorial.


France.png Version française

This page explains how to make a kart for STK using Blender. It assumes you know the basics of modeling, UV texturing and skeletal animations in Blender, and concentrates on aspects that are specific to SuperTuxKart. It is based upon the previous tutorials Making kart tutorial and Making karts for Irrlicht, the Guidelines for making karts and characters, and the general Style Guidelines which you can also consult for more details. See the Kart resources index page for other resources about karts.


See the Kart export checklist for a short list that sums up every important point to know in this page, and make sure everything is OK before exporting a kart with STK's kart exporter.

See the Blender resources page for a list of tutorial links to learn how to use Blender (2.4).


Important note : Before any work, it is essential to know that any STK content (and eventual content used to make it) must strictly be of an acceptable license (see Licensing).


Contents

Character and kart design

All of STK's characters are open-source mascots, therefore if you want to add a kart to STK you must satisfy this constraint. You can find a list of the most known open-source mascots here (try to find all of STK's characters :p). Be careful that you do not choose one which is already involved in some work in progress, or present in the add-on pack of STK. You can check it out on the forum, and the addons website.

Once you have chosen your mascot, you need a kart design for it. If you wish it to be included in the official game package, you must design it so it fits well with the game atmosphere and is credible. See Style Guidelines and Guidelines for making karts and characters to know more about STK's design requirements. Remember that the most seen part of the karts by players is the back so this is a part that should be polished.

Modeling

Emule model.jpg


Mesh & vertex count

The model of a kart for STK should not have more than 3000 triangles, eg. 2000 for the vehicle, wheels included, and 1000 for the character (note that this limitation is not respected by every current STK kart, as some need to be improved). It makes 1500 faces if every face is a quad, ideally this would be around 1300. You can consult some old statistics about models here. In the future, STK will support LOD, so a low poly model (500 to 900 faces) would also be very appreciated.

To know roughly the number of triangles of your mesh, you can temporarily convert your faces to triangles with Ctrl+T on Blender, or view the exported kart (see #Exporting karts to learn how to export a kart) in the selection screen of STK, with the "Show FPS" option checked -- wait a little to have a "Ktris" value.

During the modeling phase, remember that the kart is made to be seen from medium and far distances, but not very close distances, so detailing it a lot may be useless as some details would only be visible in rare and precise situations. Also, it is way harder (and boring) trying to decrease the poly count of an existing high poly model than designing and modeling a low poly kart from the beginning, so it is worth keeping the poly number in mind.

Before the kart export, mesh modifiers need to be applied, as they won't be taken in consideration in the game.

Dimensions

STK's karts dimensions are approximately between 0.7x0.4 and 0.9x0.5 openGL units, so you may first choose a same ranged dimension. Then, ingame tests will be required to adjust it. Note that currently, kart physics depends on the dimensions of the models, but this will change when karts will have individual physics attributes.

Transformations

Before being exported, the kart must be located as if the Y-axis was the road, and have a 0 X and Z translation (this last part may not be required, but this is cleaner like this ;). Also, when you hit Numpad 1 in Blender, you should see the back of the kart. The final model's rotation must be 0, and its scale 1 in object mode.

Objects in Blender scene

Ideally, the kart has its own mesh, the character another independent mesh, and each wheel another additional mesh object. The wheels must be given the game-logic property 'type="wheel"'. The old way to declare them is also possible : objects name has to be "FrontWheel.L" to "RearWheel.R".

Every object in your blender scene will be exported by STK's kart exporter except :

Texturing

TuxTexture.png


At this time, STK supports UV texturing (with one texture only by face) and material color. All other options set in blender's material panel will be ignored.

To meet OpenGL requirements, the UV textures files must have power of two dimensions (e.g. 128x256, or 512x512). Note that here again, as this model purpose is a real-time use, textures size should not be unnecessarily too large. In general, 512x512 textures are large enough, and increasing the resolution does not change a lot the final ingame render.

The JPEG format is one of the most efficient in terms of compression, so although some existing textures are in png, the jpg is the best format for the game (if you use jpeg, please keep the original lossless file!). If you need a part of your model to be transparent, or have specific properties, you can assign it a specific texture file (a tiny image is OK for a single color) or a material color, then create a custom materials.xml file -- that you will have to include later in the kart game folder with models and textures. Note that the material.xml file is used by STK, but not by Blender.

Animating

STK's karts can be animated. The current karts animations in STK are :


New animations and markers will surely be added in future versions of STK, they might be :

You can also make them, but they won't be used for the moment (and might be not used at all).


Meshes must be animated with skeletal animations, using blender's armatures. Note that STK will only be able to play animations if the armature is the parent object of the animated mesh in the Blender scene (you might have to remove the "armature" modifier if you used it, otherwise transformations can be applied twice to the mesh). STK supports multiples animated objects (one armature by distinct animated mesh) since the 0.7.1 version.

Also, make sure every bone of your armature has a 0 roll, otherwise ingame animation will look pretty weird.

Icon & shadow

Kart icons STK 071.png


The last things an STK kart needs are an icon and a shadow image.

The icon should be a 64x64 png image, and should have the same design than the other STK karts icons (most of them are from WorMux, adapted by yeKcim (FR)). A smaller version (for instance 32x32) may also be specified to be used in the in-game minimap (if you don't provide the smaller version, the 64x64 one is resized down, which may look less good than an icon crafted to be smaller).

The shadow image is a png image which is applied on the ground under the karts. To be credible, it must correspond to the kart shape, otherwise the kart will seem to float above the ground. Here is a little method to get quick and fast a nice shadow : Kart shadow tutorial.

Exporting karts

Once everything is ready, or just to see a work in progress version of the kart ingame, you need to export it using the STK kart exporter. To do so :

  Resources/data/karts/stk_kart.py
  Resources/data/tracks/b3d_export.py
Blender-stkkarts.png


If you have remarks or feedback about this tutorial, don't hesitate to post them on the forum, and if you see any mistakes please tell, or even correct them !

Retrieved from "http://supertuxkart.sourceforge.net/New_kart_tutorial"

User Tools