Stunts Forum

Stunts - the Game => Custom Cars with Stressed => Topic started by: Cyberman on July 23, 2004, 08:15:12 PM

Title: Dissecting the Stunts files, trying to. Anyone know more?
Post by: Cyberman on July 23, 2004, 08:15:12 PM
As the title says, I recently started to dissect the files of Stunts. Originally, I wanted to know if it?s possible to replace the graphics of the opponents.
Needless to say, I had no luck. So I started to dissect the files, trying to figure them out.
Not much did I find, perhaps someone knows more?

I took much information(almost all) from the Stunts FAQ, didn?t mark it, though, as I simply added what little I found.
(Note: I pasted everything from a text-file I keep, I hope the formatting survived it.)

BTW: I hope it?s the right forum, didn?t find a more fitting. If that has been posted already, please point me to the thread, I did search, but there?s always the chance I used the wrong words...

Anyway, here?s the info:

Version 1.0 had partially uncompressed files, while those of 1.1. are compressed. Not all of them  just some.
The files containing graphics are apparently compressed in ALL versions.
The RESource files, however, are uncompressed in V1.0 - that?s why programs like Opponent Blaster can change them easily.

The files of V1.1 are NOT encrypted, rather compressed. The initial "p" in their extensions probably means "Packed". So, "RESource" becomes "Packed REsource".
An indication for packed raher than encrypted is that the packed files contain the size of the old files(compareable with the Opp?.RES files), and, well, they?re simply smaller. Not just a few bytes.

The "PVS" thus would mean "Packed VS" - whatever a VS file is, though one can assume the "V" standing for "Vector", as we know that Stunts uses Vectorgraphics, instead of bitmaps.

The packing method is unknown, I don?t think it?s any of the common archivers, though. It doesn?t look like it?s been compressed by ARJ, ZIP, LHA or such, even if the header is stripped away.

Now the structure, as far as I can tell(not far) - I took most information from  available resources:

*) RES files
There are (perhaps) two of them - one for cars, one for opponents. They might be of the same basic structure,
but I have no  information about that. It seems likely, though.

Opponent structure(uncompressed):
Code: [Select]

 OFFSET   SIZE      DESCRIPTION

 0x0000   LongInt   Resource file size in bytes
  ...
 0x0005   Byte      0x1B - probably an End of Header tag
 0x0006   215Bytes  I wish I knew. It looks like some sort of Index table,
                             perhaps the positions to the texts below(for win, loss,
                             etc...). Surely it?s no binary data, it?s too structured
                              for that.
 0x00DE   2 Chars   Opponent's initials    
  ...
 0x00E0   7Byte     Nothing, Zero. Apparently unused
 0x00E7   20Byte    Junk? Some bytes, ones and zeroes. Can be overwritten
 0x0103   151Byte   Nothing, a few bytes in between, nothing serious(?)
  ...
 0x019B   Byte      Paved road
 0x019C   Byte      Dirty road
 0x019D   Byte      Icy road
 0x019E   Byte      Paved sharp corner
 0x019F   Byte      Dirty sharp corner
 0x01A0   Byte      Icy sharp corner
 0x01A1   Byte      Paved corner
 0x01A2   Byte      Dirty corner
 0x01A3   Byte      Icy corner
 0x01A4   Byte      Bridge
 0x01A5   Byte      Paved slalom road
 0x01A6   Byte      Corkscrew up/down
 0x01A7   Byte      Chicane
 0x01A8   Byte      Loop
 0x01A9   Byte      Corkscrew left/right, Pipe
  ...
 0x01AB   Text      Here begins a large chunk of text - Name, Expertise,
                           Problems, Info,  it?s all here, simply written up.
                           No coding, no structure, apparently.
 0x034F   35Bytes   Some bytes, they seem to be important. Perhaps the
                            coordinates for the evaluation videos? Or the text
                            coordinates, though I doubt that.
 0x0372   till EOF  The Win/Lose/Crash texts

Note: The texts have no special encoding, other than ENTER indicated by "]", text fragments
      are ended with 0x02E00 apparently.


Opponent structure(compressed):
I wish I could say I know as much about these as about the uncompressed - the sorry truth is, I know hardly anything.
Code: [Select]

 OFFSET   SIZE      DESCRIPTION

 0x0000   1Byte     0x02 - Header ID? Indication for Compressed file?
 0x0001   2Byte     Size of UNCOMPRESSED file + 1
 0x0003   1Byte     0x00 - always. Don?t know why
 0x0004   1Byte     Either 0x0A or 0x0B - perhaps the second half of a word?
                           (previous byte)

That?s it. There are several characters at the beginning, but I have no idea what they mean. They might be part of a Huffman encoding, though.



*) Highscore files:
Code: [Select]

OFFSET   SIZE      DESCRIPTION

     0x0000   17 Chars  Driver's name
                          (zero-terminated string)
     0x0011   24 Chars  Driver's car name
                          (zero-terminated string)
     0x0029   1 Byte    OppWinFlag - zero when won, one when lost
     0x002A   2 char    Opponent?s initials
     0x002B   1 Char    Separator("/")
     0x002C   5 Char    Opponents car (short version)
     0x0032   Word      Time achieved by human driver

     The time value has to be divided by 20 to get a result in seconds, e.g.

          2131 / 20 = 106.55 seconds = 1 minute, 46 seconds, 55 hundredth

Note: Version 1.1 apparently doesn?t work "clean" - the strings are not, like in V1.0, folloed by ".", but mere memory copies - with whatever junk lay in there. Do not read beyond the final Zero!


*) Track files
   are well-known enough, I think - no need to describe them here again.

*) PVS files
As said above, they?re probably compressed. So the PVS might mean "Packed Vertex Structure", since the graphics are vector-based, instead of simple bitmat.
They?re used for the opponents animation as well as the background, apparently. The opponent pictures are NOT saved in them, they?re somewhere else, maybe hardcodec somewhere, along with the number of opponents.
Code: [Select]

 OFFSET   SIZE      DESCRIPTION

 0x0000   1Byte     0x02 - Header ID? Indication for Compressed file?
 0x0001   2Byte     Size of UNCOMPRESSED file + 1
Title: Dissecting the Stunts files, trying to. Anyone know more?
Post by: alanrotoi on July 23, 2004, 09:02:38 PM
About the text of the dialogs of the opponents it's easy to edit with a hexa editor like pc tools 4.21 deluxe.
Title: Dissecting the Stunts files, trying to. Anyone know more?
Post by: al il professore on July 23, 2004, 10:41:28 PM
welcome to the business. well those compressed files are okay, but we cant uncompress them -yet-

i say -yet- because something tells me one day they will be (unpacked). The lead programmer of stunts told it was 'some internal compression tool' that was used to pack the files... my opinion: it makes the sources protected (compression=confidentiality comparable to password protection) and its probably a model of compression used somewhere else in another game, etc. well... there were no infinite methods of compression used by those times and someone knows how to unpack those (like you said) VECTOR coordinates files.

i would like to study the things you said about the difference of packing between version 1.0 and version 1.1 because its interesting.

but now there are more funny things to do with stunts by hacking the sources than 'changing the buckheads of the opponents'... but changing the buckheads sort of gif animations or id cards photos can lead to further modification i would be the first to support (edit 3D cars! edit track elements!)
Title: Dissecting the Stunts files, trying to. Anyone know more?
Post by: Cyberman on July 23, 2004, 11:47:08 PM
The packing applies not only to the vector files - the resource files are packed as well.

If you want to try, I?d recommend trying to decompress the PRE files back to RES.
Even if they changed between 1.0 and 1.1, chances are good they?re still similar enough to give a clue or two.
After all, the filesize seems to fit.
Title: Dissecting the Stunts files, trying to. Anyone know more?
Post by: Akoss Poo a.k.a. Zorromeister on July 24, 2004, 12:54:14 AM
I think it's better to drive Stunts than to dissect the files....  :?
Title: Dissecting the Stunts files, trying to. Anyone know more?
Post by: al il professore on July 24, 2004, 01:28:34 PM
the pre files are used in version 1.0 and match the res files in version 1.1? that's it?
Title: Dissecting the Stunts files, trying to. Anyone know more?
Post by: Cyberman on July 25, 2004, 12:24:38 AM
Other way around, but yes.
The RES files of 1.0 - the opponent RES files, I mean, are probably the same as the PRE files(used for opponents) in 1.1 .

That?s just an assumption, but it seems likely, as the PRE files seem to be compressed, and contain in their header the size of the uncompressed file - which is known for the opponent RES files.
It?d be quite a coincidence if they?re not the same, though the size matches.
Title: Dissecting the Stunts files, trying to. Anyone know more?
Post by: al il professore on July 25, 2004, 11:10:36 AM
compression method... okay... and once uncompressed... do you know how to decompile C or assembly?
Title: Dissecting the Stunts files, trying to. Anyone know more?
Post by: zaqrack on July 25, 2004, 01:01:06 PM
as i know resource and 3d files dont need to be decompiled.
The engine is stored in other files, these are only datas which are readedby the main engine.
Title: Dissecting the Stunts files, trying to. Anyone know more?
Post by: Cyberman on July 25, 2004, 01:23:15 PM
Right.

The engine itself, or at least a part of it, probably rests within the EGA/MCGA/etc files - those with ".COD", ".HDR" and ".DIF".

They?re EXE files I think, with the "HDR" part containing the Header(recognizable through the "MZ" at beginning), what the "DIF" is for, I can?t tell, but it seems likely they contain some "DIFference" data - maybe to change between different computer systems?

These files seem to be different in 1.0 to 1.1 too.
Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
Post by: dstien on March 06, 2008, 01:52:42 AM
My interpretation of the RES file structure:
Code: [Select]
WORD lenRemainder
BYTE lenMultiplier   // total = (lenMultiplier * 0xFFFF) + lenRemainder
BYTE unknown         // Passes == 0?
WORD numVars

CHAR ids[numVars][4]
DWORD offsets[numVars]

BYTE values[]       // Rest of file

A RES file has numVars variables, each with a 4-chars identification and an offset pointing to the data in values[]. Text is null-terminated strings, the structure of other value types depend on the id.

Here's an example of the unlock questions and answers from MISC.PRE (more on the decompression later):
Code: [Select]
Num Id   Offset   Value
--- ---- -------- -------
  1 ea00 000002C2 camera
  2 ea01 00000314 destructive
  3 ea02 00000368 conventions
  4 ea03 000003BC previewing
  5 ea04 000003FC proper
  6 ea05 00000426 cables
  7 ea06 00000460 loop
  8 ea07 000004AC displaying
  9 ea08 000004EB you
 10 ea09 00000537 query
 11 ea0a 00000571 button
 12 ea0b 000005AC directory
 13 ea0c 000005F9 around
 14 ea0d 00000648 currently
 15 ea0e 00000687 selected
 16 ea0f 000006D4 immediately
 17 ea0g 00000727 track
 18 ea0h 00000766 three
 19 ea0i 000007A0 110
 20 ea0j 000007D7 buttons
(...)
 51 eq00 00000292 106 1 @       mode while in this]viewing mode.]
 52 eq01 000002C9 1 122 ...and @             stunts that]can smash your car to pieces in...]
 53 eq02 00000320 2 5 8 ...control your car, as well as]the @            of using the...]
 54 eq03 00000374 3 134 ...editor'). In addition,]@           might give you a]better...]
 55 eq04 000003C7 4 8 1 @       direction. If you get on]the track...]
 56 eq05 00000403 5 123 hit the @      and crash...]
 57 eq06 0000042D 6 3 7 while you are driving through]the @     ...]
 58 eq07 00000465 7 2 1 @            the current car, an]acceleration curve (showing...]
 59 eq08 000004B7 8 5 7 Just your everyday type of]vehicle. @    ...]
 60 eq09 000004EF 9 3 9 ...course, you'll be interrupted]while driving with a @      ...]
 61 eq0a 0000053D 103 5 your driving performance. This]@       is...]
 62 eq0b 00000578 112 1 @          . Highlight the]desired replay...]
 63 eq0c 000005B6 122 1 @        ,you can choose to race]any one at a time. Each...]
 64 eq0d 00000600 134 11this screen, you'll see a bird's]eye view of the @           ...]
 65 eq0e 00000652 146 1 @          piece is the area upon]which it...]
 66 eq0f 00000690 2 8 1 @            on the standard track]by clicking on the car...]
 67 eq0g 000006E0 3 2 1 @      selection screen. Your]goal is to be on it. Your real...]
 68 eq0h 0000072D 4 4 4 ...time than missing @      ]pieces of regular...]
 69 eq0i 0000076C 6 5 8 ...out at the peak, while]more than @    MPH]
 70 eq0j 000007A4 7 5 7 ...retail price), and a set]of @        ...]
(...)
Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
Post by: zaqrack on March 06, 2008, 01:32:06 PM
wow, this sure seems interesting!
Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
Post by: Krys TOFF on March 06, 2008, 10:37:40 PM
Nice work, keep it up dstien. ;)
And welcome to the forum.
Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
Post by: dstien on March 07, 2008, 04:05:26 AM
Thanks! I have reversed the first decompression pass, enough to unpack PRE and code files (COD/CMN/DIF), the other files use an additional layer of compression which I'm currently looking into. P3S and PVS files can contain multiple shapes and bitmaps, organized in the same structure as RES files. The game accepts uncompressed data files (P3S => 3SH, PVS => XVS), so it doesn't look like there's need for an encoder. 8)
Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
Post by: zaqrack on March 07, 2008, 08:13:39 AM
The game accepts uncompressed data files (P3S => 3SH, PVS => XVS), so it doesn't look like there's need for an encoder. 8)

Now this is the news of the year! We seem to be only a margin away from understanding those files and finally creating new cars. If only we could create new track elemets, stunts would be perfect :) If you need any help for your work, just let us know! 
Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
Post by: Krys TOFF on March 07, 2008, 08:55:40 AM
We could be able to create new cars shapes, but if we have the programs that allow us to do so.
I found some infos about XVS extension (it seems to be an XView (http://en.wikipedia.org/wiki/XView) file format, as described here (http://filext.com/file-extension/XVS))
It seems XView is a program created in 1988, so it suits well the timeline with Stunts creation. The program is open-source since the early 90's (hey, it seems to be the oldest open-source program :o) but I couldn't find a link to download it, most pages I found were talking about the image viewer (named X-view too) or some toolkit extensions for XView program but not the program itself... ::)

Anyway, the XView program seems to be at the origin of Ogre 3D. Just for those who never take a look at the Stunts sequels (http://forum.stunts.hu/index.php?topic=1431) thread, StuntCarRacer (http://stuntcarracer.sourceforge.net/) and TileRacer (http://tileracer.model-view.com/tl/index.php/news.html) are developped with Ogre 3D.

I found nothing about 3SH extension. What is this one ?
Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
Post by: zaqrack on March 07, 2008, 11:27:24 AM
I guess you are mistaken here Krys, the XView you quoted on Wikipedia is a widget toolkit, which allows programmers to create user interfaces for programs.
Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
Post by: Krys TOFF on March 07, 2008, 04:44:00 PM
Oh, this program is an interface toolkit ?  I saw Ogre 3D in this page so I didn't read it all and I thought it was a way to create 3D objects/programs.
So I don't know what is XVS file format...
Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
Post by: dstien on March 18, 2008, 03:12:15 AM
I doubt that DSI licensed a format for storing straight-forward bitmaps. The filename extensions are likely just coincidences, the 8+3 naming scheme have led to many collisions. These formats may however have been re-used in other games made by DSI/Unlimited Software at the time, I'm eager to know if this is the case, especially the compression.

The compression can be variable-length encoding (http://en.wikipedia.org/wiki/Variable-length_code) or run-length encoding (http://en.wikipedia.org/wiki/Run-length_encoding). A compressed file may contain another compressed sub-file, hence allowing both compression schemes to be combined recursively. The total size of all game files uncompressed is 2.5 MB (BB 1.1), this would need four DD 3.5" floppy disks, as opposed to two as the game was shipped on (1.2 MB).

I have registered a Google Code hosted project for my tools (http://stuntstools.googlecode.com/), the first one being stunpack (http://code.google.com/p/stuntstools/source/browse/trunk/stunpack/), a simple command line program for unpacking packed resources (PRE/P3S/PVS/PES) and code files (COD/CMN/DIF). BB 1.0 files are not supported. They differ from 1.1 files, but I haven't investigated it further.

Here's a pre-release Win32 EXE file. I've only tested it under Wine, so please check if it works on an actual Microsoft system as well. You can do this by unpacking resource files and move the original packed ones out of reach. The game will thus load unpacked ones instead. If the game works as normal, the decompression was successful. Please note that some bitmaps will appear distorted. This is not caused by the decompression, but because some bitmaps are stored in vertical lines instead of the regular horizontal lines. This is probably done to get optimal byte-runs.

Naming for fully decompressed resource files:
Code: [Select]
Misc variables  PRE -> RES
3d shapes       P3S -> 3SH
Bitmap images   PVS -> VSH
Icons(?)        PES -> ESH

Example:
Code: [Select]
stunpack stuntsdir/GAME1.P3S stuntsdir/GAME1.3SH
ren stuntsdir/GAME1.P3S stuntsdir/_GAME.P3S

Now we can start dissecting the actual data stored in the resource files. I tried making a new car by using the existing shape "TRUK" found in GAME2.P3S.
It works, but the mesh will be corrupted as there's no dynamic wheels to transform.

(http://surr.no/pub/2008-03-18-Stunts_Truck_1_tn.png) (http://surr.no/pub/2008-03-18-Stunts_Truck_1.png) (http://surr.no/pub/2008-03-18-Stunts_Truck_2_tn.png) (http://surr.no/pub/2008-03-18-Stunts_Truck_2.png)
Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
Post by: Chulk on March 18, 2008, 03:50:32 AM
Now we can start dissecting the actual data stored in the resource files. I tried making a new car by using the existing shape "TRUK" found in GAME2.P3S.
It works, but the mesh will be corrupted as there's no dynamic wheels to transform.

(http://surr.no/pub/2008-03-18-Stunts_Truck_1_tn.png) (http://surr.no/pub/2008-03-18-Stunts_Truck_1.png) (http://surr.no/pub/2008-03-18-Stunts_Truck_2_tn.png) (http://surr.no/pub/2008-03-18-Stunts_Truck_2.png)
Does it mean we can race with the truck on the starting line?!   :o
Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
Post by: zaqrack on March 18, 2008, 06:38:41 AM

(http://surr.no/pub/2008-03-18-Stunts_Truck_1_tn.png) (http://surr.no/pub/2008-03-18-Stunts_Truck_1.png) (http://surr.no/pub/2008-03-18-Stunts_Truck_2_tn.png) (http://surr.no/pub/2008-03-18-Stunts_Truck_2.png)

Oh boy,oh boy oh boy, how I longed to see such a picture! You are doing an incredible job!
Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
Post by: zaqrack on March 18, 2008, 07:01:16 AM
I have decompressed the same GAME2 file under linux, and checked the contents. It looks promising, looks like every single obstacle and track element can be identified. It seems you can also race with a boat, or let's say - a windmill. This already provides a lot of fun, if we can create an editor and at least edit these stored pictures (adding new elements would be great, but probably unaccepted by the game engine I guess), it could be endless fun :)

Meanwhile I propose we could create a fully uncompressed copy of Stunts to make work easier. 

edit: linux executable of current version is attached, it may be help for some...
Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
Post by: Krys TOFF on March 18, 2008, 08:53:00 AM
OMG ! Awesome job ! You're doing great Dstien !!!
Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
Post by: Duplode on March 18, 2008, 04:51:39 PM
Quoting Zak, that is the news-of-the-year, period!! :o
Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
Post by: Duplode on March 21, 2008, 01:58:55 AM
Dstien, my dear namesake  :), or Zak, please enlighten me: I succeeded to unpack GAME2.P3S under Linux and to open it under Vim in hex-mode... but how one can tell what parts of the file are a "TRUK" shape, or a "BARN" or an "ELRD"?
Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
Post by: dstien on March 24, 2008, 12:45:52 AM
Dstien, my dear namesake  :), or Zak, please enlighten me: I succeeded to unpack GAME2.P3S under Linux and to open it under Vim in hex-mode... but how one can tell what parts of the file are a "TRUK" shape, or a "BARN" or an "ELRD"?

As discussed earlier (http://forum.stunts.hu/index.php?topic=1137.msg34592#msg34592), all game files have a common structure for storing multiple resources. For each id name there's a 4-byte offset into the data section of the file. At offset 0x04 is the number of resources, next is the list of id names at offset 0x06. Each id is four bytes, so the following list of offsets is located at 0x06 + numRes * 4. The corresponding data offsets are 4-byte integers, ending at 0x06 + numRes * 4 + numRes * 4, which is the base offset for the data section.

To locate a shape first find its index in the list of ids. "truk" is the 40th resource in GAME2.3SH. The shape's data offset is thus the 40th entry in the offset list. Add this value to the base data offset and you'll have the position of the 3d shape.

0000000: 6c85 0000 3b00 6261 726e 626f 6174 6272  l...;.barnboatbr  <- Number of resources
0000010: 6964 6361 6374 636c 6431 636c 6432 636c  idcactcld1cld2cl
0000020: 6433 656c 7264 656c 7370 6578 7030 6578  d3elrdelspexp0ex
0000030: 7031 6578 7032 6578 7033 666c 6167 6761  p1exp2exp3flagga
0000040: 7373 676f 7569 676f 756f 676f 7570 6869  ssgouigouogouphi
0000050: 6731 6869 6732 6869 6733 6869 6768 6c61  g1hig2hig3highla
0000060: 6b63 6c61 6b65 6c63 6f30 6c63 6f31 7061  kclakelco0lco1pa
0000070: 6c6d 7261 6d70 7263 6f30 7263 6f31 7264  lmramprco0rco1rd
0000080: 7570 7265 7374 7365 6c72 7365 7374 7369  uprestselrsestsi
0000090: 676c 7369 6772 7372 616d 7465 6e6e 7472  glsigrsramtenntr
00000a0: 6565 7472 756b 7769 6e64 7a62 616e 7a62  eetrukwindzbanzb  <- "truk" at index 39
00000b0: 6f61 7a62 7269 7a62 726e 7a65 6c72 7a65  oazbrizbrnzelrze
00000c0: 7370 7a67 6173 7a6c 636f 7a70 616c 7a72  spzgaszlcozpalzr
00000d0: 616d 7a72 636f 7a72 6475 7a72 6573 7a73  amzrcozrduzreszs
00000e0: 6572 7a73 6573 7a73 7261 7a74 656e 7a77  erzseszsraztenzw
00000f0: 696e 0000 0000 ec01 0000 9e06 0000 a208  in..............  <- End of id name list, start of offset list
0000100: 0000 480d 0000 840e 0000 4a0f 0000 ee10  ..H.......J.....
0000110: 0000 f012 0000 3e14 0000 7e14 0000 be14  ......>...~.....
0000120: 0000 0215 0000 5a15 0000 0016 0000 4a1b  ......Z.......J.
0000130: 0000 b01b 0000 f41b 0000 3a1c 0000 6a1c  ..........:...j.
0000140: 0000 9a1c 0000 ca1c 0000 fa1c 0000 261d  ..............&.
0000150: 0000 541d 0000 5829 0000 702a 0000 e02c  ..T...X)..p*...,
0000160: 0000 982e 0000 9c3a 0000 b43b 0000 423e  .......:...;..B>
0000170: 0000 1844 0000 ba45 0000 884d 0000 ee4e  ...D...E...M...N
0000180: 0000 5450 0000 0052 0000 1e53 0000 1e54  ..TP...R...S...T  <- truk's data offset at index 39
0000190: 0000 4e59 0000 9a62 0000 ba63 0000 aa66  ..NY...b...c...f
00001a0: 0000 c467 0000 e468 0000 fc69 0000 606a  ...g...h...i..`j
00001b0: 0000 826d 0000 7871 0000 fa72 0000 c873  ...m..xq...r...s
00001c0: 0000 be77 0000 3479 0000 9a7b 0000 e27c  ...w..4y...{...|
00001d0: 0000 a07f 0000 6280 0000 ce80 0000        ......b.......   <- End of offset list, base data offset
[...]                                                                  truk's content is at 0x01DE + 0x541E = 0x55FC


Now we know where truk's data starts, but not where it ends as we don't know how to parse the 3d shape data yet. To find the end just use the start offset of the next resource.
Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
Post by: Duplode on March 24, 2008, 03:03:30 AM
Oh well, I hadn't really understood the *.RES structure description the first time - now it's crystal clear... thanks!
Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
Post by: Duplode on March 24, 2008, 05:46:55 AM
After toying a bit with those offsets for track elements in GAME1.3SH, I noticed a few simple facts:

Summing it all up: Krys, it's time for some hard coded illusion tracks! :D
 
Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
Post by: zaqrack on March 24, 2008, 08:14:34 AM

get away from me, evil! :) :) :)
Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
Post by: BonzaiJoe on March 24, 2008, 11:25:53 AM
Oh dear, this is so funny & great :)
Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
Post by: Krys TOFF on March 25, 2008, 12:07:23 PM
Marvelous ! Thanks again dstien for your hard work.
Zak : you're pure evil, the kind of evil I like. ;D
Duplode : I'm not sure I'd like to create track this way, except somebody modify trackblaster to allow it. I'm not a specialist of hex-editing.
Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
Post by: CTG on March 25, 2008, 01:57:04 PM
Pure Stunts fits me better. And I also think solving these codes can lead to serious game manipulations - having a fatal effect on the competitions.

Nice work but really dangerous.
Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
Post by: zaqrack on March 25, 2008, 02:30:50 PM
Look, there are almost no new pipsqueaks. Those who I play with since years can almost all be trusted, and those who are new are probably new to the game as well, and don't know how to make these modifications.
Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
Post by: CTG on March 25, 2008, 05:55:43 PM
Partly right... what about Dstein? He's a newbie and he broke the code. :D

Paranoid mode OFF.
Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
Post by: dstien on March 25, 2008, 07:41:30 PM
I don't see how reversing visual game assets - bitmaps and 3d shapes - is a threat to racing competitions. The information about car tunings, replays, high scores and tracks have been available for quite a while. From my experience with other game communities I've noticed that there's a distinct correlation between the urge to claim deceitful achievements beyond one's capabilities and sub-average intelligence.

My motivation for doing this is that I want to make new cars from scratch. Reversing is fun as well.
Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
Post by: CTG on March 25, 2008, 07:53:43 PM
Sub-average intelligence, lol... How do you explain my... okay, I'm not unmodest.
Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
Post by: zaqrack on March 25, 2008, 08:16:18 PM
I've noticed that there's a distinct correlation between the urge to claim deceitful achievements beyond one's capabilities and sub-average intelligence.
LOL, good point. Intelligence can be substituted with supressed depression/agression as well :)

My motivation for doing this is that I want to make new cars from scratch. Reversing is fun as well.
Just keep on the good work. You're something like a messiah for the community :)
Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
Post by: BonzaiJoe on March 25, 2008, 08:37:09 PM
Please don't mind CTG... I don't think he was being serious, and you'll find that in a strange way, even when he is serious, he isn't that serious :)

I'm very excited about these new finds, and I don't believe they are threatening to the competition at all.
Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
Post by: Duplode on March 26, 2008, 04:15:30 AM
Breaking news:

(http://i49.photobucket.com/albums/f283/Duplode/load_003.png)

Today I managed to find some bits of useful info about ST*.3SH (car shapes) file structure in the search of an ultimate goal, which as you can see was achieved: Car palette edition is now perfectly viable! 8) I'll try to condense the results in a readable way.

Each car has seven resources accessed via the offset list: car0...2 and exp0...3 . car0 draws the (more detailed) car shape seen in the selection menu; car1 holds the normal on-track shape and car2 is the low-res distant shape (similar to the tunn/ztun situation I mentioned a few posts above). The three shapes are fully independent. As for the exp's they're much smaller in size (a fact that originally led me to believe colour data was stored there, which is not true) and they purposes aren't so clear - one thing, though, one of them controls for sure are the bits of debris that fly after a crash...

Considering now the structure of the car_ resources, body panels are drawn independently from each other (that probably means it's all rectangles!). That conclusion was quickly reached when I located the first actual colour-changing byte, which turned the (front) trunk of the blue Countach golden... thankfully, it seems the vector data for each panel is stored just beside the colour bytes, and so it was also possible to selectively skew that boot coordinates (no clue about coordinates yet, though).

Going into the specifics of the colours, each panel has all seven available colours stored on a seven-byte string, indexed to the game's internal palette. While this makes fine-tuning possibilities endless (bi-colour cars!!), it also might make colour changes a headache if one lacks a good hex editor (I'm comfortable with KHexEdt, under Linux obviously) - even more because the number of panels and resource lengths vary from car to car. Fortunately, at least if one is interested in whole-car changes, patterns for the default colour sets are easy to recognize. I employed in my tests Countach and P962, which share the colour set, plus NSX, which shares the first three colours. Since default colour byte values are in ASCII range, a very easy way to spot them was provided by my editor "Extract strings" function, which selectively locates printable character strings. All that was needed was to look for 7-character/byte strings which appeared a lot of times through the file. Results are surprisingly unambiguous - for the Countach there are four closely related 7-char strings that appear a grand total of 176 times through the file:

Code: [Select]
33 37 3f 43 47 4b 4f
32 36 3e 42 46 4a 4e
31 35 3d 41 45 49 4d
30 34 3c 40 44 48 4c

Looking at those strings byte chart above, columns correspond to each colour available, while each line/string is associated to a particular shade of the main colour (33 37... are the lightest tones and 30 34... the darker ones). Thus, swapping colours between existing cars requires merely identifying the correct strings and replacing them adequately. The golden Countach had the body colour strings swapped with the NSX ones. Although I haven't tested yet, minor colours such as windows, headlights and stuff seem to be handled the same way (the non-body panel 7-char strings are all repetitions of a same value, indicating they do not change with the car colour). The logical next question is whether we can insert new colours... the answer is a shiny yes, with only two caveats: first, we're restricted to Stunts' colour palette (values seem to range from 01 to 81 in hex, including a rather large number of duplicates); and second, we need to identify properly all available colours in Stunts palette , so we can choose light and dark tones properly.

Now we have a nice customization feature to toy with our cars and, perhaps more importantly, colour strings may be of great help in identifying body panels in the vast arrays of bytes in those .3SH files once we tabulate the colour palette. Customizing car colours was something I would really love to be able to do, and now it is possible... thanks to dstien's insight: Zak chose a good metaphor describing your role here as messianic  :). I leave you with my custom STCOUN.3SH attached and a screenshot to show how the golden Countach looks damn cool in-game - considering an order, Zak?  ;)

(http://i49.photobucket.com/albums/f283/Duplode/load_004.png)

Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
Post by: BonzaiJoe on March 26, 2008, 10:59:09 AM
Well done!

This is the greatest game-alteration since Mark Nailwood. Keep it up!

The moment there is a black car, I will stop racing red cars...
Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
Post by: zaqrack on March 26, 2008, 11:31:32 AM
I'm in for a golden countach of course! :)
Let's take it a step further: The winner of the season gets a special golden Countach :) Or more than that, on each track, the winner earns the right to receive a special coloured car's P3S, and use it in races. Too bad it'd only appear in that colour on his computer, but it could be a fun idea anyway. :) And it's not that hard to write a tool similar to Car Blaster which allows us to change a car's color entirely (colouring only some parts could be more complicated because of the different shape of the cars).

As far as I know, Stunts uses a 64 colour palette. But I may be wrong.

 
Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
Post by: Krys TOFF on March 26, 2008, 01:08:36 PM
Wow, wow, wow ! I want a yellow version of EVERY car ! ;D Not gold, yellow. And black too if possible. Best would be a black and yellow car, like good-old-Senna-days in Lotus F1 team.
Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
Post by: Chulk on March 26, 2008, 08:15:57 PM
Great job Duplode! And of course a huge Thanks to Dstein for making all this possible! By the way, I'd love to have a Silver version of every car, but specially Indy as it would look as McLaren...
Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
Post by: dstien on March 26, 2008, 10:46:42 PM
Nice find, Duplode! According to my current understanding of the mesh structure, the number of color variations is a part of the header:

Code: [Select]
struct SHAPE {
    BYTE numVertices;
    BYTE numPolygons;
    BYTE numPalettes;

    [...] // Vertices and other unknown data?

    POLYGON polygons[numPolygons]
};

struct POLYGON {
    WORD numIndices;
    BYTE colors[numPalettes];
    BYTE indices[numIndices];
};

This means that the number of palettes isn't fixed. We can use the simple exp_ shapes to verify these assumptions:

(http://surr.no/pub/2008-03-26-Stunts_Explosion_shapes_tn.png) (http://surr.no/pub/2008-03-26-Stunts_Explosion_shapes.png)

There are four explosion shapes, they all have one polygon, so the number of vertices per polygon appears to be variable. For STCOUN.3SH, exp0 and exp3 are quads with the default color and a darker shade. exp1 is a triangle with the default color and exp2 is a single black line.

While this makes fine-tuning possibilities endless (bi-colour cars!!), it also might make colour changes a headache if one lacks a good hex editor (I'm comfortable with KHexEdt, under Linux obviously) - even more because the number of panels and resource lengths vary from car to car.

Yes, the field of free hex editors is a sad state of affairs. It looks like Okteta (http://frinring.wordpress.com/category/okteta/) will replace the unmaintained KHexEdit in KDE4. I tend to use shareware Windows hex editors under Wine to get advanced features such as scripting and data structure templates. :-\

CTG - My comment was aimed at cheaters, I'm sorry if I offended anyone here.

Edit: Added polygon struct pseudo code.
Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
Post by: Duplode on March 27, 2008, 06:37:41 AM
Or more than that, on each track, the winner earns the right to receive a special coloured car's P3S, and use it in races. Too bad it'd only appear in that colour on his computer, but it could be a fun idea anyway. :)

That would be a nice distinction, particularly if we get to construct spectacular-looking colour combos...

Wow, wow, wow ! I want a yellow version of EVERY car ! ;D Not gold, yellow.

Just replace yellow with purple for me! ;D

Best would be a black and yellow car, like good-old-Senna-days in Lotus F1 team.

By the way, I'd love to have a Silver version of every car, but specially Indy as it would look as McLaren...

Well, after we can identify polygons properly I do think we can make awesome black/golden JPS Special Lotuses and Silver/Red Vodafone Mclarens... ;)

[/quote]
Nice find, Duplode! According to my current understanding of the mesh structure, the number of color variations is a part of the header:

Code: [Select]
struct SHAPE {
    BYTE numVertices;
    BYTE numPolygons;
    BYTE numPalettes;

    [...] // Vertices and other unknown data?

    POLYGON polygons[numPolygons]
};

struct POLYGON {
    WORD numIndices;
    BYTE colors[numPalettes];
    BYTE indices[numIndices];
};

This means that the number of palettes isn't fixed. We can use the simple exp_ shapes to verify these assumptions:

There are four explosion shapes, they all have one polygon, so the number of vertices per polygon appears to be variable. For STCOUN.3SH, exp0 and exp3 are quads with the default color and a darker shade. exp1 is a triangle with the default color and exp2 is a single black line.

After wondering for a while and reading Wikipedia in order to visualize polygons and vertexes properly (never worked with 3D graphics before), I understood your pseudocode and saw it working on the Countach front trunk panel (colour codes at 0x09aa). It's quite cool, really  :). But there is non standard stuff as well... I had most of my experiments today with wheel "polygons" (On the Countach, the range is from 0x096c to 0x09a7). There are four so-called-polygons, one for each wheel, with appropriate colour strings and vertex indices. However, behaviour is very different: first of all, setting a byte colour, say, at 0x26 automatically sets all three tyre/wheel colours - tyre  front as 0x26, tyre lateral as 0x27 and the wheel itself as 0x28. Moreover, the word "numIndices" is 0x0c, but there are only six indices to edit... and if you try to deform a tyre by extending it in one direction the wheel will be suitably adjusted and a second distortion, symmetrical in relation to the origin vertex, will take place as well. Thus, there is *something* else involved in wheel drawing. Anyway, understanding the graphics does not seem so distant a goal now  :).

BTW, FYI, counting printable-byte colour strings reveals we have (a few more than) 223 polygons in STCOUN.3SH. Of those 223, 148 are in car0 and 66 in car1...

And before I go to bed: the fact the wheels load three colours simultaneously actually proved helpful: it made obtaining the full colour palette much easier! There really are 130 "colours" (0x01 to 0x80). The quotation marks are due not only to the high number of repetitions or very similar shades but also for some of those colours actually are the semi-transparent ground textures from loops and bridges! Anyway, I attached a very sloppy (and sleepy!) spreadsheet chart which may serve as a rough guide for the time being...


Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
Post by: dstien on March 27, 2008, 11:26:28 AM
Moreover, the word "numIndices" is 0x0c, but there are only six indices to edit... and if you try to deform a tyre by extending it in one direction the wheel will be suitably adjusted and a second distortion, symmetrical in relation to the origin vertex, will take place as well. Thus, there is *something* else involved in wheel drawing.
Interesting. It sounds like numIndices can also be a code for using other polygon primitives, or an escape code for referencing previous polygons...

BTW, FYI, counting printable-byte colour strings reveals we have (a few more than) 223 polygons in STCOUN.3SH. Of those 223, 148 are in car0 and 66 in car1...
Remember that each resource is an independent entity. All shapes have their own SHAPE structure with header values, it seems to add up.

I attached a very sloppy (and sleepy!) spreadsheet chart which may serve as a rough guide for the time being...
Wow! Again, well done. It'll sure prove useful.
Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
Post by: Duplode on March 29, 2008, 03:54:56 AM
OK, now we're in a position to understand a good chunk of the structure. First of all, I'll quote dstein's pseudocode again for reference:

Code: [Select]
struct SHAPE {
    BYTE numVertices;
    BYTE numPolygons;
    BYTE numPalettes;

    [...] // Vertices and other unknown data?

    POLYGON polygons[numPolygons]
};

struct POLYGON {
    WORD numIndices;
    BYTE colors[numPalettes];
    BYTE indices[numIndices];
};
    I was able to do a few inferences from comparing car0 resources of Countach, NSX and Indy:

    So, if one can endure the wilderness of cold hex editing, making custom shapes is possible already  :) BTW, I did some research on whether this particular storage format could be linked to a deprecated graphics standard (which in turn might lead, with a lot of luck, to a proper editor), but found no clues.

    Now, to the beautification efforts!   ;D

    (http://i49.photobucket.com/albums/f283/Duplode/load_011.png)

    Vodafone McLaren Mercedes (early alpha) vs. pitch-dark Indy... The McLaren still is far from perfection (too much red using the standard colour distribution, in fact it looks almost pure red when looked from the side), but it already looks cool - and so do black cars! BTW Krys, I tried the John Player Special Lotus too, but it looked more strange than the McLaren with excessive golden panels, and thus is not really worth a shot until we identify the panels properly.

    (http://i49.photobucket.com/albums/f283/Duplode/load_013.png)

    British Racing Green vs. Danish girls' special edition... :) Notice the pink car is actually bi-colour: even very slight tonality differences make a large improvement in visuals.

    A very positive fact is that Indy has far fewer polygons than most other cars, and so creating all crazy team schemes we can might not be that hard. 8)[/list]
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: BonzaiJoe on March 29, 2008, 04:16:10 AM
    The black car has finally arrived after 17.3 years!!

    And nice of you to make a car for Lene :)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Krys TOFF on March 29, 2008, 08:21:38 AM
    Hail to the "D" guys : Dstien and Duplode !
    Raaaaaah, I love to be here to see this historical moment, keep up this awesome job guys. ;)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: zaqrack on March 29, 2008, 09:15:18 AM
    mmmmmmm, British Racing Green.... awesome
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Mark L. Rivers on March 29, 2008, 01:37:35 PM

    Really a fantastic job...  :) :) :)  Infinite thanks to Dstien and Duplode...
    Now I have only a favour to ask you, Duplode: would you like to paint "my" Speedgate XSD as I dreamt to see it since its creation...? You know... :)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: dstien on March 31, 2008, 04:52:46 AM
    It seems like we have the basic structure now:
    Code: [Select]
    struct SHAPE {
        BYTE numVertices;
        BYTE numPolygons;
        BYTE numPalettes;
        BYTE reserved; // Always == 0. Ignored.

        VERTEX vertices[numVertices];
        UNKNOWN unknowns[numPolygons];
        POLYGON polygons[numPolygons];

        BYTE padding[]; // -> EOF. Ignored.
    };

    struct VERTEX {
        WORD x;
        WORD y;
        WORD z;
    };

    struct UNKNOWN {
        BYTE data[8];
    };

    struct POLYGON {
        BYTE numIndices;
        BYTE depthIndex;
        BYTE colors[numPalettes];
        BYTE indices[numIndices == 0xC ? 6 : numIndices];
    };

    The value depthIndex in the POLYGON struct is used to override the game's depth clipping. The barn shape, for example, has details drawn on a plane at the exact same depth. Without setting custom depth-indices the details will flicker:
    (http://surr.no/pub/2008-03-31-Stunts_Depth-index_tn.png) (http://surr.no/pub/2008-03-31-Stunts_Depth-index.png)

    I don't think shapes stores animation data (windmill rotations, "Joe's" flashing sign). They may be hardcoded... :-\
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Duplode on March 31, 2008, 04:01:46 PM
    Hail to the "D" guys : Dstien and Duplode !
    Raaaaaah, I love to be here to see this historical moment, keep up this awesome job guys. ;)

    Haha, the "D" guys!! :D "The Daniels" could be even cooler, such a nice coincidence...


    Really a fantastic job...  :) :) :)  Infinite thanks to Dstien and Duplode...
    Now I have only a favour to ask you, Duplode: would you like to paint "my" Speedgate XSD as I dreamt to see it since its creation...? You know... :)

    Sure! Check your PMs ;)

    On a practical level, there are two useful ideas we should consider about colours:
    1. Creating different colour sets for Melange and other customs, so as to distinguish them from the base shapes.
    2. Releasing alternative colour sets for the original cars - perhaps in a package installable by a batch/shell script. Maybe we should start for the four default colours missing for each car plus some particularly good looking colours. Or, alternatively, implement Zak's idea of special colour sets as prizes  :) - and BTW again, I agree with BJ that black cars are a must and with Zak that those dark green look great - even more because it is not exactly the same colour of the grass...
    So, keep thinking on suggestions guys  ;)

    ----

    Back to hacking: I found several pieces of useful data during the weekend, and matching it with the additions dstien made to the basic structure I'd say we know 100% of the organization and ~70% of the functionality of .3SH shapes. I can't post details right now (I'm away from home, so editing data is unavailable), but anyway they say a picture is worth a thousand words, so...

    (http://i49.photobucket.com/albums/f283/Duplode/mapansxside.png)

    The picture you're seeing above was generated from the very STANSX.3SH file. I coded a (very crude) parser for the structure which saves in separated, human-readable ASCII tables coordinates, polygon indexes and colours for each structure (for a car, that's 21 different tables per run). Then I used the statistics/graphing programming language R (http://en.wikipedia.org/wiki/R_%28programming_language%29) to make a plot of vertex cooordinates, overlay the polygons according to the index table and write adequate labels. With the program compiled and the R script handy, the whole thing is fully automated. I attached a very-high resolution pdf of the same picture, so you can explore it better. Black numbers are vertex labels (ranging from 0 to numVertexes-1 in hex) and blue numbers are polygons (ranging from 1 to numPolygons, in hex as well). The labels were printed at a slight offset from the vertex position/polygon center, so that labels for stuff at the right side of the car is at the right of the vertex/polygon, and vice-versa. 

    Now there's a way around the first big obstacle to editing the files - identifying vertexes and polygons... 8) I will return later and post the program, scripts and further details. See you!
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Krys TOFF on March 31, 2008, 05:06:36 PM
    Quote from: Duplode
    Sure! Check your PMs ;)
    Hey, I want to try a black speedgate too. ;D

    Quote from: Duplode
    a picture is worth a thousand words, so...
    (http://i49.photobucket.com/albums/f283/Duplode/mapansxside.png)
    OMG ! :o Awesome !
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: dstien on March 31, 2008, 07:20:08 PM
    Yup, visualization did the trick. Now we can see how the wheels are built.

    (http://surr.no/pub/2008-03-31-Stunts_Shapes.png)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Krys TOFF on March 31, 2008, 07:28:42 PM
    We really need a tool to create new 3D shapes now. ;D
    this way, we will be able to create 1 shape for each tuned car, including those already created, and identify clearly which cars are original and which are tuned ones. Whaooooh !
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: dstien on March 31, 2008, 10:58:27 PM
    Another special case of numIndices is the value 11 (0x0B), it takes two vertex indices to make a sphere (origin + radius). It's used to render the helmet on the Indy shape in the car selection screen:

    (http://surr.no/pub/2008-03-31-Stunts_Indy_helmet.png)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Duplode on April 01, 2008, 03:31:52 AM
    The follow-up to my last post...
    First of all, a zip of stuxplic (for Stunts explicit...) with source code and binaries attached. The code was done hastily and is pretty inelegant and rough at this version (dstien will find specially amusing the fact it is written in Fortran...), but it works AFAIK. Also attached is the .R script used to plot that polygon map, if anyone has R ans is willing to try it (in that case, tell me if you get confused).

    The first observation I would have to mention were some errors in my previous accounting of bytes, most important of which is vertex list starting at the 5th byte of resource block (and not at 9th as previously implied). Dstien has already corrected my accounting in his latest version of the structure. Such offsets caused me quite some trouble while writing the parser, since the effect of a mistake of +-2 or +-4 byte is surprisingly subtle (e.g. the assymetric distortions on the meshes posted three posts above by dstien).  Also, the shift in byte frame means the vertex coordinates are ordered [y,z,x] if we take the usual convention of x = length, y = width and z = height. Anyway, the new info means both our posts and my program are correct now...

    (And before I forget, nice find about the helmet, when we find what escape code produces the circular taillights it will be a neat addition.)

    Those corrections mean that now we only have the mysterious "UNKNOWN" middle section to understand. Actually, I did some brute force tests while writing the parser (e.g. blanking the whole thing), and it seems that the "UNKNOWN" section has actually two parts, one with five-byte blocks and the other with three-byte blocks. The first part might have some relation with angles of visualization - for instance, wheels have "ff ff ff ff ff" sequences, and blanking some (don't remember which) values will make them disappear, while arbitrary changes might make them go on and off as the car0 structure rotates in the selection screen. As for the second part, still no clue on what it stores.

    Now, on where we go from now... first thing I wish to do is to print better polygon maps, so it is feasible freely colorize a car. Also, I wonder about editors. One of the motivations behind the creation of the ASCII parser was to use it as an intermediate tool for feasible edition. I can think of two routes:


    For the moment, though, I'm merely speculating. Surely dstein knows a lot more about 3D shape edition than me (for I would have found nothing without his guidance), and is a more experienced programmer as well (he doesn't have to write his parsers in Fortran  :)), so he can have a more proper opinion in that respect.

    And to close in a lighthearted note I leave you with an actual on-track Black Indy pic... but this time the actual loaded texture was car0. Now only if we could play at such resolutions... ;D

    (http://i49.photobucket.com/albums/f283/Duplode/load_016.png)

    Edit: Windows zip attached as well.
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: CTG on April 01, 2008, 08:54:10 AM
    I wish I could ever see a P962 IMSA with my NFS:PU Porsche 911 GT1 colors (black with red-yellow lines)... :D

    Those 3D shapes look very nice.
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: BonzaiJoe on April 01, 2008, 10:13:08 AM


    (http://i49.photobucket.com/albums/f283/Duplode/load_016.png)

    Beautiful!
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: dstien on April 04, 2008, 12:55:25 AM
    dstien will find specially amusing the fact it is written in Fortran...
    Hehe, I do find your choice of languages -- Fortran and R -- a little, um, esoteric. :)

    And before I forget, nice find about the helmet, when we find what escape code produces the circular taillights it will be a neat addition.
    Actually, there's no magic about the GTO's "round" taillights, they're just 6-sided polygons:

    (http://surr.no/pub/2008-04-04-Stunts_GTO_Taillights.png)

    Those corrections mean that now we only have the mysterious "UNKNOWN" middle section to understand. Actually, I did some brute force tests while writing the parser (e.g. blanking the whole thing), and it seems that the "UNKNOWN" section has actually two parts, one with five-byte blocks and the other with three-byte blocks. The first part might have some relation with angles of visualization - for instance, wheels have "ff ff ff ff ff" sequences, and blanking some (don't remember which) values will make them disappear, while arbitrary changes might make them go on and off as the car0 structure rotates in the selection screen. As for the second part, still no clue on what it stores.
    The first part does indeed appear to store values related to detail culling. I think the first list is 4 bytes per polygon, maybe max-distances? I'll have to dig deeper into this...

    Now, on where we go from now... first thing I wish to do is to print better polygon maps, so it is feasible freely colorize a car. Also, I wonder about editors. One of the motivations behind the creation of the ASCII parser was to use it as an intermediate tool for feasible edition. I can think of two routes:

    • Decompose the .3SH in tables of vertexes, colours, polygons and whatever else is needed, modify the intermediate as wished and re-package everything on a new .3SH with another program. That could be useful, for instance, in providing a comfortable way to tune colours without having to worry all the time about offsets - but more important would be the role of such process in the other treatment...
    • ...namely, use a new parser to convert the essentials (vertex and polygons at least) data in a format that can be read by an actual 3D editor, then use another program to rebuild the .3SH. While that may sound unfeasible at first, there's a damn simple and common 3D shape format that uses tables very similar to what we already have to code polygonal shapes: the .OBJ format (http://en.wikipedia.org/wiki/.OBJ).

    For the moment, though, I'm merely speculating. Surely dstein knows a lot more about 3D shape edition than me (for I would have found nothing without his guidance), and is a more experienced programmer as well (he doesn't have to write his parsers in Fortran  :)), so he can have a more proper opinion in that respect.
    I plan on making a resource editor with low-level editing and import/export of 3d mesh data...
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Paleke on April 04, 2008, 03:19:12 AM
    WOW! So much information so much above my understanding  ;D

    Anyway, good work!!!  ;D
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Duplode on April 05, 2008, 12:38:01 AM
    dstien will find specially amusing the fact it is written in Fortran...
    Hehe, I do find your choice of languages -- Fortran and R -- a little, um, esoteric. :)

     ;D That's due to my impromptu learning of programming due to academic needs (numerical calculus-intensive applications) while ago. Now I'm finally in the process of leaning some Java, but still a newbie nonetheless  :)

    I plan on making a resource editor with low-level editing and import/export of 3d mesh data...

    That would be magnificent... you may be sure beta testers won't be lacking! :)

    BTW, before I forget, dstein: are you reading the colour data while generating that shape pics for the file from somewhere?

    Now another teaser for you guys:
    Krys mentioned creating new shapes for old custom cars. There is one, however, that we may not need to touch: there's nothing wrong with the Melange shape. Or, didn't you ever wondered why the Acura never really looked like an NSX?

    (http://i49.photobucket.com/albums/f283/Duplode/load_019.png)

    (http://i49.photobucket.com/albums/f283/Duplode/load_018.png)

    Since this one is ready-to-go already, I attached the .3SH. Enjoy!
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Krys TOFF on April 17, 2008, 12:17:35 PM
    Look at this video (http://it.youtube.com/watch?v=SThh5FjAlL4&feature=related) : in Tandy graphic mode the indy can be white.
    The Skid Vicious car seen twice (at around 30 seconds and also around 2 minutes and 30 seconds) in this video is definitively white !

    Is it a color not available in Tandy mode that is transformed into white, or is it that this guy modified the color of the cars (so it means he dissected the files too) ?
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Duplode on April 17, 2008, 03:08:46 PM
    Krys: The differences are most likely because palette definitions are encoded in the "device-specific" graphics files (TANDY.COD, TANDY.DIF or TANDY.HDR for instance). The colour indices we modify in the *.3SH are pointers to someplace in those files. Since Tandy and other graphical systems have a smaller range of colours available than MCGA, the pallet must be simplified accordingly. A quick run with pseudo-Tandy in DOSBox shows the colours of the cars are mostly the same, except the shadings are far less rich; and thus what we think of as a shiny silver Indy looks white under Tandy. Anyway, if we could understand and edit the hard-coded palettes, maybe it would be possible to pick unused values and add custom shades... that's far beyond my comprehension, however  :)

    BTW, that does not mean we can't have good looking (or at least as good looking as the Tandy one) white cars:

    (http://i49.photobucket.com/albums/f283/Duplode/load_026.png)

    This is an American Blue Corvette. One day it will evolve into the full-fledged design of white with Viper-like blue stripes all through the roof ... ;)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Krys TOFF on April 17, 2008, 03:56:22 PM
    I like bi-color Stunts shapes.
    Anyway, what was the interest of the file you attached in your message just before the last one ? It's just the Acura shape uncompressed ?
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Duplode on April 17, 2008, 03:58:47 PM
    It is, but with the roof painted in the body colour instead of glassy black, as it always should have been. Look at the pics above it... ;)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Krys TOFF on April 17, 2008, 04:05:58 PM
    Oh, I didn't pay attention. Thanks, I'll download this one.
    I've got to create a new Stunts directory with all car shapes tests that will come, or I will have problems with my replays in competition if I keep it all in my regular Stunts directory. ;D
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: dstien on April 18, 2008, 10:28:39 PM
    I've started working on a simple Stunts resource editor; stressed. Only plain text resources are supported right now, so MISC.PRE is probably the only file it can load. Compressed files are supported by re-using stunpack (as intended), but remember to change the file name (=> MISC.RES) when saving as encoding is not supported.

    (http://surr.no/pub/2008-04-18-Stunts_stressed.png)

    you may be sure beta testers won't be lacking! :)
    The code is available in a public repository. Google Code project hosting doesn't offer XML feeds of commits, but I'll post a message here when/if I add something exciting. In order to build it you'll need a SVN client and the QT4 dev package.

    Code: [Select]
    svn co http://stuntstools.googlecode.com/svn/trunk/stressed/ stressed
    cd stressed
    qmake stressed.pro
    make
    src/stressed /path/to/MISC.PRE

    I've only tested it under x86_64 Linux, altought that shouldn't really matter. It'll hopefully compile for Windows/Mac etc. as well using the GNU toolchain.

    BTW, before I forget, dstein: are you reading the colour data while generating that shape pics for the file from somewhere?
    The "colors" are in fact materials that can have simple textures. Locating and reversing this data structure would take longer than just making the list by hand. I took in-game screenshots and identified the color values...
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: dstien on April 19, 2008, 09:14:07 PM
    Added support for loading, displaying and writing bitmap resources. Only the unknown header values are editable at the moment, but stressed can now open all PSV files. Here's the VGA palette (http://stuntstools.googlecode.com/svn/trunk/stressed/resources/conf/defaults.conf) used.

    (http://surr.no/pub/2008-04-19-Stunts_stressed_bitmaps.png)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Krys TOFF on April 19, 2008, 10:45:45 PM
    WOW ! Nice tool. You're really good dstein, thanks for your work. :)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: dstien on April 20, 2008, 04:37:18 AM
    Just added bitmap import/export. When will we see the first custom dashboard? 8)

    (http://surr.no/pub/2008-04-20-Stunts_stressed_bitmaps.png)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Duplode on April 20, 2008, 04:42:19 AM
    OMG, what I'm doing right now under Windows?! I must setup SVN and try that stuff!!  :o
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: zaqrack on April 20, 2008, 08:47:59 AM
    wow, awesome!

    I remember I have translated the opponent description/winning/losing texts to Hungarian by hex editing 10 years ago, but this tool is way too cool. and I love the name. :)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Krys TOFF on April 20, 2008, 09:05:18 AM
    Just added bitmap import/export. When will we see the first custom dashboard? 8)

    (http://surr.no/pub/2008-04-20-Stunts_stressed_bitmaps.png)
    Is it you on the picture ?
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: CTG on April 20, 2008, 11:10:02 PM
    Silver Spirit logo is a kind of Stunts hack? I just checked it: text on the rear wings, colorful Indy... :D LOL, it's funny!
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Duplode on April 23, 2008, 06:10:31 AM
    Just to reinforce the message about this version of stressed:

    (http://i49.photobucket.com/albums/f283/Duplode/translmain.png)

    It works like a charm!
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: zaqrack on April 23, 2008, 10:18:56 AM
    Corrida! I love this. :)

    My recommendation: As stressed will probably soon result in an huge amount of different modifications made by the community, it should also contain later some kind of a "theme and resource switcher", where you can select the available mods from an internal database and load them into the stunts files before playing. Like we have 40 cars in the database, and with stressed-switcher you can select the 12 you want to use in the game, it renames/loads the resource files for you, and then you can start stunts :)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: zaqrack on April 23, 2008, 10:20:39 AM
    while playing noRH FTT yesterday I realized we only need one modification in the game code to eliminate RH: just need to make the "continue driving" menuitem disappear. Problem solved.  I know these parts of the game are pretty much hard-coded but maybe someday it will be also possible.
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Chulk on April 23, 2008, 07:26:38 PM
    We have news everyday on this topic! Great pic Duplode! And also great for Zak joining FTT!
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: dstien on April 25, 2008, 12:21:46 AM
    Is it you on the picture ?
    Hehe, I'm not that (http://en.wikipedia.org/wiki/Sid_Vicious) cool.

    It works like a charm!
    Swell, thanks for the feedback. I'll start working on shape support.

    My recommendation: As stressed will probably soon result in an huge amount of different modifications made by the community, it should also contain later some kind of a "theme and resource switcher", where you can select the available mods from an internal database and load them into the stunts files before playing. Like we have 40 cars in the database, and with stressed-switcher you can select the 12 you want to use in the game, it renames/loads the resource files for you, and then you can start stunts :)
    We tried to standardize the deployment of mods in the Midtown Madness 2 community to avoid incompatibilities. The problem was that nobody cared to make the effort of merely naming their file soup correctly as long they just got their mod loading...

    while playing noRH FTT yesterday I realized we only need one modification in the game code to eliminate RH: just need to make the "continue driving" menuitem disappear. Problem solved.
    I suppose this would only block yourself from unconsciously RH-ing? You'd still have to trust the other pipsqueaks?
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Duplode on April 25, 2008, 01:21:06 AM
    Is it you on the picture ?
    Hehe, I'm not that (http://en.wikipedia.org/wiki/Sid_Vicious) cool.

    Krys missed a rock reference?! No, that can't be!! ;D

    My recommendation: As stressed will probably soon result in an huge amount of different modifications made by the community, it should also contain later some kind of a "theme and resource switcher", where you can select the available mods from an internal database and load them into the stunts files before playing. Like we have 40 cars in the database, and with stressed-switcher you can select the 12 you want to use in the game, it renames/loads the resource files for you, and then you can start stunts :)
    We tried to standardize the deployment of mods in the Midtown Madness 2 community to avoid incompatibilities. The problem was that nobody cared to make the effort of merely naming their file soup correctly as long they just got their mod loading...

    Standardization is a good thing... Stunts file name system is so simple and pure, we need not complicate it with  :) Anyway, a nice smaller feature for the future on the direction Zak suggested might be a specific importer for colour data. (if there would be any real gain for making such a spin-off from the shape editor of course)

    while playing noRH FTT yesterday I realized we only need one modification in the game code to eliminate RH: just need to make the "continue driving" menuitem disappear. Problem solved.
    Zak probably meant killing the button code, which is probably too hard coded. And it would only eliminate Advanced RH, not "Save" RH...
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: BonzaiJoe on April 25, 2008, 03:51:29 PM
    It would also eliminate primitive RH... But if you say it's not possible, I believe you :)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Duplode on April 25, 2008, 06:15:35 PM
    It would also eliminate primitive RH... But if you say it's not possible, I believe you :)

    After seeing BJ's post I realize Zak was refering to the "Continue Driving" menu item, not to the "Continue Anyway" dialog box button. That would be very revoultionary indeed... and who knows, maybe we can break or switch off menu items by resource file manipulation... :)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Paleke on April 26, 2008, 02:32:58 AM
    I remember I talked about it with Cas some time ago. He said he could find a solution for this, not modifying Stunts original files. It was kind of tricky, and I don't know if I can explain his idea properly (so I won't try to) but I have to make the same coment I told him then (he also said this is posible): the replay file should be "marked" or "signed" to avoid cheats.
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Mark L. Rivers on April 26, 2008, 08:53:42 AM
    Well, I'm not so expert about all this materia, and maybe I didn't read all previous posts so accurately, but, about succeeding to made a "safe" NORH race only modifying Stunts internal code, I have two questions.

    1) If someone will succeed to "hide" or "cancel" the "continue driving" menuitem, how will it be anyway  possible to know if a *.RPL is made with a original Stunts version or a modified Stunts version?

    2) Assumpting that the modified Stunts version "writes" in the file *.RPL a character or a string, marking it in a way it could be identified (maybe with a new version of InfoRPL) as a replay made without RH, won't be possible for a expert coder, editing a file *.RPL made with RH, so to insert posteriorly the character or the string so to make it a file *.RPL that seems made without RH?

    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: dstien on April 28, 2008, 02:22:16 AM
    Shape support in stressed is shaping up. I've compiled a list of the shape materials (http://wiki.stunts.hu/index.php/Shape_materials), and the patterns seems to match the originals:

    (http://surr.no/pub/2008-04-27-Stunts_stressed_shapes.png)

    Also, here's how animation is done, it's just cycling through the paint jobs:

    (http://surr.no/pub/2008-04-27-Stunts_animation.gif)

    I have to do some more debugging before checking in the code...
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: zaqrack on April 28, 2008, 07:05:43 AM
    editing obstacles is very promising! We can substitute blovk houses with giant ramps and such :)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: CTG on April 28, 2008, 09:50:26 AM
    My problem with this editing thing is similar to church vs making clones. It's nice there are people able to change things in this game but I think the original one with all the silly bugs and mistakes is a perfect one for having fun.
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: BonzaiJoe on April 28, 2008, 10:08:56 AM
    Zak: good to see you're listening to Tiger Tunes :) a nice band from Århus.

    CTG: I don't think the original will be substituted. This is just for some variation when you're bored with the original. That does happen to me sometimes after 14 years...
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Duplode on April 28, 2008, 03:19:37 PM
    Wow, that 3D editor looks sweet!  :) I have a number of feature suggestions boiling in my head but I will leave them for later, after we actually get to play with the thing.

    My problem with this editing thing is similar to church vs making clones. It's nice there are people able to change things in this game but I think the original one with all the silly bugs and mistakes is a perfect one for having fun.

    CTG, that comment simply does not reflect what's going on. Bug "fixing" would require reverse engineering the sources, something that's not being attempted at all right now. The real point is, as BJ mentioned, adding diversity in cars, graphics and so on within the framework of Stunts gameplay. Besides, even if someone actually thought fixing the bugs was a good thing (something I disagree with as strongly as you), the reasonable approach would be to make a new game (à la Ultimate Stunts).So, stop being so pessimistic!  :P

    editing obstacles is very promising! We can substitute blovk houses with giant ramps and such :)


    The only problem is that it seems the physical model for the track elements is not stored toegether with the graphical model/3D shapes (so if you replace the highway 3D shape for the tunnel one you'll get a tunnel-looking highway, and not a proper tunnel). The physical model and material definition locations are the most important stuff we haven't located yet...
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: dstien on April 30, 2008, 01:23:43 AM
    stressed can now open and display shape resources. Only materials are editable, and saving is still highly experimental. The 3d view doesn't draw wheels and spheres yet. If you're editing GAME1.3SH the truck animation won't work because stressed rebuilds the vertex list, animation transformations are performed on fixed vertex indices. Also, the game may crash because Stunts' shape parser is very picky about the 1-3 last bytes of each shape resource. We'll have to solve this riddle first...

    To upgrade your local copy:
    Code: [Select]
    # Delete old config
    rm -f ~/.config/stuntstools/stressed.*

    make clean
    svn update
    make
    src/app/stressed &

    When you select a primitive in the first table, its vertices and materials will appear in the other two. The primitive in question will be highlighted in the 3d view. Use mouse buttons + move to control the 3d view. I have no idea how Duplode managed to make all those skins in a hex editor, but this approach will hopefully make it easier...

    (http://surr.no/pub/2008-04-30-Stunts_stressed_materials_tn.png) (http://surr.no/pub/2008-04-30-Stunts_stressed_materials.png)

    (http://surr.no/pub/2008-04-30-Stunts_materials_tn.png) (http://surr.no/pub/2008-04-30-Stunts_materials.png)

    My problem with this editing thing is similar to church vs making clones.
    Don't worry, installing game mods is voluntary. Unlike unborn clones, you actually have a choice. ;)

    Wow, that 3D editor looks sweet!  :) I have a number of feature suggestions boiling in my head but I will leave them for later, after we actually get to play with the thing.
    I have some ideas as well, but most tasks should be left to a real modelling tool. First priority right now is to fully understand the shape structure. :-\
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: BonzaiJoe on April 30, 2008, 08:44:19 PM
    I love the dark clouds!
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: dstien on April 30, 2008, 09:25:07 PM
    I love the dark clouds!
    Good catch! The clouds are in fact 3d shapes as well.
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Chulk on May 01, 2008, 01:14:44 AM
    Is there any way I can get that editor? I couldn't find it in this topic...
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Duplode on May 01, 2008, 06:19:10 AM
    I have no idea how Duplode managed to make all those skins in a hex editor, but this approach will hopefully make it easier...

    You may be sure indeed it will!! 8) For the umpteenth time, thanks... BTW, the most painful part is not actually making the changes, but reverting or tracing them back after a few days...

    I updated my SVN copy and played around on the editor a bit, but haven't tried to save and run shapes with modified materials created from stressed yet. Aside for the little quirks unimportant at this stage, the significant point I noticed was the "Unknown" data being stored as an 8-byte sequence - we had found there are (at least) two separate blocks of data in the Unknown region, with 4-byte sequences associated to each polygon. I'm trying to investigate those sections but the observations still make little sense to me.

    I have some ideas as well, but most tasks should be left to a real modelling tool. First priority right now is to fully understand the shape structure. :-\

    Well, of course you're absolutely right... Anyway, my suggestions settled down to three in the end: one of them was rather obvious and is already implemented and another depends on how you're planning to implement vertex list edition and import/exporting, so it is best left for later. The third one, however, is about materials: it would be nice if we could export an individual material list for each paint job on a shape to an external file and then import it later on, so that we can select and distribute paint jobs for custom colour sets easily. From another point of view, I would say the current functionality of stressed clears the two main complications of paint scheme design - namely, relying on my wonderfully confusing 2D maps for locating polygons and on the limited and often frustrating "Find/Replace/HexCalc" tool set to do anything at all. Having the ability to store individual paint jobs would solve the next complicating factor by providing easy means of backup and reloading, thus allowing for faster (and more fun) care-free testing.

    I love the dark clouds!

    That reminds me of something I always forget to look by myself: is the light blue sky rendered as a "3D" shape as well?

    Is there any way I can get that editor? I couldn't find it in this topic...

    You can get it, but not through the topic because it is in development and only available via dstien's project SVN "feed". Assuming you're under Windows, getting it will require some extra steps I'm not familiar with, so it's better to leave dstien to guide you... :)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Krys TOFF on May 01, 2008, 05:15:12 PM
    Such news in this thread while I was away for 1 week. Oh gosh, I love this thread ! :)

    We may also be able to change sky cube and background. what about a black sky and a moon-like background, with yellow sand instead of grass, and also a lunar gravity (huuuuuuuge jumps expected ! ;D :D)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: BonzaiJoe on May 01, 2008, 08:01:57 PM
    I think Stunts already has lunar gravity...  ::)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: dstien on May 06, 2008, 12:25:59 AM
    Aside for the little quirks unimportant at this stage, the significant point I noticed was the "Unknown" data being stored as an 8-byte sequence - we had found there are (at least) two separate blocks of data in the Unknown region, with 4-byte sequences associated to each polygon. I'm trying to investigate those sections but the observations still make little sense to me.
    I just needed a place to stash the values while testing. I've been away for a few days, but I have now checked in some updates (http://code.google.com/p/stuntstools/source/list). Unknowns are correctly parsed according to our current knowledge. Unknowns, depths and vertex co-ordinates are now editable for easy testing.

    At a second look it seems like Unknown1 holds a range of angles from where the primitive is visible, used for advanced culling. This is what makes a bridge polygon visible from all sides, while, for example, the tunnel ceiling is only visible from beneath.

    it would be nice if we could export an individual material list for each paint job on a shape to an external file and then import it later on, so that we can select and distribute paint jobs for custom colour sets easily.
    Hm, wouldn't it be easier to just swap 3SH files? Of course, patches are welcome. :)

    That reminds me of something I always forget to look by myself: is the light blue sky rendered as a "3D" shape as well?
    Not that I know of. :-\

    Is there any way I can get that editor? I couldn't find it in this topic...
    I'll try to whip up some Windows builds soon*.

    *) Definition of "soon" is subject to change.
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Duplode on May 06, 2008, 04:08:13 AM
    but I have now checked in some updates (http://code.google.com/p/stuntstools/source/list). Unknowns are correctly parsed according to our current knowledge. Unknowns, depths and vertex co-ordinates are now editable for easy testing.

    Great, great, great... my SVN directory will update itself as soon as I finish this post... :)

    At a second look it seems like Unknown1 holds a range of angles from where the primitive is visible, used for advanced culling. This is what makes a bridge polygon visible from all sides, while, for example, the tunnel ceiling is only visible from beneath.

    Yes, Unk1 definitively does some sort of "angular culling" (if my terminology is coherent, that is...). When you look at several values of both unknowns for faces of the same object, it's clear there must be a pattern depending on orientation of the faces, only that the actual pattern is not very obvious...
    I performed a couple experiments by replacing Indy shapes with tennis courts (so as to take advantage of the net, a very easy polygon to watch  ;D). Naming Cartesian axes as x = length, y = width and z = height, the first two bytes of Unk1 appear to control visibility depending on xz angle (so that objects may disappear when viewed from above - actually from over a certain vertical angle - with "wrong" values), and the last two bytes are related to xy angles (typical example is rotation at car selection screen). What is utter confusing is what sort of limits do those bytes impose... the only certain thing is FF FF grants full visibility and 00 00 gives no visibility (effectively making the polygon invisible, something shape editors could explore later on...). For the xy bytes at least, it seems also that each byte controls half of the possible viewing angles (a 180º range). I simply can't understand, however, why many values of the xy bytes result in far more than two visibility angle ranges (thus making polygons flicker a lot in the car selection screen, for instance), why widely separated values often give nearly the same effects, or why no matter what is done you get always the same viewing range with the xz bytes if their values are neither FF FF or 00 00 (at least from above, that is)...

    it would be nice if we could export an individual material list for each paint job on a shape to an external file and then import it later on, so that we can select and distribute paint jobs for custom colour sets easily.
    Hm, wouldn't it be easier to just swap 3SH files? Of course, patches are welcome. :)

    Well, I thought of three main reasons for inserting individual material lists into .3SH files:
    Of course, such commodities are likely not (and need not be) top priority issues for your stressed at the moment, and by the time such sort of stuff actually gets tackled my Java (Fortran? Err...no ;D) skills might be decent enough for building a reasonable tiny add-on. But the important is the idea gets registered  ;)

    To switch exploration areas for a brief while, I attempted to dissect a somewhat different file, TEDIT.RES . It basically consists on a list of icon pointers for the track editor interfaces mixed with some other related stuff. Maybe dstien has already looked into it, but anyway here go the main findings. The relevant resources are:

    And finally I'd like to close with some new pics - versions of some of my sample paint jobs overhauled with relative ease thanks to stressed... starting with Chulk's suggestion:

    (http://i49.photobucket.com/albums/f283/Duplode/load_031.png)

    Now it almost looks like the real thing, or at least what it would look like on Geoff Crammond's 1992 F1GP...  :)

    (http://i49.photobucket.com/albums/f283/Duplode/load_032.png)
    (http://i49.photobucket.com/albums/f283/Duplode/load_034.png)

    My American Racing Blue Corvette also benefited a lot from easier detail picking. With a couple small changes, it's a lot more refined now:

    (http://i49.photobucket.com/albums/f283/Duplode/load_035.png)
    (http://i49.photobucket.com/albums/f283/Duplode/load_036.png)

    (In case you're wondering, I do intend to release my custom .3SHs, it's just they aren't quite up to releasing standards yet  ;))
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Chulk on May 06, 2008, 06:29:41 AM
    And finally I'd like to close with some new pics - versions of some of my sample paint jobs overhauled with relative ease thanks to stressed... starting with Chulk's suggestion:

    (http://i49.photobucket.com/albums/f283/Duplode/load_031.png)

    Now it almost looks like the real thing, or at least what it would look like on Geoff Crammond's 1992 F1GP...  :)

    (http://i49.photobucket.com/albums/f283/Duplode/load_032.png)
    (http://i49.photobucket.com/albums/f283/Duplode/load_034.png)
    WOW!! That looks great man! THANKS!!!

    PS:
    I'll try to whip up some Windows builds soon*.

    *) Definition of "soon" is subject to change.
    :D :D :D :D
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: cody on May 07, 2008, 01:40:15 AM
    hmm, what format dose stressed inport/export out of?
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: dstien on May 07, 2008, 03:03:56 AM
    Duplode - Nice work! Speaking of materials, I just tried altering the number of paint-jobs. It turns out vehicles can have anywhere from 1 to 127 paint-jobs. In other words, the counter is a signed integer, but 127 should be sufficient. I've added a widget to stressed for setting the number of paint-jobs. Since altering this number can be destructive, you'll have to explicitly hit enter or move focus to another widget before the change takes effect.

    hmm, what format dose stressed inport/export out of?
    None yet, but it'll have to be a simple, text-based format with widespread adoption and support for n-gons. The biggest obstacle is how we should handle the limited amount of materials.
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: cody on May 07, 2008, 03:24:53 AM
    so no importing .3ds .obj .z3d or .max? dang, i was looking forward to building cars  :(  ive started on a few of them.
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Duplode on May 07, 2008, 03:48:35 AM
    so no importing .3ds .obj .z3d or .max? dang, i was looking forward to building cars  :(  ive started on a few of them.

    Well, thanks to dstien stressed is in active (and pretty fast, I'd say) development... so c'mon, don't be so let down and keep looking forward! ;)

    I've added a widget to stressed for setting the number of paint-jobs. Since altering this number can be destructive, you'll have to explicitly hit enter or move focus to another widget before the change takes effect.

    So the changes are staring to get bigger... 8)

    None yet, but it'll have to be a simple, text-based format with widespread adoption and support for n-gons. The biggest obstacle is how we should handle the limited amount of materials.

    Back in the very early stages of hacking I grabbed the *.OBJ format definiton from Wikipedia and used my stuxplic parser to make *.OBJs from vertex lists. The main issue was all 3D editors I could find either started screaming about the n-gons (Blender...) or automatically converted the mesh to all-triangles (obviously an horrible solution for our case). As for the colours, maybe the easiest way out, at least for the initial versions, could be exporting only the vertex list and letting stressed handle the materials on its own.

    And thank you all for the appreciations... :)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: dstien on May 09, 2008, 12:47:08 AM
    Added the ability to manually edit primitives. Right-click on the primitives table to add/remove rows. This makes it possible to create simple debug shapes by hand.

    (http://surr.no/pub/2008-05-09-Stunts_stressed_custom_shape_tn.png) (http://surr.no/pub/2008-05-09-Stunts_stressed_custom_shape.png)

    (http://surr.no/pub/2008-05-09-Stunts_custom_shape_tn.png) (http://surr.no/pub/2008-05-09-Stunts_custom_shape.png)

    Next up is import/export...
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: CTG on May 09, 2008, 05:52:41 AM
    In spite of the fact it is a Boxcar, the acceleration is damned good! ;D
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Duplode on May 09, 2008, 06:01:53 AM
    In spite of the fact it is a Boxcar, the acceleration is damned good! ;D

    That reminded me of "Lego Räcers"... ;D
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: cody on May 10, 2008, 06:32:38 AM
    i cant wait for .obj inport/export support since well, ive started on a few. i'll be able to do more work for stunts once i finalize a carpack i made for another game called flatout 2
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Krys TOFF on May 10, 2008, 08:49:42 AM
    i cant wait for .obj inport/export support since well, ive started on a few. i'll be able to do more work for stunts once i finalize a carpack i made for another game called flatout 2
    Cool. ;)
    Also, I like Flatout mini-games. ;D
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: cody on May 10, 2008, 07:30:01 PM
    Also, I like Flatout mini-games. ;D

    who doesn't  ;D
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: dstien on May 13, 2008, 04:53:25 AM
    I gave the OBJ format a shot, and I think it suit our needs just right. Materials are stored in an external file (http://stuntstools.googlecode.com/svn/trunk/stressed/resources/shape/materials.mtl) with fixed names in the range of Stunts000 - Stunts255. Just import these materials into your modeller. When exporting a shape from stressed the currently selected paint-job will be used. Sources are available as usual. It has only been tested against Blender's OBJ loader/writer...

    Here are some screenshots from a fully drivable "truk" shape, slightly modified. The 3SH file with two paint-jobs is attached to this post.

    (http://surr.no/pub/2008-05-13-Stunts_truck_blender_tn.png) (http://surr.no/pub/2008-05-13-Stunts_truck_blender.png)

    (http://surr.no/pub/2008-05-13-Stunts_truck_stressed_tn.png) (http://surr.no/pub/2008-05-13-Stunts_truck_stressed.png)

    (http://surr.no/pub/2008-05-13-Stunts_truck_1_tn.png) (http://surr.no/pub/2008-05-13-Stunts_truck_1.png)

    (http://surr.no/pub/2008-05-13-Stunts_truck_2_tn.png) (http://surr.no/pub/2008-05-13-Stunts_truck_2.png)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Krys TOFF on May 13, 2008, 10:33:50 AM
    Once again, a very good job from you Dstien. Well done and thanks for what you do. I'll test the truck shape. But what about parameters of the truck ? It seems you used the truck shape on the indy according to the power curve of this picture :
    (http://surr.no/pub/2008-05-13-Stunts_truck_1_tn.png) (http://surr.no/pub/2008-05-13-Stunts_truck_1_tn.png)

    Same for the boxcar :
    (http://surr.no/pub/2008-05-09-Stunts_custom_shape_tn.png) (http://surr.no/pub/2008-05-09-Stunts_custom_shape.png)

    I like the big rear wheels of the boxcar anyway. ;)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Duplode on May 13, 2008, 03:20:07 PM
    But what about parameters of the truck ?

    On what are you thinking Krys, a LM002 with quadruple weight, doubled torque curve and super tall gear ratios? :D

    Fantastic work Dstien, I'll give it a try later on... the only doubt I want to check is whether Blender still decomposes n-gons into triangles for n>4.
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Mark L. Rivers on May 13, 2008, 05:46:14 PM

    Really a good job, indeed!  :)

    And now, kidding: does Truck pass under the bridge...?  :D
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: dstien on May 13, 2008, 07:06:27 PM
    But what about parameters of the truck ?
    I tend to use the Indy setup when testing. I'll leave the tuning job to someone more competent in that field. ;)

    the only doubt I want to check is whether Blender still decomposes n-gons into triangles for n>4.
    Blender has an internal primitive, "fgon", for storing composite faces. I don't know if it's accessible through the Python API, the OBJ importer will create them, but the exporter can't read them... I'll have to investigate it further.

    does Truck pass under the bridge...?  :D
    Yes, and it can jump half-way through the ceiling in tunnels. It's an interesting question because we don't know how custom vehicle collision is handled, or if it's even possible to modify.
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Duplode on May 14, 2008, 06:08:29 AM
    If you disregard the fact I do not really know how to use Blender, the .OBJ exporting seems to be working fine. And just now I realized the inclusion of the material exporting/importing on the .OBJs covers my suggestion of individual paint job manipulation... 8) Anyway, I forgot to mention a possible bug I'm having with stressed since I updated to the May 08 revision. On startup, stressed prints on the console the following for the whole 256-colour palette:

    Code: [Select]
    QColor::setNamedColor: Unknown color name '000000'
    QColor::setNamedColor: Unknown color name '0000A8'
    QColor::setNamedColor: Unknown color name '00A800'
    // ...

    And then, as a natural consequence, polygons, bitmaps and colour labels are not painted properly on stressed, but are just displayed all in black. I wonder if it could not a bug, but my system/Qt's fault... in that case, is there anything I should look for?
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: dstien on May 14, 2008, 11:24:13 AM
    And then, as a natural consequence, polygons, bitmaps and colour labels are not painted properly on stressed, but are just displayed all in black. I wonder if it could not a bug, but my system/Qt's fault... in that case, is there anything I should look for?
    Materials are stored in a config file, and since the program is in active development the default settings are changed frequently. When upgrading you should delete the old one (~/.config/stuntstools/stressed.conf) to force re-generation.
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Paleke on May 15, 2008, 12:47:19 AM
    But what about parameters of the truck ?
    I tend to use the Indy setup when testing. I'll leave the tuning job to someone more competent in that field. ;)

    I think that would be me, but there are two problems (maybe three, I haven't tested the truck yet):

    1- I'm not sure how to edit the dashboard to make it look like a truck.

    2- I was never good at editing cars with CarBlaster (and a truck usually has more than 5 gears, so probably will be easier to use the same gear relations as LM002 with different weight, as Duplode said)

    3- How about the cockpit height? I mean, when you are using the F1 view (from inside), does it look that you are at least as high as in the LM002? (again, I haven't tested it yet, so I don't know)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Duplode on May 15, 2008, 04:02:51 AM
    1- I'm not sure how to edit the dashboard to make it look like a truck.

    2- I was never good at editing cars with CarBlaster (and a truck usually has more than 5 gears, so probably will be easier to use the same gear relations as LM002 with different weight, as Duplode said)

    3- How about the cockpit height? I mean, when you are using the F1 view (from inside), does it look that you are at least as high as in the LM002? (again, I haven't tested it yet, so I don't know)

    1. That would require exporting the STDA*.PVS/STDB*.PVS bitmaps, editing them in your favourite editor (of course using only the default palette available to Stunts) and importing them back into the .PVS files. With stressed, importing and exporting of bitmaps is trivial, so artistic skills are the only limiting factor... ;)

    2. Maximum number of gears for a car is six, if 5 vs. 6 really would make a difference. Anyway, I have no clue about how should a Stunts truck drive... :D but I could assist with the technicalities if needed (BTW, in case you're wondering about parameters, be sure to check the Wiki)

    3.That's pretty simple, just question of modifying a parameter in CarBlaster (CAR*.RES).  :)

    Materials are stored in a config file, and since the program is in active development the default settings are changed frequently. When upgrading you should delete the old one (~/.config/stuntstools/stressed.conf) to force re-generation.

    Well, I tested it quickly and it doesn't seem to be the .conf... I still have to try erasing everything on the stressed folder, though.
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: dstien on May 15, 2008, 04:38:53 AM
    Materials are stored in a config file, and since the program is in active development the default settings are changed frequently. When upgrading you should delete the old one (~/.config/stuntstools/stressed.conf) to force re-generation.

    Well, I tested it quickly and it doesn't seem to be the .conf... I still have to try erasing everything on the stressed folder, though.

    Did you run "svn update" from the project root directory? If you ran it inside the src/ dir you missed the some files. Also, if the source tree is polluted with old object files and deprecated sources the easiest solution is to just delete and do a fresh checkout.
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Duplode on May 15, 2008, 05:25:00 AM
    Reinstalling from scratch didn't do the trick. Strange how this popped up only after the Friday revisions, as the program was loading all colours just fine well before... anyway, at the moment, I'm using qt4 and qt4-devel latest revisions (4.3.4-11) under Fedora Core 8 / KDE.
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: dstien on May 15, 2008, 12:21:19 PM
    Reinstalling from scratch didn't do the trick. Strange how this popped up only after the Friday revisions, as the program was loading all colours just fine well before... anyway, at the moment, I'm using qt4 and qt4-devel latest revisions (4.3.4-11) under Fedora Core 8 / KDE.
    Delete "~/.config/Unknown Organization.conf" as well. The creation of this file stems from an earlier bug in stressed. Why Qt still gives this file precedence is beyond my comprehension.
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Duplode on May 15, 2008, 02:41:45 PM
    Curious...but now fixed ;)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: dstien on May 16, 2008, 04:08:10 AM
    Added the ability to replace all references to a material within a paint-job. This makes skinning a little less tedious. Just right-click on an entry in the materials table and select "Replace" from the context menu.

    (http://surr.no/pub/2008-05-16-Stunts_teapot_tn.png) (http://surr.no/pub/2008-05-16-Stunts_teapot.png)

    No graphics testing without teapots (http://en.wikipedia.org/wiki/Utah_teapot). ;)
    Attached the 3SH file with four paint-jobs in case someone want to play with it.
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Paleke on May 16, 2008, 04:22:16 AM
    1- I'm not sure how to edit the dashboard to make it look like a truck.

    2- I was never good at editing cars with CarBlaster (and a truck usually has more than 5 gears, so probably will be easier to use the same gear relations as LM002 with different weight, as Duplode said)

    3- How about the cockpit height? I mean, when you are using the F1 view (from inside), does it look that you are at least as high as in the LM002? (again, I haven't tested it yet, so I don't know)

    1. That would require exporting the STDA*.PVS/STDB*.PVS bitmaps, editing them in your favourite editor (of course using only the default palette available to Stunts) and importing them back into the .PVS files. With stressed, importing and exporting of bitmaps is trivial, so artistic skills are the only limiting factor... ;)

    2. Maximum number of gears for a car is six, if 5 vs. 6 really would make a difference. Anyway, I have no clue about how should a Stunts truck drive... :D but I could assist with the technicalities if needed (BTW, in case you're wondering about parameters, be sure to check the Wiki)

    3.That's pretty simple, just question of modifying a parameter in CarBlaster (CAR*.RES).  :)

    Ok, just two questions then:

    1- Where can I download stressed?

    2- Where can I download the truck files?
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: CTG on May 16, 2008, 07:33:24 AM
    (http://surr.no/pub/2008-05-16-Stunts_teapot_tn.png) (http://surr.no/pub/2008-05-16-Stunts_teapot.png)

    HUAHUAHUAHUAHUAHHHAHAHAHAHAHAHAHAH!!!! EXCELLENT! You made my day! ;D
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Krys TOFF on May 16, 2008, 12:55:32 PM
    Ok, just two questions then:

    1- Where can I download stressed?

    2- Where can I download the truck files?
    1 : when finished it should be available there : http://code.google.com/p/stuntstools/ but so far only dstien and duplode have it, and it works only for Linux.
    2 : check page 8 of this topic, 3SH file is attached to one post of dstien. ;)

    Marvelous funny teapot ! I love it too. :D
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: BonzaiJoe on May 16, 2008, 02:33:38 PM
    I must say that also made me laugh a lot! The teapot looks like it's a bit worried about where it's going to fall down, but at the same time very fearless. It looks a bit like it's sleeping, or only half awake.
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: CTG on May 16, 2008, 04:01:56 PM
    I wonder if it's possible to make a lot more detailed car skeletons for Stunts (~5000-10000 points polygon, like NFS PU cheat cars). Or more exactly: do you think Stunts would be able to handle more difficult polygons written in the same program?
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: dstien on May 16, 2008, 05:07:28 PM
    I wonder if it's possible to make a lot more detailed car skeletons for Stunts (~5000-10000 points polygon, like NFS PU cheat cars). Or more exactly: do you think Stunts would be able to handle more difficult polygons written in the same program?

    Unfortunately the shape format is limited to 255 vertices and 255 polygons. The teapot has 114 vertices and 96 polygons, so the limit isn't that bad. Remember that Stunts don't have lighting, shading is faked by preset colors. Without real-time shading high-poly details won't be visible. The low screen resolution and lack of floating point co-ordinate precision doesn't help either. Anyway, I think Dosbox would struggle when rendering such a number of polygons in an emulated software pipeline, and it would probably hit some arcane memory handling barriers as well.

    Stunts' classic collision and dynamics simulation wrapped in modern, hardware-accelerated rendering is probably our holy grail. A man can dream though. A man can dream...
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Duplode on May 16, 2008, 05:48:21 PM
    The teapot looks like it's a bit worried about where it's going to fall down, but at the same time very fearless. It looks a bit like it's sleeping, or only half awake.

    It just closed its eyes out of fright... ;D

    Ok, just two questions then:

    1- Where can I download stressed?

    2- Where can I download the truck files?
    1 : when finished it should be available there : http://code.google.com/p/stuntstools/ but so far only dstien and duplode have it, and it works only for Linux.

    @Paleke: if you really intend to start modifying dashboards at once I could mail you the exported .png files (their sometimes not very intuitive roles in composing the dashboard is described in the Wiki) .

    I wonder if it's possible to make a lot more detailed car skeletons for Stunts (~5000-10000 points polygon, like NFS PU cheat cars). Or more exactly: do you think Stunts would be able to handle more difficult polygons written in the same program?

    Unfortunately the shape format is limited to 255 vertices and 255 polygons. The teapot has 114 vertices and 96 polygons, so the limit isn't that bad.

    Something pretty simple (now that we have .OBJ import/export) I really want to try soon is scaling down the car0 shape and using it as car1. If the resulting model still looks good without floating point coordinates we'll be able to race cars almost as detailed as the ones in the Car Selection screen, with potentially very cool results for some cars (Corvette, for instance) and much better possibilities for bi-colour patterns (and also it would make modelers able to worry with just one shape, and then scale it accordingly).

    Stunts' classic collision and dynamics simulation wrapped in modern, hardware-accelerated rendering is probably our holy grail. A man can dream though. A man can dream...

    Games won't really get much cooler than that... 8)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: CTG on May 18, 2008, 10:23:21 PM
    My dream: using Big Foot/Monster Truck cars in Stunts. ;D
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Duplode on May 19, 2008, 01:31:33 AM
    My dream: using Big Foot/Monster Truck cars in Stunts. ;D

    Graphically that is not hard to do, but the real fun would be if we got to modify the physics... ::) Just imagine running over slalom blocks!;D
    BTW, CTG: Several posts ago you mentioned some NFS Porsche colour scheme you'd enjoy seeing in game. Could you please point me to an image of it, so I can evaluate the feasibility of adapting it to our P962? ;)

    ---

    I performed the downscaling tests mentioned in my previous posts with promising results. Here are two shots comparing the regular car1 Corvette to the downscaled car0 (in the background, really a bad choice of angle for the images ::)):

    (http://i49.photobucket.com/albums/f283/Duplode/load_037.png)

    (http://i49.photobucket.com/albums/f283/Duplode/load_039.png)

    The "new" Corvette has quite a number of cool new details... the overall shape is only very slightly different from the original one (a bit lower profile), and the downscaling is perfect, as all car0 coordinates seem to be multiples of 20 - as if the developers originally intended to use downscaled car0 models themselves but later aborted the plan (hardware limitations?). Implementing the downscaling was rather simple - export the shape, open the .OBJ in a text editor, copy the vertex table to Excel/OOCalc, divide all coordinates by 20, paste the table back in the .OBJ and import back in stressed. The only caveat to this procedure is that stressed, as dstien pointed out, exports just one paintjob per .OBJ, and thus the resulting new shape will have only one colour available. I suppose there is a simple workaround to this though, namely repeating the process for all seven paintjobs and importing them all to a single .3SH later on.
    And now, I'll display the motivation to those tests: the large benefits to my American Blue colour scheme... :)

    (http://i49.photobucket.com/albums/f283/Duplode/load_044.png)

    (http://i49.photobucket.com/albums/f283/Duplode/load_042.png)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: CTG on May 19, 2008, 02:50:54 AM
    German style GT1...  ;D
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Duplode on May 19, 2008, 06:42:27 AM
    German style GT1...  ;D

    Hmm... how about this interpretation of the theme?  ;)

    (http://i49.photobucket.com/albums/f283/Duplode/load_045b.png)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: CTG on May 19, 2008, 09:34:14 AM
    Nice! Thanks! ;)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: CTG on May 19, 2008, 02:27:28 PM
    Other idea: we have some bikers in the community - is it possible to make a bike with some really primitive human shape on it? ;D

    (Limit is only our fantasy, from the four wheel vagina to airplane shape... ;D)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Paleke on May 20, 2008, 03:35:07 PM
    Here it is another idea: how about Mach 5?  ;D

    Anyway, now I have some more free time, so I think I can work a little bit on the truck. I can promess results soon but I'll do my best. So I need all the files, can someone pass them to me or at least tell me where to find them?
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Duplode on May 21, 2008, 04:02:57 AM
    Anyway, now I have some more free time, so I think I can work a little bit on the truck. I can promess results soon but I'll do my best. So I need all the files, can someone pass them to me or at least tell me where to find them?

    Very nice! Here are your files, Paleke... the truck .3SH and the base CARLM02.RES are already available, so I included all relevant bitmaps from STDALM02.PVS and STDBLM02.PVS. They are to be edited in any usual bitmap graphics program, without adding any colour not included in their "default" palette - changing image size (e.g. to have a taller dashboard) should work in principle as long one adjusts the proper .VSH parameters in stressed, but I have no idea whether Stunts would complain for some reason or misplace the bitmap in that case. If you get everything ready, or just want to check the result in-game, while stressed is not available for Windows, just send me the bitmaps and I can re-insert them back into the .VSH files. The role of each bitmap is briefly described in the Wiki (http://wiki.stunts.hu/index.php/Car_files). And please do share all doubts and insights here... ;)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Paleke on May 21, 2008, 04:22:39 AM
    Thanks, I'll start to work as soon as I can.

    Now, there is a problem with my last post, I made a mistake
    Anyway, now I have some more free time, so I think I can work a little bit on the truck. I can promess results soon but I'll do my best. So I need all the files, can someone pass them to me or at least tell me where to find them?

    Where it says "can", it should be saying "can't". Sorry if someone got really excited after reading that :S
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Krys TOFF on May 21, 2008, 09:20:40 AM
    Problem is to be sure to use the same color palette to create a new dashboard I think.

    Anyway, do you also plan to do car tuning of the truck Paleke, or just the dashboard look ?
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Paleke on May 21, 2008, 02:19:36 PM
    I'm planning to do both, I think I'll have less problems doing the tunning than the dashboard, as I'm not sure what colour palette the game uses. (Don't worry, I'll find out)

    Here is another idea (since we are talking about trucks)
    (http://upload.wikimedia.org/wikipedia/commons/thumb/a/a6/Formula_Truck_2006_Scania_Muffato.jpg/800px-Formula_Truck_2006_Scania_Muffato.jpg)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Duplode on May 21, 2008, 02:58:39 PM
    I'm planning to do both, I think I'll have less problems doing the tunning than the dashboard, as I'm not sure what colour palette the game uses. (Don't worry, I'll find out)

    Well, when I open a dashboard .png in GIMP (the open source equivalent to Photoshop) it automatically recognizes the exported bitmap as indexed and attributes the correct palette. But if you want to play on the safe side then you can use this palette (http://wiki.stunts.hu/index.php/Image:Stunts-pal-vga.png), provided by dstien.
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Krys TOFF on May 21, 2008, 04:39:12 PM
    I prefer trucks with "nose" like that :
    (http://www.stthomastrucknationals.com/photos/good/DSC_2557%20(Medium).jpg)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Krys TOFF on May 21, 2008, 08:04:06 PM
    And what about an indycar with digital speedometer ?
    When my F1 2002 will be ready, you'll get it. 8)
    In the meantime, enjoy the view of it at the beginning of Default track. ;)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Chulk on May 21, 2008, 08:15:24 PM
    I wonder what the speedometer would say if you got PG. 245? Car's info max speed?
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Krys TOFF on May 21, 2008, 08:26:52 PM
    I wonder what the speedometer would say if you got PG. 245? Car's info max speed?
    Same as with cars with already a digital speedometer : the real speed, so it's 245 (or up to 255 sometimes with indy ;)). Tested and confirmed. ;D
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Chulk on May 22, 2008, 12:37:39 AM
    Ok, thanks Krys. You satisfied my curiosity about that matter.
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Duplode on May 22, 2008, 02:12:54 AM
    One wild idea that crossed my mind on F1 cars: convert a cockpit from some old F1 game... for instance, here is a shot of Geoff Crammond's Grand Prix 2 (from 1996):

    (http://upload.wikimedia.org/wikipedia/en/f/f8/Gp2cockpit.jpg)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Paleke on May 22, 2008, 04:23:39 PM
    That's actually what I'll try to do with the truck's dashboard. The only thing that bodders me in this moment is: what brand do you think the truck is? "Man", perhaps?
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Krys TOFF on May 22, 2008, 05:47:06 PM
    Scania maybe ?
    (http://www.renaultoloog.nl/Scania%20143m%20Campina.JPG)

    Or Daf ? Yes, this one seems fine. :)
    (http://faimg1.forum-auto.com/mesimages/233677/daf%207.jpg)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: CTG on May 22, 2008, 06:00:38 PM
    My dream: using Big Foot/Monster Truck cars in Stunts. ;D

    Like this MonsterTrabant ;D

    (http://index.hu/cikkepek/totalcar/blogok/belsoseg/2007_04_19_monstertrabant.jpg)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: BonzaiJoe on May 23, 2008, 02:03:47 AM
    Is it possible to make an invisible car?
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: CTG on May 23, 2008, 07:54:53 AM
    Is it possible to make an invisible car?

    Oh I see the future: invisible car on Krys Toff's tricky track with hidden corners - mission impossible. ;D
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Krys TOFF on May 23, 2008, 11:44:10 AM
    Is it possible to make an invisible car?

    Oh I see the future: invisible car on Krys Toff's tricky track with hidden corners - mission impossible. ;D
    And impossible to verify if you respect OWOOTT rules ! :D :D :D

    Anyway, as indicated by dstien in the wiki, there is a transparency color in Stunts VGA palette. So it should be possible to have invisible car. ;)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: CTG on May 23, 2008, 12:40:31 PM
    What about making cabrios? ;)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Paleke on May 23, 2008, 04:05:20 PM
    Scania maybe ?
    (http://www.renaultoloog.nl/Scania%20143m%20Campina.JPG)

    That's a good one, but how about this Man?

    (http://www.truck-dealers.co.uk/images/x446ch.jpg)


    EDIT: Nah, I think Scania is the best choice... Now, here it is another idea:

    http://upload.wikimedia.org/wikipedia/en/1/1b/The_Homer_by_Carlos_Bisquertt.jpg

    :D :D :D :D
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Krys TOFF on May 23, 2008, 04:39:06 PM
    Well, a truck is a truck. Do as you like for the dashboard. ;)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Chulk on May 23, 2008, 07:43:47 PM
    What about making cabrios? ;)
    It should be possible making the roof invisible, right?
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: BonzaiJoe on May 23, 2008, 08:08:51 PM
    And uncover the secret cabin graphics?  :)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Chulk on May 23, 2008, 08:11:40 PM
    I don't really think there will be cabin graphics as programmers didn't thik they were needed...
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Krys TOFF on May 27, 2008, 11:48:29 AM
    Is it possible now to create new scenery elements ?
    Will we be forced to replace elements (Joe's bar, windmill, ...) by the new ones or can we add them to existing ones ?
    In case we can add them, is there a limit of scenery elements we can add ?
    And finally, how to place them in the tracks without hex-editing the track file ? In case we have to replace original elements then it could be possible to add them throught in-game editor or Track Blaster Pro, but if they are added to original ones I think that hex-editing the track file is the only way to put them on the track. But maybe I'm wrong...

    I'd like to have the Triumph arc and the Eiffel tower to create Bernie Ecclestone's dream of a F1 race in Paris for the finale of FTT 1st season in december. ;D

    Triumph arc :
    (http://pagesperso-orange.fr/anthony.atkielski/ArcDeTriompheSmall.jpg)

    Eiffel tower :
    (http://www.innovland.com/Photos/Tour%20Eiffel%20P%202.jpg)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Duplode on May 28, 2008, 03:51:10 AM
    Is it possible now to create new scenery elements ?
    Will we be forced to replace elements (Joe's bar, windmill, ...) by the new ones or can we add them to existing ones ?
    In case we can add them, is there a limit of scenery elements we can add ?
    And finally, how to place them in the tracks without hex-editing the track file ? In case we have to replace original elements then it could be possible to add them throught in-game editor or Track Blaster Pro, but if they are added to original ones I think that hex-editing the track file is the only way to put them on the track. But maybe I'm wrong...

    Summing up the answers according to current knowledge:

    1. We can create new graphics for scenery elements, but we can't change the collision models. So, if you replace Joe's graphics by a (mini) Triumph arc you won't be ever able to drive under it...

    2. Adding new elements is not viable at the moment because we don't really understand what are the inner mechanisms that Stunts uses to identify a byte value in the .TRK and use the info to load the correct shape and physics for the element, and as a consequence we have no idea where we should put data for new elements. The closest thing that seems to be possible (haven't fully tested it, though) would be making new combos with the current elements by messing up with TEDIT.RES (among other stuff, that file defines which elements are available in which F1..F10 panel of the editor), but I doubt that would be of much use anyway.

    3. Therefore, at the current state-of-the-art we are limited to replacing graphics for current elements without changing the underlying collision model. Creation of new track elements is pretty limited for purposes other than making alternative visual environments by playing with texture sets. Of course, the same is valid for cars, but since all cars seem to have nearly the same physical shapes/collision model the issue is not that critical. That probably explains why sometimes, when trying RH-heavy tricks (narrowly jumping over bridge walls, for instance) the car seems to crash into the air: the collision and graphical models do not match exactly...

    4. Now, let's suppose that one day we actually get to introduce new track elements without replacing existing ones. When that day comes, we will know enough about the track-construction code for assigning unused byte codes in the .TRK and TEDIT.RES files for the new elements, thus allowing for normal manipulation of them within the editor. That will be another nice day for the Wiki chronology... :)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Krys TOFF on May 28, 2008, 10:15:08 AM
    Quote from: Duplode
    1. We can create new graphics for scenery elements, but we can't change the collision models. So, if you replace Joe's graphics by a (mini) Triumph arc you won't be ever able to drive under it...
    This is not my goal, in real life you can't drive under it too. This is possible only with Midtown Madness 3. :D
    I just want to give pipsqueaks the impression to race in Paris.

    Quote from: Duplode
    2. Adding new elements is not viable at the moment because we don't really understand what are the inner mechanisms that Stunts uses to identify a byte value in the .TRK and use the info to load the correct shape and physics for the element, and as a consequence we have no idea where we should put data for new elements. The closest thing that seems to be possible (haven't fully tested it, though) would be making new combos with the current elements by messing up with TEDIT.RES (among other stuff, that file defines which elements are available in which F1..F10 panel of the editor), but I doubt that would be of much use anyway.
    Maybe a key to it is the way Mark Nailwood managed to add a car in scenery possibilities (see F10 part of TrackBlaster compared to in-game editor).

    Quote from: Duplode
    3. Therefore, at the current state-of-the-art we are limited to replacing graphics for current elements without changing the underlying collision model.
    I we make an eiffel tower the size of a windmill and a triumph arc the size of a building, collision is not an issue. These are just scenery elements, not stunts elements to be driven through.

    Quote from: Duplode
    4. Now, let's suppose that one day we actually get to introduce new track elements without replacing existing ones. When that day comes, we will know enough about the track-construction code for assigning unused byte codes in the .TRK and TEDIT.RES files for the new elements, thus allowing for normal manipulation of them within the editor. That will be another nice day for the Wiki chronology... :)
    One day, we will have different custom mods for Stunts. I'd like to have a desert Stunts (simply grass color replaced by sand color), perfect for Paris-Stunts-Dakar. :D
    Title: Mingva le van fingva
    Post by: CTG on May 28, 2008, 05:17:01 PM
    New scenery element idea: what about attendance next to the road? Like in rallies... ;)
    Title: Re: Mingva le van fingva
    Post by: Chulk on May 28, 2008, 06:57:23 PM
    New scenery element idea: what about attendance next to the road? Like in rallies... ;)
    Nice idea!!
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Duplode on May 29, 2008, 10:39:22 PM
    Okay, about time for a semi-official release... here is my custom set of paintjobs for the Indy. The following colour sets are included:



    Installation simply requires to move the original STPMIN.P3S away from the Stunts folder and replacing it by the provided STPMIN.3SH, without changing its name or extension. Enjoy!
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Krys TOFF on May 30, 2008, 11:03:06 AM
    Great ! :)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: BonzaiJoe on May 30, 2008, 07:41:49 PM
    Really great! I just spent some minutes just driving around with F2 view :)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: alanrotoi on May 31, 2008, 04:20:54 AM
    It seems fun!
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Chulk on May 31, 2008, 04:50:25 AM
    What do I have to do to use that colour set?
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Duplode on May 31, 2008, 06:04:25 AM
    It seems fun!

    Wow, Alan Rotoi around here!...  8):)

    @Chulk: To use the colour set remove STPMIN.P3S from the Stunts folder (preferably Cut-Paste it to somewhere safe in case you wish to restore the default paintjobs) and paste the attached STPMIN.3SH into the Stunts folder, and your Indy will be redressed instantly. Contextual info: .P3S is the extension for the original, Packed 3DShapes of Stunts. After decompression and customization the extension needs to be changed to .3SH so that Stunts knows there's no need to unpack the file. As an additional observation, note that all your old replays will be rendered with the new colours, as the replay file only contains an index pointing to the current .P3S/.3SH data.
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Chulk on May 31, 2008, 04:17:36 PM
    I did (quite) like that. I change the name of original STPMIN.P3S to STPMIN Original.P3S so I could have them back, and then paste the STPMIN.3HS but it didn't work... Maybe stunts recognized the other file despite I changed it's name?
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Duplode on May 31, 2008, 06:36:49 PM
    I did (quite) like that. I change the name of original STPMIN.P3S to STPMIN Original.P3S so I could have them back, and then paste the STPMIN.3HS but it didn't work... Maybe stunts recognized the other file despite I changed it's name?

    Strange, that shouldn't be happening... I performed the same renaming procedure on my regular Stunts folder and the new file loaded correctly.  Do you get a "Check Disk" error or the game simply loads the normal Indy? Maybe you could try removing the original file to a backup folder, or double-check for any additional (hidden?) files. But that's really strange... :-\
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: dstien on May 31, 2008, 07:24:28 PM
    I did (quite) like that. I change the name of original STPMIN.P3S to STPMIN Original.P3S so I could have them back, and then paste the STPMIN.3HS but it didn't work... Maybe stunts recognized the other file despite I changed it's name?
    DosBox caches files. Did you do this while DosBox was running?
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Krys TOFF on May 31, 2008, 09:08:18 PM
    I did (quite) like that. I change the name of original STPMIN.P3S to STPMIN Original.P3S so I could have them back, and then paste the STPMIN.3HS but it didn't work... Maybe stunts recognized the other file despite I changed it's name?
    DosBox caches files. Did you do this while DosBox was running?
    Probably, If you download a new track and copy it in Stunts folder while DOSBox running, the track isn't recognized too. Only way is to restart DOSBox so maybe it's the same issue for you Chulk.
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Chulk on June 02, 2008, 10:47:07 PM
    I created a subfolder in Stunts called Mod. Copied the entire game there, and renamed the original file and paste the other. After that, I loaded DOSBox and Indy was loaded as usual. I'll try removing the file as I have it in Stunts folder anyway...
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Duplode on June 03, 2008, 04:10:08 AM
    I created a subfolder in Stunts called Mod. Copied the entire game there, and renamed the original file and paste the other. After that, I loaded DOSBox and Indy was loaded as usual. I'll try removing the file as I have it in Stunts folder anyway...

    Bizarre... if it still fails to load, try removing both the .P3S and .3SH for a test. If you do not get a "Check Disk" error, there's some mysterious power  acting on those files... but if you do get the error, reinsert the .3SH and cross your fingers  ;)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Krys TOFF on August 25, 2008, 01:28:18 PM
    It's been weeks since last news from dstien... :-\ I hope he still works on his program.
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Duplode on August 26, 2008, 12:52:18 AM
    Last time I checked his sources there were a few updates from late June, so I guess it's still alive. Maybe if we did some more editing there would be positive feedback for developement, though. (if only I was in a more artistical mood lately... :-\ that reminds me I have to finish my R32 Skyline project someday!)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: dstien on August 26, 2008, 01:31:19 AM
    It's certainly not dead, just resting. :) I got distracted with some (http://pcimaxfm.devjavu.com/) other (http://cxbx.svn.sourceforge.net/viewvc/cxbx/branches/private/dstien/wip/) projects lately. I tried compiling Stressed for Win32 when I saw Krys' post today, but it wouldn't link dynamically and static linkage resulted in a 11 megabytes executable. :-\
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Krys TOFF on August 27, 2008, 12:02:25 AM
    Quote from: dstien
    I tried compiling Stressed for Win32 when I saw Krys' post today, but it wouldn't link dynamically and static linkage resulted in a 11 megabytes executable. :-\
    Well I don't understand the dynamic or static linkage thing, but 11Mb is not a problem for me to download if it was your issue.
    I'd like to work on the design of my F1 2002 car project using your wonderful program. ;)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: zaqrack on September 24, 2008, 11:27:21 AM
    just found some short tips on how to disassemble dos game, some may be interested:

    http://rewiki.regengedanken.de/wiki/Reverse_engineering_hints

    and the whole site is about the reverse engineering of old dos games.

    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: dstien on October 06, 2008, 03:46:33 AM
    Finally got around compiling Stressed for Win32. Since Windows don't offer system-wide management of third party packages I've tried to include all dependencies (hence the file size). Tell me if I missed anything and if the program actually works at all. It should be able to open and edit resource files containing plain text, bitmap images and 3d shapes.

    (http://surr.no/pub/2008-10-06-Stunts_stressed_win32.png)

    stressed-0.1.0-rc1-win32bin.zip (http://forum.stunts.hu/index.php?topic=2224.0)

    Maybe if we did some more editing there would be positive feedback for developement, though.
    Further development can be done in exchange for cool Stunts creations or racing technique counseling.

    I'll try to whip up some Windows builds soon*.

    *) Definition of "soon" is subject to change.
    :D :D :D :D
    Ok, it's settled, "soon" means "within 1/2 year". ;)

    just found some short tips on how to disassemble dos game, some may be interested:
    The biggest problem with debugging Stunts is that the code is self-modifying, it can't just be loaded into a disassembler. LOAD.EXE patches together the executable code that needs to be loaded into memory based on graphics and sound setup. It would be interesting to know if the result from LOAD.EXE can be dumped to a DOS EXE image. Since the header files are included one might think so, and we've already reversed the worst parts of the loading process; data decompression.

    When I reversed the run-length decompression located inside the variable-length compressed code files I used the DOSBox Debugger to locate the code and dump the memory. By importing the raw memory into a disassembler we can initiate code parsing since we know the locations containing interesting code. I'd like to avoid this messy workflow next time I explore Stunts code...
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Mark L. Rivers on October 06, 2008, 10:24:45 AM

    Fantastic job, one more time, dstien!  :)
    I'm going to try soon your Win32 version, and for me "soon", in this case, means now!  ;)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Krys TOFF on October 06, 2008, 12:24:25 PM
    Hell yeah ! Thanks dstien for all your work, keep it up ! :)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Mark L. Rivers on October 06, 2008, 05:00:39 PM

    Stressed is wonderful! Again congratulations dstien!  :)
    And here it is a light and fast restyling of Speedgate XSD.... Not a definitive restyling but an example about what stressed can easily permit...  ;)

    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Krys TOFF on October 07, 2008, 10:05:02 AM
    I like the new rear wing. Official new release for Speedgate and GT3 expected then, just with new design. ;)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Duplode on October 07, 2008, 01:57:58 PM
    Yay, now many more people with more artistical proneness (and less artistical laziness... :D) than me will be able to use dstien's wonderful toolbox. The rear wings look very nice indeed, Mark  ;) As for GT3, I promise I'll try to dress it in racing trim eventually, and modify the colour set too. BTW, just in case anyone is wondering, graphical updates of cars (replacing *.PVS/*.VSH and *.P3S/*.3SH) won't harm saved replays in any way, since the CAR*.RES need not, in principle, be changed, and thus the car will act the same regardless of what it looks like.
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Mark L. Rivers on October 07, 2008, 03:50:06 PM
    Thanks Krys and Duplode!  :)
    But it's already time for a more defined tuning...  ;)

    Highlights about Step 2:

    - Cockpit has been enlarged e lowered;
    - Fenders above forward wheels have been lowered;
    - Frontal and rear have been "thinned", rear wings support included.
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: CTG on October 07, 2008, 04:46:14 PM
    Can you tune the Indy to be a more or less realistic F1 car of the present?
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Mark L. Rivers on October 07, 2008, 05:51:04 PM

    I could try...
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Chulk on October 07, 2008, 08:43:11 PM
    Just finished downloading Stressed (my first download with FF as well, I decided to swith because IE was messing around). I'll give it a try tonight, when I'll have more time.
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Duplode on October 08, 2008, 05:19:45 PM
    Mark: you might wish to check whether that slightly modified dashboard I made a while ago works properly now; if you like the result, that is... :)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Mark L. Rivers on October 08, 2008, 06:02:29 PM

    Great work!  8)

    Anyway... I still don't know how it's possible modify the cockpit with stressed....  ::)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Chulk on October 08, 2008, 06:08:41 PM
    Nice work Dstein! Simply great! Now, if someone could post a simple "How to" to modify the external look of cars, I'd really appreciate it.
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Duplode on October 09, 2008, 04:46:35 AM
    Anyway... I still don't know how it's possible modify the cockpit with stressed....  ::)

    To edit a dashboard (or any other bitmap resource) you have to open the *.PVS/*.VSH with stressed, locate the relevant bitmap on the resource list and export it. Then, open the .PNG with an appropriate editor, preferably one good enough to handle indexed bitmaps properly, so you don't have to worry about using colours which don't exist in Stunts. GIMP or Photoshop should suffice. Once the editing is done, reopen the resource file in stressed and import the .PNG back to its place.

    Now, if someone could post a simple "How to" to modify the external look of cars, I'd really appreciate it.

    I could try to make a short summary later on...

    ---

    Here are shots from a preliminary study of GT3 future looks. I rescaled the showroom ZR1 model to adequate proportions so I could have more control over colour schemes and from there adjusted the paint jobs so it looks less like a regular model. Fancier stuff like wings and such might come later on eventually. Please tell me how you like this test - and particularly whether all the tiny details inherited from the larger car model look too bad on this resolution.

    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Mark L. Rivers on October 09, 2008, 07:35:55 AM
    Anyway... I still don't know how it's possible modify the cockpit with stressed....  ::)

    To edit a dashboard (or any other bitmap resource) you have to open the *.PVS/*.VSH with stressed, locate the relevant bitmap on the resource list and export it. Then, open the .PNG with an appropriate editor, preferably one good enough to handle indexed bitmaps properly, so you don't have to worry about using colours which don't exist in Stunts. GIMP or Photoshop should suffice. Once the editing is done, reopen the resource file in stressed and import the .PNG back to its place.

    Thanks very much, Duplode!  :)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: CTG on October 09, 2008, 09:08:11 AM
    To edit a dashboard (or any other bitmap resource) you have to open the *.PVS/*.VSH with stressed, locate the relevant bitmap on the resource list and export it. Then, open the .PNG with an appropriate editor, preferably one good enough to handle indexed bitmaps properly, so you don't have to worry about using colours which don't exist in Stunts. GIMP or Photoshop should suffice. Once the editing is done, reopen the resource file in stressed and import the .PNG back to its place.

    Can you change the shape of the steering wheel? It would be really cool to create a real Knight Rider car is Stunts. All we need is a tuned Corvette:

    - black body
    - running red lights at the front of the car (if the mills can "move", maybe some car elements also can - if not, there's still the possibility to put a thick red line)
    - modified steering wheel
    - several buttons on the dashboard, like Turbo Boost and SPM
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Mark L. Rivers on October 09, 2008, 03:46:02 PM

    A question for dstien: upgrading the number of polygons related at shapes car1 and car2 (used during the race) can affect the fluidness of the game?
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Krys TOFF on October 09, 2008, 05:31:18 PM
    To modify a car shape, we need to modify the 3 "car" elements ?
    I'd like to have a tutorial too, I don't know which polygon is what on the car. Maybe I should change color of each polygon to see what I do. I'll try tonight.
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Mark L. Rivers on October 09, 2008, 07:16:33 PM
    To modify a car shape, we need to modify the 3 "car" elements ?
    I'd like to have a tutorial too, I don't know which polygon is what on the car. Maybe I should change color of each polygon to see what I do. I'll try tonight.

    car0 is the car you see in showroom (choice of the car);
    car1 is the car you see during the race with F2 - F3 - F4 keys;
    car2 is the car you see during the race with F2 - F3 - F4 keys from very far distances;

    And yes, to know which polygon you are changing, you have to see the polygon that becomes coloured in violet.

    Double click on the cell where is written "Polygon x" (where x is the number of vertex) permits you to add vertex (no way to delete one or more vertex) or modify the type of element (particle, polygon, sphere, wheel).

    Right click on the same cell to move polygon in the list, duplicate a polygon, insert a new polygon.

    I hope you are now more able to tune your F1 car...  ;)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: dstien on October 09, 2008, 09:18:59 PM
    Nice work Mark and Duplode! The renewed interest in Stunts modding motivated me to continue introducing bugs. I'll put up a new binary "soon". :)
    For Duplode and others following SVN, Google now has Atom feeds for project updates (http://code.google.com/feeds/p/stuntstools/svnchanges/basic).

    Can you change the shape of the steering wheel?
    The steering wheel is just a bitmap image that you can replace with anything you want, but I think the blue indicator will still move along a fixed arc.

    - running red lights at the front of the car (if the mills can "move", maybe some car elements also can - if not, there's still the possibility to put a thick red line)
    Cars can't have animations except for the hardcoded wheel transformations.

    A question for dstien: upgrading the number of polygons related at shapes car1 and car2 (used during the race) can affect the fluidness of the game?
    I haven't done any heavy testing, but it should only depend on the amount of available CPU cycles. If the framerate is ok when racing against an opponent with two official vehicles on the screen, there shouldn't be any difference using one vehicle with twice the amount of details. Another factor in addition to the number of polygons is the culling parameters that we haven't figured out yet...

    I don't know which polygon is what on the car.
    A shade of red is added to selected polygons, but this simple highlighting fails on small details or surfaces that are already coloured red. Drag the mouse combined with right/left/middle/right+left buttons to rotate and translate the 3d view on different axes.
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: CTG on October 10, 2008, 12:20:33 AM
    Strange... I modified a single polygon's color, saved the file and Stunts was frozen when I tried to use the car.
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: dstien on October 10, 2008, 01:23:03 AM
    Strange... I modified a single polygon's color, saved the file and Stunts was frozen when I tried to use the car.
    Stressed doesn't compress saved files. Did you rename it accordingly with the .3SH extension instead of .P3S?
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: CTG on October 10, 2008, 01:26:20 AM
    Strange... I modified a single polygon's color, saved the file and Stunts was frozen when I tried to use the car.
    Stressed doesn't compress saved files. Did you rename it accordingly with the .3SH extension instead of .P3S?

    That happens if I don't follow the instructions, just download the stressed... ;D
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: CTG on October 10, 2008, 01:51:13 AM
    Okay, this topic is quite long to read: the way of editing a car is, for example in the case of Lada Niva...

    1, open the stlm00.p3s file
    2, do the modifications with the Stressed program
    3, save the file as stlm00.3sh? Or shall I totally rename it?
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: dstien on October 10, 2008, 01:55:22 AM
    3, save the file as stlm00.3sh? Or shall I totally rename it?
    Use stlm00.3sh and move the old file out of the way. If not, Stunts will just load the original file. If you rename it entirely you'll have to rename the other files used by the car as well + editing the tuning file.
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: CTG on October 10, 2008, 02:05:43 AM
    3, save the file as stlm00.3sh? Or shall I totally rename it?
    Use stlm00.3sh and move the old file out of the way. If not, Stunts will just load the original file. If you rename it entirely you'll have to rename the other files used by the car as well + editing the tuning file.

    Aaaaaah I see. Thanks! ;) (it's always easier to ask than read ;D)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: CTG on October 10, 2008, 02:51:03 AM
    I'm thinking on a custom menu bar with a cool design and the Knight Rider dashboard... both projects will start as soon as I have some time. ;)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Duplode on October 10, 2008, 05:57:32 AM
    Many comments to reply to... :)

    Chulk: it seems Mark and Dstien covered all main points for a brief summary with their replies on Page 14, so that might be of help while a more formal document is to be made  ;)

    I'm thinking on a custom menu bar with a cool design and the Knight Rider dashboard... both projects will start as soon as I have some time. ;)

    Seeing the first custom dashboard is something I'm looking forward to - every time I consider doing one of those for my cars I always find myself at a loss about how to make modifications which are good looking yet consistent with the rest of the game.

    Quote from: dstien at stuntstools rev.30
    Context menu and actions for changing order, sorting, renaming, removing,
    duplicating and inserting new resources.

    That will be really useful for managing modifications while editing. Another nice use would be to insert read-me texts within the file as text resources.

    Can you change the shape of the steering wheel?
    The steering wheel is just a bitmap image that you can replace with anything you want, but I think the blue indicator will still move along a fixed arc.

    The arc is actually editable, as a set of coordinates (http://wiki.stunts.hu/index.php/Car_parameters#Steering_wheel_dot_movement) inside the *.RES. While from a contest manager point of view modifying the *.RES of a widely used car does not look like a good idea, as long as performance/physical behaviour parameters are left untouched replays won't become incompatible, save for the different steering wheel dot movement of course.

    A question for dstien: upgrading the number of polygons related at shapes car1 and car2 (used during the race) can affect the fluidness of the game?
    I haven't done any heavy testing, but it should only depend on the amount of available CPU cycles. If the framerate is ok when racing against an opponent with two official vehicles on the screen, there shouldn't be any difference using one vehicle with twice the amount of details. Another factor in addition to the number of polygons is the culling parameters that we haven't figured out yet...

    Glad you asked that question, Mark, as it affects directly my experiments on the GT3 - the regular Corvette car1 shape has 53 polygons, while the downscaled car0 I'm adjusting to replace it has 201 (with a couple additional ones to cover the underside of the car). Unfortunately, quadruplying the polygon count seems to be a bit too much: With two equal cars on screen, the frame rate starts to suffer at about 16000 cycles, a value far too high for many pipsqueaks. Even with a single car the limit seems to be as high as 11000-12000. Since I always race at 20k cycles, I would never notice the difference by myself. That's a major blow to my current design approach... :( 
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Mark L. Rivers on October 10, 2008, 07:45:33 AM
    A question for dstien: upgrading the number of polygons related at shapes car1 and car2 (used during the race) can affect the fluidness of the game?
    I haven't done any heavy testing, but it should only depend on the amount of available CPU cycles. If the framerate is ok when racing against an opponent with two official vehicles on the screen, there shouldn't be any difference using one vehicle with twice the amount of details. Another factor in addition to the number of polygons is the culling parameters that we haven't figured out yet...

    Glad you asked that question, Mark, as it affects directly my experiments on the GT3 - the regular Corvette car1 shape has 53 polygons, while the downscaled car0 I'm adjusting to replace it has 201 (with a couple additional ones to cover the underside of the car). Unfortunately, quadruplying the polygon count seems to be a bit too much: With two equal cars on screen, the frame rate starts to suffer at about 16000 cycles, a value far too high for many pipsqueaks. Even with a single car the limit seems to be as high as 11000-12000. Since I always race at 20k cycles, I would never notice the difference by myself. That's a major blow to my current design approach... :( 

    I'm not sure to have understood entirely your comment, Duplode, so I need a clarify.
    1) Are you saying that a high number of polygons for car0 (showroom) affects the fluidness of the game?
    2) Are cycles you talking the value that appears on the window bar of DOSBox?


    And now a request for dstien and his wonderful tool!
    Could Stressed be implemented so to:
    1) delete and duplicate vertexes in the same way (right click) you can delete and duplicate polygons?
    2) select the polygons even by clicking with the mouse over each of them?

    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Duplode on October 10, 2008, 05:52:15 PM
    I'm not sure to have understood entirely your comment, Duplode, so I need a clarify.
    1) Are you saying that a high number of polygons for car0 (showroom) affects the fluidness of the game?
    2) Are cycles you talking the value that appears on the window bar of DOSBox?

    1) Not really - what I did was to downscale 1:20 the 'Vette car0 model in order to use it as car1, so we could have a more detailed car1 shape. car0 is never used while racing.
    2) Yes, I meant that value. I lowered it progressively from 20000 (the default value I use) to evaluate the effects on slower computers (which usually require 10000-14000 cycles for fluid framerates).
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: CTG on October 10, 2008, 07:17:39 PM
    I just started to learn the "howto" and crashed into a strange problem.

    Car0: the carshow, most detailed
    Car1: the game, semi-detailed
    Car2: far view, "raw"

    In a short try, I exported my car0 to .OBJ file and then imported back to car1. It worked - but with a huge size car on the track (16x bigger than expected). How to decrease the values of the coordinates without re-writing every single numbers manually?

    - running red lights at the front of the car (if the mills can "move", maybe some car elements also can - if not, there's still the possibility to put a thick red line)
    Cars can't have animations except for the hardcoded wheel transformations.

    What about the the rear lamps when braking?
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Mark L. Rivers on October 10, 2008, 10:10:48 PM
    Are cycles you talking the value that appears on the window bar of DOSBox?

    Yes, I meant that value. I lowered it progressively from 20000 (the default value I use) to evaluate the effects on slower computers (which usually require 10000-14000 cycles for fluid framerates).

    How I would like to drive in DOSBox at 20000 cycles....!  ::)   Over 9000 I have a drastical reduction of fluideness...  :-\ :(
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Duplode on October 10, 2008, 10:36:39 PM
    How I would like to drive in DOSBox at 20000 cycles....!  ::)   Over 9000 I have a drastical reduction of fluideness...  :-\ :(

    Yes, indeed I'll have to rework the GT3 from ground up staring from car1 in order to make it feasible... BTW, 9000 cycles - I never managed to set up DOSBox perfectly on my old computer below 10000 cycles. Mark, could you please upload your dosbox.conf to the DOSBox Wiki article? Looks like it will be quite useful  ;)

    In a short try, I exported my car0 to .OBJ file and then imported back to car1. It worked - but with a huge size car on the track (16x bigger than expected). How to decrease the values of the coordinates without re-writing every single numbers manually?

    Actually, it's exactly 20x bigger than expected - if you check the vertex list you'll see all numbers there are divisible by 20. The shortest solution to rescale the car0, which I used for my GT3 tests, is to open the exported .OBJ (it's just a plain text archive), copy the vertex cordinates table to Excel (in the .OBJ, they are the lines starting with v), divide all values by 20 there, then copy the new coordinates back to the .OBJ and finally import it back into stressed.

    What about the the rear lamps when braking?

    My (unproven) theory to explain the rear lamps is that they are painted with specific materials (mostly #45, but also #12 and #14 for GTO) so that the game knows it needs to lit them up (that is, change to another shade of red, likely #47) under braking. Maybe we should paint the car body as a whole with #45 and check whether it glows when braking... ;D Anyway, the instruction to make the lamps glow is, in all likelihood, hard coded.

    And nice Lada Niva there, CTG! For the historical record, it is the first new car-shaped model built from scratch... :) :)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: CTG on October 10, 2008, 10:59:54 PM
    In a short try, I exported my car0 to .OBJ file and then imported back to car1. It worked - but with a huge size car on the track (16x bigger than expected). How to decrease the values of the coordinates without re-writing every single numbers manually?

    Actually, it's exactly 20x bigger than expected - if you check the vertex list you'll see all numbers there are divisible by 20. The shortest solution to rescale the car0, which I used for my GT3 tests, is to open the exported .OBJ (it's just a plain text archive), copy the vertex cordinates table to Excel (in the .OBJ, they are the lines starting with v), divide all values by 20 there, then copy the new coordinates back to the .OBJ and finally import it back into stressed.

    Well that was the automatical thinking from me too right after I posted that, but I had some weird problems with . and , characters (in Hungarian and so in Excel's Hungarian version we put , instead of . in fractional numbers), so it became a bit difficult for first. But it worked at last. ;)

    And nice Lada Niva there, CTG! For the historical record, it is the first new car-shaped model built from scratch... :) :)

    I kept only the wheels of Lada Niva, everything else was just a test with easy graphics. I decided to create a real Lada shape soon, my favorite from the 80's (not the Niva :D).
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: CTG on October 12, 2008, 09:26:53 PM
    Zak: I suggest to open a new subforum for game editions, I think it deserves - and there will be plenty of new car projects soon!  ;)

    After an hour of edition I was fed up with coordinates, so here is the first fragment of Lada VAZ 2105 (of course the colors will be modified if the bodywork is okay for Stunts)! :)

    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: CTG on October 12, 2008, 11:00:41 PM
    Problems again... making the car1 design of the new Lada, I crashed into an unexpected bug. When I try to use it in the game, several polygons are missing from the bodywork, getting visible only when I turn the camera angle (but then other polygons disappear). What can be the problem? :-\
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: dstien on October 12, 2008, 11:24:47 PM
    Could Stressed be implemented so to:
    1) delete and duplicate vertexes in the same way (right click) you can delete and duplicate polygons?
    2) select the polygons even by clicking with the mouse over each of them?
    Mouse picking is implemented in SVN, it makes skinning a breeze. I'll make new Win32 build next time I boot into Windows. The vertex list is a fixed structure whose size depends on the selected primitive type. I guess I could make it more flexible, but you guys should really use a real modelling tool and use stressed only to finalize the shape and paint-jobs. :)

    A question for dstien: upgrading the number of polygons related at shapes car1 and car2 (used during the race) can affect the fluidness of the game?
    I haven't done any heavy testing, but it should only depend on the amount of available CPU cycles. If the framerate is ok when racing against an opponent with two official vehicles on the screen, there shouldn't be any difference using one vehicle with twice the amount of details. Another factor in addition to the number of polygons is the culling parameters that we haven't figured out yet...

    Glad you asked that question, Mark, as it affects directly my experiments on the GT3 - the regular Corvette car1 shape has 53 polygons, while the downscaled car0 I'm adjusting to replace it has 201 (with a couple additional ones to cover the underside of the car). Unfortunately, quadruplying the polygon count seems to be a bit too much: With two equal cars on screen, the frame rate starts to suffer at about 16000 cycles, a value far too high for many pipsqueaks. Even with a single car the limit seems to be as high as 11000-12000. Since I always race at 20k cycles, I would never notice the difference by myself. That's a major blow to my current design approach... :( 
    When you export the unknown culling values are discarded. When importing all bits are set. Maybe it helps to set these correctly? I think I've figured out roughly how the unknowns works, and stressed should recalculate these values automatically once implemented.

    What about the the rear lamps when braking?

    My (unproven) theory to explain the rear lamps is that they are painted with specific materials (mostly #45, but also #12 and #14 for GTO) so that the game knows it needs to lit them up (that is, change to another shade of red, likely #47) under braking. Maybe we should paint the car body as a whole with #45 and check whether it glows when braking... ;D Anyway, the instruction to make the lamps glow is, in all likelihood, hard coded.
    That's correct.

    When I try to use it in the game, several polygons are missing from the bodywork, getting visible only when I turn the camera angle (but then other polygons disappear).
    Nice work on the Ladas, CTG! The problem you're having is most likely that you have drawn the polygons inside-out. Enable "back-face culling" in the 3d view to display only the front faces.
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: CTG on October 13, 2008, 01:11:20 AM
    Oh then the order of coordinates (clockwise or not) is important too... It works now. Thank you, Master dstein! ;)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Duplode on October 13, 2008, 01:56:36 AM
    Mouse picking is implemented in SVN, it makes skinning a breeze. I'll make new Win32 build next time I boot into Windows. The vertex list is a fixed structure whose size depends on the selected primitive type. I guess I could make it more flexible, but you guys should really use a real modelling tool and use stressed only to finalize the shape and paint-jobs. :)

    I just updated by SVN, and mouse picking is really a godsend  :) As for the vertex list remarks, there is another relevant characteristic of Stressed 3D editor associated to that issue: when you pick a polygon and edit one of its vertex coordinates, what Stressed actually does is to create a new vertex and replace the original one in the chosen polygon, instead of updating the old vertex position. Not only that makes it necessary to adjust all adjacent polygons to displace a vertex, it also means large-scale edition of complex 3D shapes with ~200 vertexes (some of the more detailed car0 shapes, like Corvette and Audi, have about that number IIRC) is probably impossible under Stressed. And while modifying the program to displace vertexes instead of cloning them would be really useful, it probably calls for a significant rewrite... so for the time being major 3D modeling work is indeed better done at another tool (I must try and learn some Blender once and for all...)

    When you export the unknown culling values are discarded. When importing all bits are set. Maybe it helps to set these correctly? I think I've figured out roughly how the unknowns works, and stressed should recalculate these values automatically once implemented.

    Well, I'll keep my current custom GT3 on hold until that gets implemented for further testing then - thanks  ;)

    Zak: I suggest to open a new subforum for game editions, I think it deserves - and there will be plenty of new car projects soon!  ;)

    I second that - this thread will be overflowing with previews, screen shots and announcements very soon (It's already #9 on "Most Replies" stats :) :)) With a separate space for editing projects, this topic can be reserved for updates on Stressed and further hacking breakthroughs.

    After an hour of edition I was fed up with coordinates, so here is the first fragment of Lada VAZ 2105 (of course the colors will be modified if the bodywork is okay for Stunts)! :)

    Ha, I know this car! A number of those funny-looking boxy sedans were imported to Brazil in the early 90's under the name "Lada Laika"  :D
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: CTG on October 13, 2008, 09:23:55 AM
    Laika, LOL! (poor dog) ;D Lada 2105 was one of the most common cars in Hungary in the late 80's - early 90's and it's still quite popular. No surprise, we used to be a communist country... By the way it was the best car available for the Eastern European block, maybe only Skoda 120 (another target of my Stunts car designing ambitions ;D) was on the same level.

    (http://www.stronger.sk/skoda120_01.jpg)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Chulk on October 13, 2008, 07:31:35 PM
    Can you recommend a good 3d shaping tool? CAn we create custom paint jobs? I mean with drawings or names or anything like that?
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Duplode on October 14, 2008, 02:13:27 AM
    Can you recommend a good 3d shaping tool?

    That was exactly the topic I'd post about... Blender is way more powerful a software than we need, and takes long to learn, so I looked for an alternative, and found a pretty good one: Anim8or (http://www.anim8or.com/main/index.html). Once you reach the site, look for the latest preview version (0.97d), as it has some tools useful for Stunts editors which are absent from the latest stable version (0.95). Why Anim8or is so appropriate?

    There are a few issues you'll have to prepare dealing with, but all of them are (relatively) minor:


    Anyway, by using Anim8or I made very quick progress with the Skyline car1 shape, created taking the Corvette as basis. Attached you have screenshots of Anim8or in action and of my half-finished Skyline under Stressed (only y and z axis dimensions are correct, wheels are obviously not inserted, etc.). When the shape is closer to completion and I have the small issues fully solved I'll post the detailed procedure I'm using to achieve those results.

    CAn we create custom paint jobs? I mean with drawings or names or anything like that?

    In principle, we can - the only limits are number of vertexes and polygons and, depending on which tools we use, .OBJ import/export capabilities. Detailed writings or logos might be a bit hard, but if you can provide the workarounds, sky is the limit.  :)

    PS1.: It seems there's another SVN update for Stressed, I'm going to catch it  ;)
    PS2.: Dstien/Zak, could you please make this topic a sticky?
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Mark L. Rivers on October 14, 2008, 11:10:48 PM

    @dstien

    I saw with very pleasure the 2nd release of your wonderful tool on the closed topic, and I tried immediately to use it  :), but... the tool return me the error you can see in the attached image...  ???
    With 1st release I have not problem... Have you a workaround to suggest me?
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: dstien on October 15, 2008, 12:13:51 AM
    Have you a workaround to suggest me?
    Open the file in the previous build, in the field called "Depth" assure that the value never exceeds 3. If you didn't modify those values yourself you may have found some new flags...

    If you enter integer values, Anim8or will export them without adding decimal points, which in turn will make Stressed fail to import the resulting .OBJ (as it expects input with decimal points).
    This may have been fixed now. I'm not sure what I was thinking when I wrote the original OBJ vertex regex. :D

    You're right about Blender, my biggest beef about it is its lack of native ngons support.

    PS2.: Dstien/Zak, could you please make this topic a sticky?
    Hm, I don't know. Shouldn't we try to branch out into new threads now that we've got a whole new forum? This humongous thread contains some speculation and misinformation on my behalf, nobody should rely on it as a source of information for other than archaeological purposes. :)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: CTG on October 15, 2008, 04:47:39 AM
    Two questions:

    1, Can you give labels to polygons to help grouping in Stressed (or are you planning to give an option like that?)? That would be a very useful aid for car designers!

    2, Is it possible to change the position of speedometer and RPM indicator sticks?
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: CTG on October 15, 2008, 04:15:48 PM
    What an evolution since my last visit: new cars, pack of possibilities! I'm shocked in the positive meaning of the word. Dstien, Duplode and Mark: thank you for this incredible work! It's amazing to see your dashing innovations!

    I also have some questions: Do you know how to convert any downloaded pictures into Stunts compatible indexed 8-bit PNG to change the horizont or any other .pvs files? Have you thought on a user friendly CarBlaster with easier and more didactical handling? Is there any site for uploading and downloading new cars? What about the sound/music decoding? (sorry for asking too much but this topic is more than interesting! ;))
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: dstien on October 15, 2008, 07:59:13 PM
    1, Can you give labels to polygons to help grouping in Stressed (or are you planning to give an option like that?)? That would be a very useful aid for car designers!
    We could make our own resource types for storing meta data, but I don't think it's worth the effort. Again, I'd like to stress that stressed is not supposed to become a high-level modelling tool. I'm too lazy to do that. :D

    2, Is it possible to change the position of speedometer and RPM indicator sticks?
    According to Duplode CarBlaster allow you to change these variables. Said pipsqueak have documented the car parameters (http://wiki.stunts.hu/index.php/Car_parameters) very well, so implementing it in stressed should be straight forward.

    I also have some questions: Do you know how to convert any downloaded pictures into Stunts compatible indexed 8-bit PNG to change the horizont or any other .pvs files? Have you thought on a user friendly CarBlaster with easier and more didactical handling? Is there any site for uploading and downloading new cars? What about the sound/music decoding? (sorry for asking too much but this topic is more than interesting! ;))
    Thanks for the kind words. Stressed can import and export PNGs. As long as the original image dimensions and unknown values are maintained existing bitmap resources can be replaced. There aren't any addon repositories yet, but I'm sure the marked will respond when there's demand. I don't see much value in sound addons, but reversing the formats sure is an interesting challenge.
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Duplode on October 16, 2008, 12:40:57 AM
    Is there any site for uploading and downloading new cars?

    As Dstien said, the demand will eventually call for it - for instance, the recent improvements in Stressed coupled with Zak's new car contest means we'll probably have at least four new or vastly overhauled cars by November 30th  :)

    (sorry for asking too much but this topic is more than interesting!  ;))

    Yeah, it is well on the way to #5 spot on number of posts...  :D

    Now Dstien, I have a quick feature request for Stressed: could you change the 3D shape exporting function so wheels are exported as hexagons and spheres as lines? That way the information about which vertexes were connected to form the special shapes wouldn't be lost while working with the .OBJ on an external editor, and when we would import the shape back we would just need to change back the primitive types to wheel or sphere.
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Duplode on October 19, 2008, 11:52:46 PM
    Dstien updated the Wiki (http://wiki.stunts.hu/index.php/Resource_file_format#3d_shapes) solving the riddle of how the angular culling bytes (Unknown1 and Unknown2) work - a very cool find, I'd never have the insight of looking for bit-level data structures! :o

    Additionally, after struggling quite a bit I found a way around my issues with rear lights and other details placement. Z-bias was not working correctly for me because I had not realized it is sensitive to polygon order. If you need to overlay details over a body panel with Z-bias and it's not working, ensure that the relevant body panel is placed ahead of the details in the polygon list. Another weird problem I had was with rear wheels - their orientation didn't follow the rest of the car when the camera was rotated. That problem had to do with which coordinate values you use define the different radii of the wheel. Quoting Dstien's (attached) scheme for the wheels, we have:

    (http://wiki.stunts.hu/images/3/38/Wheel_Primitive_Anatomy.png)

    Points 3 and 6 define the inner radius of the wheel (or the radius of the wheel proper) on its internal and external faces, respectively. They are the points which are off-center in the z-axis with respect to the rest of the wheel. In order to have the wheels rendered properly, the z coordinates of points 3 and 6 must be set according to the table below. "+" indicates the z coordinate must be larger than the rest of the wheel (that is, it must be ahead of), and vice-versa for "-":

    Wheel      Point 3Point 6
    Front/Left ++
    Front/Right-+
    Back/Right-+
    Back/Left  ++

    Hopefully that can help CTG with the "minor display errors" and "wheel disorders" he was having on his Lada Laika...  :)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: dstien on October 20, 2008, 01:59:16 AM
    could you change the 3D shape exporting function so wheels are exported as hexagons and spheres as lines?
    Does it work as intended if you comment out line 484 of src/shape/shaperesource.cpp?

    Dstien updated the Wiki (http://wiki.stunts.hu/index.php/Resource_file_format#3d_shapes) solving the riddle of how the angular culling bytes (Unknown1 and Unknown2) work - a very cool find, I'd never have the insight of looking for bit-level data structures! :o
    Finding the 18 seconds penalty shortcut in Z88 mentioned by CTG seems a lot tougher... :)

    I've tried to come up with a way to visualize the culling data using four discs. The two outer ones in green (first facing up, next facing down) are part of what I've called "horizontal cull data". The two inner ones in yellow are "vertical cull data". This screenshot probably illustrates this better than my incoherent English:
    (http://surr.no/pub/2008-10-20-Stunts_cull_data.png)
    Set bits are marked with red/magenta. The patterns are clearly matching the model's vertical or horizontal polygons. I'm not quite sure how it works for inclined surfaces, so I haven't attempted to implement an algorithm for generating this data yet. Maybe you can help me making some sense of it with your academic background? ;)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Duplode on October 20, 2008, 06:01:06 PM
    Does it work as intended if you comment out line 484 of src/shape/shaperesource.cpp?

    Yes, it did the trick  ;)

    I've tried to come up with a way to visualize the culling data using four discs. The two outer ones in green (first facing up, next facing down) are part of what I've called "horizontal cull data". The two inner ones in yellow are "vertical cull data". This screenshot probably illustrates this better than my incoherent English:

    Set bits are marked with red/magenta. The patterns are clearly matching the model's vertical or horizontal polygons. I'm not quite sure how it works for inclined surfaces, so I haven't attempted to implement an algorithm for generating this data yet. Maybe you can help me making some sense of it with your academic background? ;)

    Very ingenious scheme... :) After looking with a puzzled expression at all the colorful tiles for a while, I got to understand it properly... except it is still not clear to me what is the purprose of the negative direction half (mask 0x0001FFFC / the underside of the disks) of the culling data, as I (maybe for not looking that hard into it) could not find any example of in-game shape where one might identify which viewing directions are covered by it. Once I understand that, I can try to help  :)

    And finally, a rather wild suggestion on how to make the displaying/editing of culling data more transparent (if a bit more complicated): Perhaps the program might read the unknown flags, display them as checkboxes and then display the remaining 30 culling bits as a pair of 5-digit octals. That way, each octal digit would amount to exactly three circle sectors, and thus one would be able to read/write patterns more easily.

    (Edit: the original post mentioned dividing the 32-bit set by 4, rounding down, to drop the final bits, which is obviously pointless if you can just pick the 30 initial bits and do whatever you need with them...)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: dstien on October 21, 2008, 03:03:54 AM
    Points 3 and 6 define the inner radius of the wheel (or the radius of the wheel proper) on its internal and external faces, respectively.
    This turned out to be complete baloney. It looks like all the points outside the center of the wheel marks the radius. As discussed recently (http://forum.stunts.hu/index.php?topic=2225.msg38136#msg38136) in the Lada thread, the height:length ratio is not 1:1, so the wheels are actually elliptical. The tyre width is decided by the game.

    Very ingenious scheme... :) After looking with a puzzled expression at all the colorful tiles for a while, I got to understand it properly... except it is still not clear to me what is the purprose of the negative direction half (mask 0x0001FFFC / the underside of the disks) of the culling data, as I (maybe for not looking that hard into it) could not find any example of in-game shape where one might identify which viewing directions are covered by it.
    Look at polygons facing down, such as the bottom of a car body.

    And finally, a rather wild suggestion on how to make the displaying/editing of culling data more transparent (if a bit more complicated): Perhaps the program might read the unknown flags, display them as checkboxes and then display the remaining 30 culling bits as a pair of 5-digit octals. That way, each octal digit would amount to exactly three circle sectors, and thus one would be able to read/write patterns more easily.
    I was hoping we wouldn't need to edit this data manually, but I'll put it on my list.

    (Edit: the original post mentioned dividing the 32-bit set by 4, rounding down, to drop the final bits, which is obviously pointless if you can just pick the 30 initial bits and do whatever you need with them...)
    The usual way to this is to read the interesting bits through a mask (http://en.wikipedia.org/wiki/Mask_(computing)) and then do a shift operation (http://en.wikipedia.org/wiki/Arithmetic_shift).
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Duplode on October 22, 2008, 06:30:24 AM
    Look at polygons facing down, such as the bottom of a car body.

    Indeed - there is a very good illustration of that: the floor of the cargo section of LM002's car1. It has 0xFFFE0002 for Cull H and thus is only visible from above.

    After looking a bit more at the culling data displays, I realized I understood them less than I thought, so I decided to finally build a debug shape (a cute pair of multicolored giant dices) and watch the bits in action systematically. Some of the observations actually enhanced my confusion, but others were quite definite. While you may well have realized quite a few of those already, I'll summarize them:



    Overall, I find the facts above somewhat bewildering... but if they are correct, it might be feasible to work with less variables while implementing the rest of the culling stuff. At least for a while, maybe... :)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: dstien on October 26, 2008, 03:48:10 PM
    And finally, a rather wild suggestion on how to make the displaying/editing of culling data more transparent (if a bit more complicated): Perhaps the program might read the unknown flags, display them as checkboxes and then display the remaining 30 culling bits as a pair of 5-digit octals. That way, each octal digit would amount to exactly three circle sectors, and thus one would be able to read/write patterns more easily.
    Done.

    As for the vertex list remarks, there is another relevant characteristic of Stressed 3D editor associated to that issue: when you pick a polygon and edit one of its vertex coordinates, what Stressed actually does is to create a new vertex and replace the original one in the chosen polygon, instead of updating the old vertex position. Not only that makes it necessary to adjust all adjacent polygons to displace a vertex, it also means large-scale edition of complex 3D shapes with ~200 vertexes (some of the more detailed car0 shapes, like Corvette and Audi, have about that number IIRC) is probably impossible under Stressed.
    I've implemented a compromise, check the "weld coexisting" box below the vertex list to update all vertices with the same position simultaneously. Stressed doesn't save any duplicated vertices, so scaling existing models is not a problem.

    After looking a bit more at the culling data displays, I realized I understood them less than I thought, so I decided to finally build a debug shape (a cute pair of multicolored giant dices) and watch the bits in action systematically. Some of the observations actually enhanced my confusion, but others were quite definite.
    Thanks for the details. Some of the culling data makes perfect sense, and some do not. Maybe some of it was edited manually by the game designers?
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: CTG on October 27, 2008, 09:42:11 AM
    Only an idea for Stressed innovation: to make the car edition faster, it would be cool to have a special duplicating option which converts the new polygon to inverse X coordinates.
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Duplode on October 27, 2008, 06:58:09 PM
    Only an idea for Stressed innovation: to make the car edition faster, it would be cool to have a special duplicating option which converts the new polygon to inverse X coordinates.

    On that same line, one addition I'd propose would be vertex reordering in polygons, so it would be easier to flip their faces. Anyway, both major recent changes - culling data displays and weld coexisting vertexes - were really useful and help a long way in making Stressed a capable 3D editor for Stunts shapes, in particular for testing and experimentation. Just one small thing, Dstien: it seems you inserted back that 49x line on shaperesource.cpp which (tries to) export wheels as lines. Could you please revert it to r35 behaviour? Thanks in advance  :)

    Now, on to further experimentation: after a lot of head-scratching, I have a reasonable, semi-functional, theory on how the four culling bit sets work. Explaining it tersely:


    The scheme presented above seems to work well in most usual cases, in particular for vertical or near-vertical polygons. Sometimes it's hard to assess whether the expected results are being attained or not due to limitations on the viewing angles available from F3 camera (that is specially annoying when trying to identify culling at POVs from below). Horizontal polygons sometimes cause trouble too: the theory partly breaks apart when trying to make downwards-facing polygons visible from above, for instance - it seems that CH+ and CV+ both need to be set in such case (a good, and annoying, demonstration exercise is attempting to, without using two-sidedness, make the floor of a car visible from above (after making the roof/hood invisible), or tunnel roofs for that matter...). Nevertheless, a number of common culling data patterns seem to make sense now: for instance, the fact that front-facing from-above POVs are the ones which are the primary concern most of the time when modeling a car explains why I previously though only CH+ was relevant. On the other hand, when looking at a car floor it becomes apparent it's CH- which dictates its visibility. Some of the trends when comparing CH+ to CH-, CV+, etc. for horizontal, vertical and oblique polygons also begin to make sense from that perspective (and thus a method for generating them might be viable), although it seems the values were indeed hand-edited to some extent...
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: dstien on October 28, 2008, 02:08:35 AM
    Only an idea for Stressed innovation: to make the car edition faster, it would be cool to have a special duplicating option which converts the new polygon to inverse X coordinates.

    On that same line, one addition I'd propose would be vertex reordering in polygons, so it would be easier to flip their faces. Anyway, both major recent changes - culling data displays and weld coexisting vertexes - were really useful and help a long way in making Stressed a capable 3D editor for Stunts shapes, in particular for testing and experimentation.
    Added both features in SVN, although this can already be done with existing 3d modelling software...

    Just one small thing, Dstien: it seems you inserted back that 49x line on shaperesource.cpp which (tries to) export wheels as lines. Could you please revert it to r35 behaviour? Thanks in advance  :)
    Hm, are you sure? It doesn't look like (http://code.google.com/p/stuntstools/source/browse/trunk/stressed/src/shape/shaperesource.cpp?r=44#542) I reversed the change...

    Now, on to further experimentation: after a lot of head-scratching, I have a reasonable, semi-functional, theory on how the four culling bit sets work.
    Thank you! I'll need a little more time to digest it and do some experiments. I think we'll fully solve the mystery in time for Zak's submission deadline. 8)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Duplode on October 28, 2008, 03:04:56 AM
    Added both features in SVN, although this can already be done with existing 3d modelling software...

    Thanks for catering to our requests so quickly!  :) Although I use Anim8or for heavier edition work Stressed 3D capabilities are quite convenient for adding small overlaid details and doing quick tests - exporting to .OBJ means losing culling data and the other flags, as well as often some polygon reordering. Speaking of that, I have one last solicitation (okay, you can kick me now... :D): a widget for moving a polygon to an arbitrary position on the list - say, moving polygon #45 to position #110. The polygons shouldn't be swapped, however: in said example, polygon #46 should go to #45, #47->#46 and so on. This addition is important because of Z-bias, as it requires any overlaid polygon to be ordered directly after the base polygon. Fixing the order of a number of polygons can be a bit tiring sometimes, and that's one of the reasons why I often get lazy about exporting intermediate models to .OBJ...  :)
    (PS.: And before I forget, I saw the improved material list, and it was a nice addition as well)

    Hm, are you sure? It doesn't look like (http://code.google.com/p/stuntstools/source/browse/trunk/stressed/src/shape/shaperesource.cpp?r=44#542) I reversed the change...

    As expected, you're correct. I had commented out that line manually and then placed a backup of the file on src/shape, so SVN must have messed up a bit during the multiple updates. Problem solved, anyway...
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: dstien on October 28, 2008, 07:21:56 PM
    Speaking of that, I have one last solicitation (okay, you can kick me now... :D): a widget for moving a polygon to an arbitrary position on the list - say, moving polygon #45 to position #110. The polygons shouldn't be swapped, however: in said example, polygon #46 should go to #45, #47->#46 and so on.
    Done, and I also made a new Win32 build. Now to wrap my head around the culling...
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: CTG on October 29, 2008, 12:18:14 AM
    Done, and I also made a new Win32 build. Now to wrap my head around the culling...

    Great job again! What are your long term plans with Stressed?
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: cody on October 29, 2008, 12:52:06 AM
    i have 2 ideas for stressed:
    1, have the ability to scale ,move, rotate polygons from within stressed
    2, add the ability to merge in excisting .p3s and .3sh's (this can be helpful when adding parts of another car)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Duplode on October 29, 2008, 02:06:10 AM
    Now to wrap my head around the culling...

    Beware not to get hit! (as your head won't be visible... ;D)

    (sorry for not sparing you from such a poor joke...)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: dstien on November 04, 2008, 03:25:35 AM
    What are your long term plans with Stressed?
    Keep on adding stuff untill I get bored. Car tuning is next up.

    i have 2 ideas for stressed:
    1, have the ability to scale ,move, rotate polygons from within stressed
    I'm sorry, this would require a full rewrite and a lot of boring work. :-[
    2, add the ability to merge in excisting .p3s and .3sh's (this can be helpful when adding parts of another car)
    I'll add it to my todo list.

    Now to wrap my head around the culling...

    Beware not to get hit! (as your head won't be visible... ;D)

    (sorry for not sparing you from such a poor joke...)
    I survived both the culling and the joke, but it looks like we have a casualty in terms of laptop screens...

    There is no such a thing as vertical culling.
    Indeed, the second culling data appears to be horizontal culling around the Y-axis as well. I just can't figure out where/if this information is used at all.

    The flags indicates angle ranges between polygon planes and the global Y-axis:
    Code: [Select]
    Flag  Range
    ----  -----
    Far+  0° - 135°
    Far-  45° - 180°
    Near+ 0° - 45°
    Near- 135° - 180°
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Duplode on November 04, 2008, 06:23:59 AM
    Keep on adding stuff untill I get bored. Car tuning is next up.

     8) - I don't know what your feelings are about elaborate graphical displays of torque curves and meter needle positions, but whathever the case, that will be sweet. It deserves another 8)

    Indeed, the second culling data appears to be horizontal culling around the Y-axis as well. I just can't figure out where/if this information is used at all.

    The data we used to call "Cull V" is horizontal culling just like for "Cull H" indeed, but CH acts only on wiew positions facing the front of the polygon, while CV acts on views facing the back face. Or at least that's what the tests led me to believe on...

    The flags indicates angle ranges between polygon planes and the global Y-axis:
    Code: [Select]
    Flag  Range
    ----  -----
    Far+  0° - 135°
    Far-  45° - 180°
    Near+ 0° - 45°
    Near- 135° - 180°

    Hmm, that sounds interesting and may poteintially explain quite a lot of stuff (my failure in controling visibility of bridge undersides comes to mind). I will play with this as soon as I get to boot Stressed again.

    ---

    PS.: And BTW, a completely unrelated piece of info: while setting up the Skyline dashboard, I found that the two final 16-bit integers on bitmap resources "Unknown 1" are just X and Y screen coordinates for positioning the bitmaps.
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: dstien on November 15, 2008, 05:32:47 AM
    Keep on adding stuff untill I get bored. Car tuning is next up.

     8) - I don't know what your feelings are about elaborate graphical displays of torque curves and meter needle positions, but whathever the case, that will be sweet. It deserves another 8)
    Do you know how to draw the torque curve?

    The data we used to call "Cull V" is horizontal culling just like for "Cull H" indeed, but CH acts only on wiew positions facing the front of the polygon, while CV acts on views facing the back face. Or at least that's what the tests led me to believe on...
    I'm not sure what you mean by back face in this context, but I've implemented some code to compute the culling data. It took a while, ZCT89 almost made me lose all faith in this game. :D

    I'm currently using rough approximation to set the number of bits based on the polygon's angle on the Y-axis. The number of bits was determined by analyzing 3000 polygons from the stock shapes. The direction is then set by rotating according to the angle around the Y-axis on the XZ-plane. Although we should check the range covered by each bit, the current solution appears to be surprisingly accurate. The only in-game test I've done so far was on Cody's Ranger. With proper culling data the glitchy polygons in the car selection screen disappeared! But will it make any difference performance-wise?

    PS.: And BTW, a completely unrelated piece of info: while setting up the Skyline dashboard, I found that the two final 16-bit integers on bitmap resources "Unknown 1" are just X and Y screen coordinates for positioning the bitmaps.
    I noticed your wiki edit, nice find! It looks like the game ignores these values when reading animation frames, I had only tested with opponent animations.
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Duplode on November 16, 2008, 12:37:28 AM
    Do you know how to draw the torque curve?

    Well, I know where to find the values (0x60 to 0xC7 of CAR*.RES) and have a reasonable estimate on how they correlate to "real" physical values, if that's what you meant by draw. By "elaborate graphical displays" I meant displaying the torque versus rpm values on the screen as a graph, and something analogous for the meter X and Y coordinates (and no, I can't program this sort of drawing... :D).

    I'm not sure what you mean by back face in this context, (...)

    Front and back face were used in the usual sense of "sidedness", according to the orientation of the normal. If you change vertexes order from clockwise to counter-clockwise you exchange front and back faces, and so on. Now, if you pick a polygon and set both C1+ and C2+ to 77777 and 77777 you'll see that, for "large" distances, it will be visible regardless of whether you are looking at the front face or the back face. With 00000 and 77777 it will be as if the front and back faces were reversed. The vertex order and Z-bias flag only are active for "short" distances; for "long" distances C1+ and C2+ do the horizontal culling. I still can't understand C1- and C2-, though...

    I'm currently using rough approximation to set the number of bits based on the polygon's angle on the Y-axis. The number of bits was determined by analyzing 3000 polygons from the stock shapes.

     :o :o

    The direction is then set by rotating according to the angle around the Y-axis on the XZ-plane. Although we should check the range covered by each bit, the current solution appears to be surprisingly accurate. The only in-game test I've done so far was on Cody's Ranger. With proper culling data the glitchy polygons in the car selection screen disappeared!

    I tested the solution for the Skyline, and it seems to be working perfectly indeed, both for car0 and car1  :) Users should only avoid using non-planar polygons or polygons with three or more co-linear vertexes, or be ready to fix the culling data, as the normal determination may not work properly in those cases (that is, obviously, not fault of your code...). Re-calculating the culling data for the default cars, your approximation matches the original patterns very well, usually only setting one or two extra bits on at most per polygon (it's better to set more bits on than less, anyway).

    But will it make any difference performance-wise?

    Testing with the downscaled Corvette car0 shape I mentioned some posts ago, the minimum number of DOSBox cycles needed for reasonable fluency with two cars loaded has dropped from 16000 to 14000. Some improvement, but still not enough to use shapes with ~200 polygons...  :-\

    I noticed your wiki edit, nice find! It looks like the game ignores these values when reading animation frames, I had only tested with opponent animations.

    The game ignores those coordinates for moving parts of the dashboard as well, which have their positions controlled by CAR*.RES.
    Speaking of bitmaps, there is one feature that will probably be necessary: a "Color to alpha..." option. I have not found a way to use the FF value of the palette and/or preserving the transparency within GIMP during the Import/Export cycle, so I had to paint the areas I wished to define as transparent with an unused colour from the palete and them replace it by FF on an hex editor. Allowing for that substitution to be done within Stressed is probably the easiest solution for the issue.
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Duplode on November 22, 2008, 10:20:23 PM
    Just checked in the new updates which include alpha handling on import; will give them a try in order to finish whl_ and ins_ details on the Skyline dashboard. Thanks!  ;)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: dstien on November 26, 2008, 09:07:57 AM
    Users should only avoid using non-planar polygons or polygons with three or more co-linear vertexes, or be ready to fix the culling data, as the normal determination may not work properly in those cases (that is, obviously, not fault of your code...).
    I don't think this is a problem, it looks like polygons has to be convex (http://en.wikipedia.org/wiki/Convex_polygon) anyway in order to render properly. Also, if you look at primitives such as 34 and 35 in STAUDI.P3S:car0 you'll see that the cull calculation failed for the game designers as well. The polygons in question are probably the result of integer rounding and should actually be discarded due to lack of precision...

    But will it make any difference performance-wise?

    Testing with the downscaled Corvette car0 shape I mentioned some posts ago, the minimum number of DOSBox cycles needed for reasonable fluency with two cars loaded has dropped from 16000 to 14000. Some improvement, but still not enough to use shapes with ~200 polygons...  :-\
    That's what I feared since the culling doesn't seem to affect close-up views. Have you tried running Stunts natively under Windows? I have mixed experiences with DOSBox overall performance, maybe we'll have more luck running DOS in a "serious" virtual x86 machine?

    I have not found a way to use the FF value of the palette and/or preserving the transparency within GIMP during the Import/Export cycle, so I had to paint the areas I wished to define as transparent with an unused colour from the palete and them replace it by FF on an hex editor.
    Ah, I never tested it. :D

    SVN revision 50 introduced Y-axis correction in the 3d view. Shapes shouldn't look vertically stretched anymore compared to in-game rendereing. This doesn't affect OBJ import/export, but you can stretch the shape before exporting from your 3d editor. I'm currently using the ratio 1.0 in data set = 0.8 on screen, that's the ratio used by the stock car wheels.
    Title: A question for everyone:
    Post by: Duplode on May 02, 2009, 01:58:06 AM
    Which of these pairs of screenshots resemble more what you are used to see when playing Stunts? And which pair looks best? (it would be nice to have the opinion of both DOSBox users and people which still play on pure DOS, or at least remember clearly how it was like).

    Pair 1:

    (http://i49.photobucket.com/albums/f283/Duplode/wideratio.png)

    (http://i49.photobucket.com/albums/f283/Duplode/wideratio2.png)

    Pair 2:

    (http://i49.photobucket.com/albums/f283/Duplode/tallratio.png)

    (http://i49.photobucket.com/albums/f283/Duplode/tallratio2.png)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: BonzaiJoe on May 02, 2009, 01:55:44 PM
    I think the bottom one looks more familiar to me. Only it's a bit more grainy than usually. Lower graphics acceleration level?
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Chulk on May 02, 2009, 08:05:27 PM
    I think the bottom one looks more familiar to me. Only it's a bit more grainy than usually. Lower graphics acceleration level?
    Exactly my thoughts (in DOSBox)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Duplode on May 02, 2009, 11:23:41 PM
    I think the bottom one looks more familiar to me. Only it's a bit more grainy than usually. Lower graphics acceleration level?

    Exactly my thoughts (in DOSBox)

    Hmmm, that's... surprising, at least for me. The difference between the images is aspect ratio, which is 8:5 (as in 320x200) on the first set and 4:3 (as in 320x240) on the second. DOSBox switched from 8:5 (like I used to play) to 4:3 on setting the "aspect=true" option on the configuration file. Results are somewhat ambiguous. Using 4:3, some bitmaps (such as the main menu road signs and some of the round speedometers) become visibly vertically stretched, but on the other hand the steering wheels look much rounder and the original cars suddenly look much better:

    (before, at 8:5...)

    (http://i49.photobucket.com/albums/f283/Duplode/wideratio4.png)

    (...and after, at 4:3)

    (http://i49.photobucket.com/albums/f283/Duplode/tallratio3.png)

    In fact, if you are running at 8:5 and try to measure (with a desktop ruler) the pixel dimensions of the car when seen from above, from behind and laterally, you'll realize the measurements on each perspective do not match! Changing the aspect ratio makes most cars a lot more proportional, as you can see in the pics... except for the Skyline: since I ignored dstien's advice to multiply the vertical coordinates by 0.833 (because I though Stunts was at fault, and not my design or my settings), now it looks like a skidding war tank with the correct aspect ratio - to the point I'm starting to consider a bugfix release... :-X I feel a bit silly now for taking so long to realize there was something wrong. Anyway, the main point is that DOSBox users should test the 'aspect=true' setting (if they're not using it already) and see if they get better results - I guess that will be the case.
     
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Overdrijf on May 03, 2009, 11:30:27 AM
    I had completely missed that while looking at these pictures, but yes, it's a known effect. My kart is going to be sort of designed for that. Stunts itself renders the screen as 320*200, but stretches itself to 640*460.
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: dstien on May 28, 2009, 02:28:41 PM
    Just upgraded to DOSBox 0.73. Aspect ratio in Stunts is now 4:3 using the new svga_s3 graphics mode (default out of the box).
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Duplode on May 28, 2009, 05:23:32 PM
    Just upgraded to DOSBox 0.73. Aspect ratio in Stunts is now 4:3 using the new svga_s3 graphics mode (default out of the box).

    Oh, that is very good, thanks for making us aware! But it also means there will be a bugfix release for Skyline soon - I can't accept that 90% of the users will have it as tall as a Hummer...
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Overdrijf on August 26, 2010, 05:03:01 PM
    I have discovered something (okay, only sort of, but still). Can you imagine, me?

    To explain what I'll start by quoting the wiki:
    Quote
    Text data
    Car information
    Data type: Zero-terminated character strings

    Address: 32Eh - ???h

    Quoting Lukas Loehrer directly:

    Car information displayed on the 'choose your car' screen. Use ] (5Dh) for linebreaks. The end of this block can not be given by an absolute address. Look for a byte with the value 00h. It is followed by a 4 byte long car id which is again terminated by a 00h.
    The "4 byte long car id" mentioned above is the abbreviation displayed alongside opponent name in the scoreboard. Car information is most conveniently edited via Car Blaster, which has a specific WYSIWYG interface for dealing with it.

    Scoreboard car name
    Data type: Zero-terminated character string

    Address: ???h - EOF

    The final bytes of the file (after the terminating 00h mentioned above) make up the scoreboard designation of the car. It can be edited via Car Blaster like the other text pieces as well.

    This information is incomplete. It's possible that the end of the information text is identified by a 00h, but the beginning of the "opponent abbreviation" as well as the beginning of the car name are identified by an adress. The position of the abbreviation is identified by the last address in the first 25h bytes, the position of the car name by the second to last address. Both are 25h smaller than the actual value, meaning the adress points at where to be from after the first 25h bytes. Now I'm pretty sure that anyone who worked on carblaster or something similar would already know this, but I still find it pretty cool I discovered something the wiki didn't know yet. ;)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Duplode on September 01, 2010, 02:40:42 AM
    This information is incomplete. It's possible that the end of the information text is identified by a 00h, but the beginning of the "opponent abbreviation" as well as the beginning of the car name are identified by an adress. The position of the abbreviation is identified by the last address in the first 25h bytes, the position of the car name by the second to last address. Both are 25h smaller than the actual value, meaning the adress points at where to be from after the first 25h bytes. Now I'm pretty sure that anyone who worked on carblaster or something similar would already know this, but I still find it pretty cool I discovered something the wiki didn't know yet. ;)

    Yup, those are the resource "pointers" on the file header, which actually set where the text pieces should start. The 00h is a legacy of C programming, in which all text strings are terminated by the "null character" 00h byte. In fact, I guess that even if you change the header addresses to extend some of these text fields the string will still end at the 00h unless it is removed...
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Overdrijf on September 01, 2010, 08:24:56 AM
    This information is incomplete. It's possible that the end of the information text is identified by a 00h, but the beginning of the "opponent abbreviation" as well as the beginning of the car name are identified by an adress. The position of the abbreviation is identified by the last address in the first 25h bytes, the position of the car name by the second to last address. Both are 25h smaller than the actual value, meaning the adress points at where to be from after the first 25h bytes. Now I'm pretty sure that anyone who worked on carblaster or something similar would already know this, but I still find it pretty cool I discovered something the wiki didn't know yet. ;)

    Yup, those are the resource "pointers" on the file header, which actually set where the text pieces should start. The 00h is a legacy of C programming, in which all text strings are terminated by the "null character" 00h byte. In fact, I guess that even if you change the header addresses to extend some of these text fields the string will still end at the 00h unless it is removed...
    It appears to do so, it terminates at a 00h, but I still found it to be quite annoying having the name on the scoreboard being stuff like ]prize etc etc, so I was pretty happy about finding the address. :)
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: CTG on November 08, 2012, 03:51:37 PM
    Is it possible to place the rev meter outside of the steering wheel's "hole"?
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Duplode on November 09, 2012, 12:44:46 AM
    Is it possible to place the rev meter outside of the steering wheel's "hole"?

    I have not tried it myself, but it must be possible. The rev meter and speedometer coordinates are relative to the coordinates of the ins2 bitmap, so if you place that outside the steering wheel hole the meters should follow accordingly.
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: CTG on December 14, 2012, 08:34:11 AM
    Laika, LOL! (poor dog) ;D Lada 2105 was one of the most common cars in Hungary in the late 80's - early 90's and it's still quite popular. No surprise, we used to be a communist country... By the way it was the best car available for the Eastern European block, maybe only Skoda 120 (another target of my Stunts car designing ambitions ;D) was on the same level.

    OFF-TOPIC:

    Most of the communist cars disappeared in the last 4-5 years. I tried to monitor the traffic this morning during the usual 30 minutes travel to work and only 7 cars from about 1000 were from that era: 2x Wartburg 353 (4 stroke upgrade ;D), Lada Niva, Skoda 120, Polski Fiat 126, Zil 130 (truck) and a Trabant 601 wreck without wheels. And of course Ikarus 260, but I'm not sure if they are older than 22 years or not (they were produced even in the 90s).
    Title: Re: Dissecting the Stunts files, trying to. Anyone know more?
    Post by: Overdrijf on January 10, 2013, 10:01:37 PM
    Is it possible to place the rev meter outside of the steering wheel's "hole"?

    I have not tried it myself, but it must be possible. The rev meter and speedometer coordinates are relative to the coordinates of the ins2 bitmap, so if you place that outside the steering wheel hole the meters should follow accordingly.

    This comes a bit late probably, but I have tried this, it works without a hitch. It might be a different matter if you try to take only the rev meter out while leaving the speedo in, but together with the extra sprites that help change/partially cover the meters when the wheel turns it should be doable. ins2 will become big, but as long as you can find the right mystery bites...