Difference between revisions of "Car files"
(Added half of the description for stda resources) |
(Completed the basic stda/stdb descriptions.) |
||
Line 6: | Line 6: | ||
*'''st*.p3s''' - [[Resource file format#3d shapes|3d shape resource]] file that stores the graphical 3D models of the car, including their colour data. | *'''st*.p3s''' - [[Resource file format#3d shapes|3d shape resource]] file that stores the graphical 3D models of the car, including their colour data. | ||
− | *'''stda*. | + | *'''stda*.pvs''' - [[Resource file format#Bitmap images|Bitmap resource]] file that contains the dashboard image, including the shifting stick's base. *'''stdb*.pvs''' - [[Resource file format#Bitmap images|Bitmap resource]] file that contains the shifting knob. For the [[Corvette ZR1|Corvette]], it also stores the digital speedometer graphics. |
− | *'''stdb*. | ||
Each of the files contain a number of independent resources, used on different places or in-game situations. Here a rundown of those resources contained within each file will be presented. For an explanation of internal structure of the resources, applicable to all files here discussed, check the [[Resource file format]] article. | Each of the files contain a number of independent resources, used on different places or in-game situations. Here a rundown of those resources contained within each file will be presented. For an explanation of internal structure of the resources, applicable to all files here discussed, check the [[Resource file format]] article. | ||
− | ===3D shapes (st*. | + | ===3D shapes (st*.pvs)=== |
Standard st*.p3s files contain seven 3D shape resources, each being used in different circumstances: | Standard st*.p3s files contain seven 3D shape resources, each being used in different circumstances: | ||
Line 20: | Line 19: | ||
*'''exp0''', '''exp1''', '''exp2''' and '''exp3''' aren't really proper 3D shapes, but rather individual lines and polygons that make up the bits of debris seen after a crash. | *'''exp0''', '''exp1''', '''exp2''' and '''exp3''' aren't really proper 3D shapes, but rather individual lines and polygons that make up the bits of debris seen after a crash. | ||
− | ===Dashboard | + | ===Dashboard static parts (stda*.pvs)=== |
The base elements of the dashboard are actually made of a number of separate bitmaps, not all of them necessarily present in all of the dashboards: | The base elements of the dashboard are actually made of a number of separate bitmaps, not all of them necessarily present in all of the dashboards: | ||
*'''!cg0''' and '''!eg0''' are alternative palettes for non-VGA graphic modes. | *'''!cg0''' and '''!eg0''' are alternative palettes for non-VGA graphic modes. | ||
− | *'''dash''' is the base | + | *'''dash''' is the base panel of the dashboard, covering most of its drawn area. |
− | *'''dast''' complements the top of the dash bitmap with curved areas, as seen on the [[Porsche March Indy|Indy]] for instance. Since all bitmap resources correspond, naturally, to rectangular areas, there's an additional bitmap, '''dasm''' which acts as an alpha mask in order to have the | + | *'''dast''' complements the top of the dash bitmap with curved areas, as seen on the [[Porsche March Indy|Indy]] for instance. Since all bitmap resources correspond, naturally, to rectangular areas, there's an additional bitmap, '''dasm''', which acts as an alpha mask in order to have the proper looks of a curved surface instead of a rectangular block. |
− | *'''roof''' is the strip seen atop above the windshield for a number of cars - for instance, the ones containing "PORSCHE" or "JAGUAR" inscriptions on the [[IMSA]] cars. | + | *'''roof''' is the strip seen atop above the windshield for a number of cars - for instance, the ones containing "PORSCHE" or "JAGUAR" inscriptions on the [[IMSA]] cars. |
+ | *'''whl2''' is the centered steering wheel bitmap. The internal pixel coordinates of it are used to define steering wheel dot positions in the car*.res. | ||
+ | *'''whl1''' and '''whl3''' are graphics for the wheel steered left and right respectively. | ||
+ | *'''ins2''' corresponds to the meters - tachometer and/or analog speedometer. Although the bitmap itself is redundant for all default cars, since the meter graphics are included in dash as well, ins2 has an actual purpose: define the internal coordinates for speedometer/tachometer needle render, controlled by car*.res. | ||
+ | *'''ins1''' and '''ins3''' are complementary graphics corresponding to small sections of the dashboard uncovered when the wheel is steered left or right (and so they are complementary to whl1 and whl3, in that order). Since the images are not rectangular, alpha masks '''inm1''' and '''inm3''' are needed, just like dasm was for dast. | ||
+ | *'''gbox''' is the shifting stick base. Coordinates for shifting knob positions are defined within the reference frame of this bitmap. | ||
− | + | ===Dashboard moving parts (stdb*.pvs)=== | |
− | + | The stdb*.pvs file contains a few auxiliary bitmaps that are not rendered all the time or change position within the screen often: | |
− | + | *'''!cg0''' and '''!eg0''' are alternative palettes for non-VGA graphic modes. | |
+ | *'''dot ''' is the blue steering wheel dot. As every non-rectangular bitmap, it calls for an alpha mask, in this case called '''dota'''. | ||
+ | *'''dot1''' and '''dot2''' are strange versions of dot with a tiny palette-like strip inserted into its top. Their purpose is currently unknown. | ||
+ | *'''gnob''' is the shifting gear knob, and '''gnab''', its alpha mask. | ||
+ | *From '''dig0''' to '''dig9''' there are individually-stored digits for Corvette-style digital speedometers. Their rendering is not completely straightforward, as those digits do not are not placed over the dashboard as a rectangular block and yet there are no alpha masks. | ||
+ | |||
+ | All the dashboard moving parts are positioned according to various car*.res parameters, as described in the [[Car parameters#Dashboard controls|Car parameters]] article. The vector-drawn speedometer and tachometer needles are controlled by car*.res as well. | ||
===Editing and combining car graphics=== | ===Editing and combining car graphics=== |
Revision as of 00:56, 27 April 2008
Stunts cars are made of four different resource files: st*.p3s, stda*.pvs, stdb*.pvs and car*.res ; where the * stands for an arbitrary 4-letter abbreviation shared by files of the same car. All of the car graphics are stored in the .p3s and .pvs files. The car*.res, which is the one of most concern when creating a tuned car, contains numerical and text parameters, including data about car performance.
Graphics files (.p3s/.pvs)
Different aspects of a car's appearance are stored in each of the graphic files:
- st*.p3s - 3d shape resource file that stores the graphical 3D models of the car, including their colour data.
- stda*.pvs - Bitmap resource file that contains the dashboard image, including the shifting stick's base. *stdb*.pvs - Bitmap resource file that contains the shifting knob. For the Corvette, it also stores the digital speedometer graphics.
Each of the files contain a number of independent resources, used on different places or in-game situations. Here a rundown of those resources contained within each file will be presented. For an explanation of internal structure of the resources, applicable to all files here discussed, check the Resource file format article.
3D shapes (st*.pvs)
Standard st*.p3s files contain seven 3D shape resources, each being used in different circumstances:
- car0 shape is the one used in the car selection screen. It is richly detailed for Stunts usual standards, and has pretty high internal resolution.
- car1 shape corresponds to the car actually rendered on-track. Its resolution is much smaller than the car0 shape, the scaling down factor being in the order of 1:20, thus explaining why many fine details seen on the "showroom" car are not seen on-track.
- car2 shape is the very long distance model, used only for the initial zoom-in animation that precedes the "Fasten your seatbelt!" message at the start of a race. It has very low resolution, to the point of being barely recognizable.
- exp0, exp1, exp2 and exp3 aren't really proper 3D shapes, but rather individual lines and polygons that make up the bits of debris seen after a crash.
Dashboard static parts (stda*.pvs)
The base elements of the dashboard are actually made of a number of separate bitmaps, not all of them necessarily present in all of the dashboards:
- !cg0 and !eg0 are alternative palettes for non-VGA graphic modes.
- dash is the base panel of the dashboard, covering most of its drawn area.
- dast complements the top of the dash bitmap with curved areas, as seen on the Indy for instance. Since all bitmap resources correspond, naturally, to rectangular areas, there's an additional bitmap, dasm, which acts as an alpha mask in order to have the proper looks of a curved surface instead of a rectangular block.
- roof is the strip seen atop above the windshield for a number of cars - for instance, the ones containing "PORSCHE" or "JAGUAR" inscriptions on the IMSA cars.
- whl2 is the centered steering wheel bitmap. The internal pixel coordinates of it are used to define steering wheel dot positions in the car*.res.
- whl1 and whl3 are graphics for the wheel steered left and right respectively.
- ins2 corresponds to the meters - tachometer and/or analog speedometer. Although the bitmap itself is redundant for all default cars, since the meter graphics are included in dash as well, ins2 has an actual purpose: define the internal coordinates for speedometer/tachometer needle render, controlled by car*.res.
- ins1 and ins3 are complementary graphics corresponding to small sections of the dashboard uncovered when the wheel is steered left or right (and so they are complementary to whl1 and whl3, in that order). Since the images are not rectangular, alpha masks inm1 and inm3 are needed, just like dasm was for dast.
- gbox is the shifting stick base. Coordinates for shifting knob positions are defined within the reference frame of this bitmap.
Dashboard moving parts (stdb*.pvs)
The stdb*.pvs file contains a few auxiliary bitmaps that are not rendered all the time or change position within the screen often:
- !cg0 and !eg0 are alternative palettes for non-VGA graphic modes.
- dot is the blue steering wheel dot. As every non-rectangular bitmap, it calls for an alpha mask, in this case called dota.
- dot1 and dot2 are strange versions of dot with a tiny palette-like strip inserted into its top. Their purpose is currently unknown.
- gnob is the shifting gear knob, and gnab, its alpha mask.
- From dig0 to dig9 there are individually-stored digits for Corvette-style digital speedometers. Their rendering is not completely straightforward, as those digits do not are not placed over the dashboard as a rectangular block and yet there are no alpha masks.
All the dashboard moving parts are positioned according to various car*.res parameters, as described in the Car parameters article. The vector-drawn speedometer and tachometer needles are controlled by car*.res as well.
Editing and combining car graphics
Graphic files of different cars can be mixed freely when constructing a new car (note that the car*.res may require adjustment so that the indicators work properly on a new dashboard). As for modification of the graphics themselves, until recently that was deemed impossible, for the lack of information about the format employed by the developers to compress the vector graphics. This first major obstacle, however, has been sorted out. (see Tools section below)
Car behaviour (car*.res)
All adjustable aspects of a car behaviour are stored in car*.res. Those include both physics data, such as power curves, and visual parameters, like car height in cockpit view or speedometer behaviour. Also, the file also contains the text data displayed at the car selection screen. Data in car*.res may be read and modified by any hex editor, or more conveniently by a specially-designed graphical editor (see the Tools section ahead).
The function of a large fraction of car*.res hex addreses was elucidated over the years, allowing modifications of many car aspects. Here is a quick reference for those addresses, adapted from the chart available at Lukas Loehrer's site. A more throughout discussion on the effects and quirks of the parameters is available at Car parameters; clicking on a parameter description will lead to the corresponding entry there.
Byte offset | Function |
---|---|
26h | Number of gears |
28h-29h | Car mass |
2Ah-2Bh | Braking effectiveness |
2Ch-2Dh | Idle rpm |
2Eh-2Fh | Downshift rpm (auto transm.) |
30h-31h | Upshift rpm (auto transm.) |
32h-33h | Maximum rpm |
37h-41h | Gear ratios (odd offsets) |
46h-5Ch | Shifting knob positions (even offsets) |
5Dh-5Eh | Aerodynamic resistance |
60h-C7h | Torque curve |
CAh-CBh | Grip |
F6h-F7h | Car height on cockpit view |
110h-14Dh | Steering wheel dot movement |
14Eh-223h | Speedometer needle movement |
150h-159h | Digital speedometer |
224h-32Dh | Rev meter needle movement |
32Eh-EOF | Text data (car selection screen and high score table) |
Version compatibility
Cars that use graphic files from Stunts 1.0 do not work properly on 1.1 versions, and vice-versa. Doing so causes a crash in the car selection screen. Although the car*.res files may be exchanged between versions, car performance won't be the same due to the known differences between game versions in that respect.
Tools
The car*.res files can be read and edited by any hex-editor or text editor able to display files in hexadecimal mode - HT and Vim are examples of each case). A more convenient alternative are graphical hex-editors designed especially for Stunts car hacking. Mark Nailwood's Car Blaster, by far the most used of those, has resources such as tags on useful bytes and comparison between cars. Other editors include Caredit and Winedit.
Modified cars are not recognized in the RPL Info tool, also created by Mark Nailwood.
In 2008, dstien created a tool named stunpack to unpack some files of the game. His project is registered here [1] and is still under development, but it looks really promising. the day when we will be able to change car shapes is approaching.