Making kart tutorial
This is a tutorial to help you making characters/kart in Blender. It does not intend to cover everything but to get you started in the right direction.
If you have not already done so, I recommend you read article Guidelines for making karts and characters, even though knowledge of this article is not required to follow this tutorial as important elements will also be mentioned here.
This tutorial assumes you know the basics of modeling and doing UV texturing in blender, and will concentrate on aspects that are specific to SuperTuxKart.
Contents |
Fixing ac3d blender export script
Before starting, we need to configure the blender export script to be compatible with the game. You should normally use the method for 2.44 and up. However it was reported that on windows the 2.43 method worked better.
Linux Warning : some Linux users reported that the export script failed to work (namely on Ubuntu). This is usually caused by an older version of blender being installed by a deb - which means older versions of scripts lay around. So first make sure your install is clean of old files; in doubt, remove everything blender-related, including ~/.blender, and do a clean install
First you need to locate the scripts/ directory.
- Ubuntu Linux from distribution : /usr/lib/blender/scripts/, /home/[yourname]/.blender/bpydata/config
- Gentoo Linux : /usr/share/blender/scripts/
- Blender binary for Linux: <install path>/.blender/scripts/
- Mac OS X : right-click on blender, select show package contents, open Contents/Mac OS, hit Cmd+Shift+G, type .blender, hit OK, open scripts
- Windows XP: C:\Program Files\Blender Foundation\Blender\.blender\scripts\
Blender 2.44 and up
If you have never used the ac3d export script of blender before, the ac3d config file will not exist, so export anything before proceeding so that the config file is generated. Close blender before proceeding. From the scripts directory, open /bpydata/config/ac3d_export.cfg
Find the GLOBAL_COORDS option(probably at line 18), and set the global coordinates export to false by changing
'GLOBAL_COORDS': True,
to
'GLOBAL_COORDS': False,
Blender 2.43
Locate and open the file called ac3d_export.py. Go to line 129, and set the global coordinates export to false by changing
GLOBAL_COORDS = True
to
GLOBAL_COORDS = False
Making the model
In Blender, start by hitting numpad 1. When you model the kart, you need to make this point of view see the back of the kart (it's even easier to see in ortho mode)
Make the kart on top of the Y axis (the green line) like it was the road the kart will drive on.
You can see the properties of an object by pressing the N key. Make the kart about 1 unit long (this is only an approximate indication, as you will probably fine-tune the size of the kart when trying it in-game). (DimY will tell you the length of the kart. Mine is approximately 0.9.) Always keep the rotation of objects to 0. If you need to rotate something, rotate the mesh and not the object (i.e. rotate in Edit mode, not in Object mode)
Polygon count
We do not have very strict requirements for polygon count, but of course use them smartly, so don't add more polys where it makes little or no visual difference. An analysis of our current karts by cheleb suggests that karts should be around 1700 (low/medium) - 3000 (quite high, avoid) polys.
- Whether we will be using 2 versions of each kart, one low-res and one high-res, is still not fully known.
Analysis of poly count by Cheleb :
| character | chassis | wheel.fr | wheel.fl | wheel.rr | wheel.rl | chassis & wheels | total | ||||||||
| elephant | 1060 | 46% | 456 | 20% | 192 | 8% | 192 | 8% | 192 | 8% | 192 | 8% | 1224 | 2284 | 100% |
| eviltux | 706 | 29% | 1174 | 48% | 144 | 6% | 144 | 6% | 144 | 6% | 144 | 6% | 1750 | 2456 | 100% |
| gnu | 644 | 77% | 64 | 8% | 32 | 4% | 32 | 4% | 32 | 4% | 32 | 4% | 192 | 836 | 100% |
| gooey | 902 | 32% | 883 | 31% | 260 | 9% | 260 | 9% | 260 | 9% | 260 | 9% | 1923 | 2825 | 100% |
| hexley | 1514 | 41% | 1418 | 38% | 192 | 5% | 192 | 5% | 192 | 5% | 192 | 5% | 2186 | 3700 | 100% |
| mozilla | 698 | 49% | 594 | 42% | 32 | 2% | 32 | 2% | 32 | 2% | 32 | 2% | 722 | 1420 | 100% |
| mriceblock | 3192 | 50% | 2494 | 39% | 176 | 3% | 176 | 3% | 176 | 3% | 176 | 3% | 3198 | 6390 | 100% |
| nolok | 498 | 37% | 672 | 49% | 48 | 4% | 48 | 4% | 48 | 4% | 48 | 4% | 864 | 1362 | 100% |
| puffy | 558 | 33% | 722 | 42% | 105 | 6% | 105 | 6% | 105 | 6% | 105 | 6% | 1142 | 1700 | 100% |
| tux | 840 | 30% | 1192 | 43% | 192 | 7% | 192 | 7% | 192 | 7% | 192 | 7% | 1960 | 2800 | 100% |
| wilber | 1648 | 61% | 298 | 11% | 192 | 7% | 192 | 7% | 192 | 7% | 192 | 7% | 1066 | 2714 | 100% |
| average | 1085.78 | 43% | 941.89 | 37% | 131.22 | 5% | 131.22 | 5% | 131.22 | 5% | 131.22 | 5% | 1466.78 | 2552.56 | 100% |
| calculated lo | 723.13 | 43% | 627.3 | 37% | 87.39 | 5% | 87.39 | 5% | 87.39 | 5% | 87.39 | 5% | 976.87 | 1700 | 100% |
| calculated hi | 1276.11 | 43% | 1107 | 37% | 154.22 | 5% | 154.22 | 5% | 154.22 | 5% | 154.22 | 5% | 1723.89 | 3000 | 100% |
| proposed lo | 700 | 41% | 600 | 35% | 100 | 6% | 100 | 6% | 100 | 6% | 100 | 6% | 1000 | 1700 | 100% |
| proposed hi | 1200 | 40% | 1000 | 33% | 200 | 7% | 200 | 7% | 200 | 7% | 200 | 7% | 1800 | 3000 | 100% |
Texturing
Texture your object with UV texturing. Your texture images size must be a power of two, e.g. 256x256 or 512x512, in .rgb format.
Making the wheels
Add the wheels as separate objects. Name them WheelRear.R, WheelRear.L, WheelFront.R and WheelFront.L. Make sure the center of the object is at the center of the wheel (you can recenter in space bar > Transform > Center new when the object is selected). Go in object properties with N and give the wheels a X rotation of -90 degrees (this is necessary for wheels to rotate correctly when the kart turns. some models use different angles, in any case if the wheels rotate the wrong way when the kart turns, play with this number)
Exporting the model
STK 0.6
- Download the following script : python export script
- In blender, divide your panes or switch to a different pane layout in order to have a text editor pane.
- In this pane, choose menu Text > Open, then choose this script.
- Select all objects making your model.
- Execute the script by hitting alt + P in the text window.
- Browse to the location where you want to export the kart, edit the name as needed and
STK 0.5 and before
Select all your models and choose File > Export > ac3d.
Setting up the files in the game
Locate the data folder of SuperTuxKart:
- On mac OS X, right-click on SuperTuxKart, select Show Package Contents, open Contents/Resources.
- (K-)Ubuntu: /usr/share/games/supertuxkart
- Location is unknown on other platforms, please complete this article if you know!
STK 0.4.1 and newer (including SVN)
Look in the data/karts/* folders and you can find examples from existing characters, it's usually easy to figure out.
- Create two rgb files, one is the icon, the other is the shadow. I suggest duplicating existing files, changing their names to "characterNameicon.rgb" and "characterNameshadow.rgb" and then modifying them in your favorite image editor.
- The shadow will need to be fine-tuned by seeing what it does in-game. When you're done, create a file called Materials.dat following the model in /data/textures, but containing only entries related to your kart. You will want, for instance, to enable transparency for the shadow texture by putting a 'Y' in the Transparency column.
Example:
# See textures/materials.dat for a detailed description of the fields. # TextureName Clamp Trans Alpha Light SphMp Frict Ign Zip Rst Col "tuxshadow.rgb" Y Y Y 0.0 N N 1.0 Y N N N "tuxicon.rgb" Y Y Y 0.0 N N 1.0 Y N N N # EOF #
Then, you need to create a file named CharacterName.kart (if you are using the script for STK 0.6, the script will have conveniently created it for you) with contents that looks like (fill in the appropriate names) :
;; -*- mode: lisp -*- (tuxkart-kart (name "Character name") (model-file "modelFileName.ac") (icon-file "characterNameicon.rgb") (shadow-file "characterNameshadow.rgb") # STK 0.6 and up (rgb 0.700000 0.000000 0.000000) # STK 0.5 and earlier (red 0.25) (green 0.23) (blue 0.18) # if you are using the script for STK 0.6, this file will # also contain information about the location of wheels. # Just leave this part as written by the export script. # the version field is used to prevent files from old versions # to be picked by a new version (version 1) ) ;; EOF ;;
The color is a color that represents your character, e.g. the dot on the map will be that color.
- Put all those files in a directory named CharacterName, and put this folder in /data/karts
You are now ready to open STK and try your character!
STK 0.4 and before
Create two rgb files, one is the icon, the other is the shadow. Look in the images folder and you can find examples from existing characters. I suggest copying the files, changing their names to "characterNameicon.rgb" and "characterNameshadow.rgb" and then modifying them in your favorite image editor. The shadow will need to be fine-tuned by seeing what it does in-game. When you're done, open the file data/Materials.dat. Locate an icon entry and a shadow entry. Duplicate them, and change the file names to those you just made.
Then, you need to create a file named CharacterName.tkkf with contents that looks like (fill in the appropriate names) :
;; -*- mode: lisp -*-
(tuxkart-kart
(name "Character name")
(model-file "modelFileName.ac")
(icon-file "characterNameicon.rgb")
(shadow-file "characterNameshadow.rgb")
(red 0.25)
(green 0.23)
(blue 0.18)
)
;; EOF ;;
The color is a color that represents your character, e.g. the dot on the map will be that color.
- Add your model file to the models folder.
- Add icon, shadow and texture .rgb files to images, folder.
- Add .tkkf file to data folder.
You are now ready to open STK and try your character!
-Written by Marianne Gagnon (nickname Auria)


