Poll & Discussion: We wish the site to continue (Y/N)
StuntGP 3D/2D Files (.PC and .PMD)
-
- beginner
- Posts: 27
- Joined: Sun Aug 31, 2014 5:39 am
- Has thanked: 2 times
- Been thanked: 2 times
StuntGP 3D/2D Files (.PC and .PMD)
So, a friend of mine started working on StuntGP files https://yethiel.wordpress.com/2017/04/2 ... ructure-1/ to try and make the vehicles and tracks work in another RC racing game, and so far he needs to figure out the 3D and 2D file formats of them.
Source files can be found here for experimenting: http://files.re-volt.io/sgp/game_assets.7z
Any help is welcome.
Source files can be found here for experimenting: http://files.re-volt.io/sgp/game_assets.7z
Any help is welcome.
- shakotay2
- MEGAVETERAN
- Posts: 4146
- Joined: Fri Apr 20, 2012 9:24 am
- Location: Nexus, searching for Jim Kirk
- Has thanked: 1127 times
- Been thanked: 2162 times
Re: StuntGP 3D/2D Files (.PC and .PMD)
yeah, it surely has. While it's easy to get some decent point cloud (277 vertices) the face indices are a mess. You have to find out how they have to be used. I tried out triangle strips with some lines commented out (#) seeming unlogical to me but they are part of the "system", resulting mesh is still a mess.Matsilagi wrote:Bump.
Its been some time,
f 3 2 1
f 2 6 1
f 1 6 5
f 6 4 5
f 5 4 9
f 4 8 9
f 9 8 7
f 8 12 7
f 7 12 11
f 12 10 11
f 11 10 12
f 10 13 12
#f 12 13 11
f 11 13 14
f 13 9 14
f 14 9 15
f 9 11 15
#f 15 11 13
f 13 11 7
f 11 10 7
f 7 10 15
f 10 9 15
f 15 9 7
f 9 16 7
f 7 16 8
f 16 14 8
f 8 14 10
f 14 17 10
f 10 17 12
f 17 7 12
f 12 7 8
f 7 16 8
f 8 16 10
f 16 7 10
#f 10 7 17
f 17 7 16
f 7 18 16
f 16 18 20
f 18 1 20
f 20 1 19
f 1 3 19
f 19 3 21
f 3 2 21
f 21 2 22
f 2 12 22
f 22 12 1
f 12 2 1
f 1 2 23
f 2 1 23
f 23 1 12
f 1 22 12
f 12 22 24
f 22 27 24
f 24 27 26
f 27 25 26
f 26 25 12
f 25 30 12
f 12 30 29
f 30 28 29
f 29 28 14
f 28 25 14
f 14 25 26
f 25 31 26
f 26 31 33
f 31 32 33
#f 33 32 14
f 14 32 34
f 32 29 34
# line with 34 29 35 missing?
f 29 34 35
f 35 36 37
f 37 36 40
f 36 39 40
f 40 39 28
#f 39 38 28
f 28 38 43
f 38 42 43
#f 43 42 41
f 41 42 43
f 42 44 43
f 43 44 47
f 44 46 47
#f 47 46 45
f 45 46 49
f 46 48 49
f 49 48 51
f 48 45 51
You do not have the required permissions to view the files attached to this post.
Tuts: a) Bigchillghost, viewtopic.php?f=29&t=17889
b) Extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
Some things will never change.
"You quoted the whole thing, what a mess."
b) Extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
Some things will never change.
![rolleyes [roll]](./images/smilies/icon_rolleyes.gif)
"You quoted the whole thing, what a mess."
-
- beginner
- Posts: 27
- Joined: Sun Aug 31, 2014 5:39 am
- Has thanked: 2 times
- Been thanked: 2 times
Re: StuntGP 3D/2D Files (.PC and .PMD)
Hmm, for the faces i can recognize the car but indeed, the final result is still not optimal.shakotay2 wrote:yeah, it surely has. While it's easy to get some decent point cloud (277 vertices) the face indices are a mess. You have to find out how they have to be used. I tried out triangle strips with some lines commented out (#) seeming unlogical to me but they are part of the "system", resulting mesh is still a mess.Matsilagi wrote:Bump.
Its been some time,
f 3 2 1
f 2 6 1
f 1 6 5
f 6 4 5
f 5 4 9
f 4 8 9
f 9 8 7
f 8 12 7
f 7 12 11
f 12 10 11
f 11 10 12
f 10 13 12
#f 12 13 11
f 11 13 14
f 13 9 14
f 14 9 15
f 9 11 15
#f 15 11 13
f 13 11 7
f 11 10 7
f 7 10 15
f 10 9 15
f 15 9 7
f 9 16 7
f 7 16 8
f 16 14 8
f 8 14 10
f 14 17 10
f 10 17 12
f 17 7 12
f 12 7 8
f 7 16 8
f 8 16 10
f 16 7 10
#f 10 7 17
f 17 7 16
f 7 18 16
f 16 18 20
f 18 1 20
f 20 1 19
f 1 3 19
f 19 3 21
f 3 2 21
f 21 2 22
f 2 12 22
f 22 12 1
f 12 2 1
f 1 2 23
f 2 1 23
f 23 1 12
f 1 22 12
f 12 22 24
f 22 27 24
f 24 27 26
f 27 25 26
f 26 25 12
f 25 30 12
f 12 30 29
f 30 28 29
f 29 28 14
f 28 25 14
f 14 25 26
f 25 31 26
f 26 31 33
f 31 32 33
#f 33 32 14
f 14 32 34
f 32 29 34
# line with 34 29 35 missing?
f 29 34 35
f 35 36 37
f 37 36 40
f 36 39 40
f 40 39 28
#f 39 38 28
f 28 38 43
f 38 42 43
#f 43 42 41
f 41 42 43
f 42 44 43
f 43 44 47
f 44 46 47
#f 47 46 45
f 45 46 49
f 46 48 49
f 49 48 51
f 48 45 51
I'll look a bit inside the format to see if i find info that may help.
Re: StuntGP 3D/2D Files (.PC and .PMD)
StuntGP yeah I remember those burned hours while playing the game back in the young times. In past I have successful attempt to figure out model format (hmm at least most significant parts of it), it just seems to me that nobody else tried it yet or succeed.
As I remember while vertex coordinates were easy to figure out, faces definitions not at first shoot. Later on it occurred that vertices and faces lists are a single chunks defined for all surfaces and levels of detail (dfferent bodies). Those lists and some others like polygons definitions list are sliced into smaller ones within ranges specified by surface definition structure. All the referring indexes are valid for these sub lists slices.
The faces are not defined in common triplets manner, but as polygons with varying amount of vertices used of course. Faces definition sublist, as I keep naming it, is accessed in polygon definition struct. To confuse things, faces list is not pointing vertex directly but further another listed structure (with UVs and some other infos) which is finally points them.
I have dig out some snippets, I can publish current result after a few tweaks. This is work in progress so there are some things left to figure out.
As I remember while vertex coordinates were easy to figure out, faces definitions not at first shoot. Later on it occurred that vertices and faces lists are a single chunks defined for all surfaces and levels of detail (dfferent bodies). Those lists and some others like polygons definitions list are sliced into smaller ones within ranges specified by surface definition structure. All the referring indexes are valid for these sub lists slices.
The faces are not defined in common triplets manner, but as polygons with varying amount of vertices used of course. Faces definition sublist, as I keep naming it, is accessed in polygon definition struct. To confuse things, faces list is not pointing vertex directly but further another listed structure (with UVs and some other infos) which is finally points them.
I have dig out some snippets, I can publish current result after a few tweaks. This is work in progress so there are some things left to figure out.
You do not have the required permissions to view the files attached to this post.
Re: StuntGP 3D/2D Files (.PC and .PMD)
Hey folks I hope you like seeing some progress don't you? Basically I'm done with textures as well. About a good stuff I got them all
:
Things looked so simple back in the old days, ehh. Since I don't fell well with compression algorithms and there is some backyard invention RLE derivative being used (I guess due to patents in 00's) I had to play with the assembly code for whole day, but it was worth the effort (took less time than asking orig devs for source code). Moreover there are some small issues like determining texture transparency or rotation matrices - because of problems with conversion from left to right handed coordinate system, but those can be easily fixed when manually editing the models.
After a polishing touches, everything should be available within a days in one package in hope that it will be useful for everyone nailing on this problem.

After a polishing touches, everything should be available within a days in one package in hope that it will be useful for everyone nailing on this problem.
You do not have the required permissions to view the files attached to this post.
Re: StuntGP 3D/2D Files (.PC and .PMD)
As I promised here are the results what I got so far, meantime I switched to other projects. For whatever reason I prefer to share it there rather than between other code repositories. Because forum is limited to 1 attachment per post I had created new reply, hope that's not a problem. Attached archive contains files worth brief description:
Note for gamers: there occurred to be some extras left not used in game, example: horn upgrades in catalogue pages, any player should recognize that it is absent in final product.
If there is anyone seriously interested in compression and is able to read asm then may take a look and post something about it. This is only 400 lines of code with many parts redundant, algorithm is not building any dictionary, only remembers the sub-array to repeat into output when relevant code number occurs.
- Binary template for sweetscape hex editor for PMD files.
- Python 3 crude script for blender >= 2.76 for importing those PMD files. Just paste it into blender's scripting mode, change files paths and run. Script requires textures images, if any of required ones is missing exception is raised. If you don't want any textures this can be skipped by commenting out relevant code parts.
- Binary executable in elf format for converting PC files into ordinary bitmap files.
- C and x86 ASM sources of the converter, if you want to build it under windows (untested) mingw and The Netwide Assembler are required.
- BASH shell scripts for batch image files conversion.
Note for gamers: there occurred to be some extras left not used in game, example: horn upgrades in catalogue pages, any player should recognize that it is absent in final product.
If there is anyone seriously interested in compression and is able to read asm then may take a look and post something about it. This is only 400 lines of code with many parts redundant, algorithm is not building any dictionary, only remembers the sub-array to repeat into output when relevant code number occurs.
You do not have the required permissions to view the files attached to this post.
-
- ultra-n00b
- Posts: 4
- Joined: Sat Feb 22, 2020 11:45 pm
- Has thanked: 1 time
- Been thanked: 1 time
Re: StuntGP 3D/2D Files (.PC and .PMD)
I just started to experiment with Stunt GP files without knowing about previous knowledge on the topic, so I made .wad extractor from scratch (although there is one segment that I don't know what it does).
Source code here: [url]https://github.com/Halamix2/stunt_gp_formats[/url]
Your code for converting .pc files is working (I'm trying to understand .asm to remake it in something higher level), although if you change line 56 in image.c to "hdrinfo->colorsMask[3] = 0x8000;" then you also get 1bit alpha channel.
After that I might try to understand and describe in text .pmd files
EDIT: It turns out the 4 parts of the dec.asm are identical, after changing loc_420264 to loc_42017A and removing lines 413-439 and 121-387 it still works, so it's now far easier to understand as now it fits in about 150 lines
Source code here: [url]https://github.com/Halamix2/stunt_gp_formats[/url]
Your code for converting .pc files is working (I'm trying to understand .asm to remake it in something higher level), although if you change line 56 in image.c to "hdrinfo->colorsMask[3] = 0x8000;" then you also get 1bit alpha channel.
After that I might try to understand and describe in text .pmd files
EDIT: It turns out the 4 parts of the dec.asm are identical, after changing loc_420264 to loc_42017A and removing lines 413-439 and 121-387 it still works, so it's now far easier to understand as now it fits in about 150 lines
-
- ultra-n00b
- Posts: 4
- Joined: Sat Feb 22, 2020 11:45 pm
- Has thanked: 1 time
- Been thanked: 1 time
Re: StuntGP 3D/2D Files (.PC and .PMD)
.pc converter is done, it's written in Python and support 1bit alpha channel.
Pros:
Pros:
- Easy to read
- only .png output
- no 1:1 16 bit A1R5G5B5 output, only converted 32bpp RGBA
Re: StuntGP 3D/2D Files (.PC and .PMD)
how use .pc converter on windows ? on my python27 i have error:
C:\Users\mtabi>C:\python27\python.exe C:\Users\mtabi\OneDrive\Pulpit\STUNDGP\pc_unpack.py
Traceback (most recent call last):
File "C:\Users\mtabi\OneDrive\Pulpit\STUNDGP\pc_unpack.py", line 9, in <module>
from pathlib import Path
ImportError: No module named pathlib
C:\Users\mtabi>C:\python27\python.exe C:\Users\mtabi\OneDrive\Pulpit\STUNDGP\pc_unpack.py
Traceback (most recent call last):
File "C:\Users\mtabi\OneDrive\Pulpit\STUNDGP\pc_unpack.py", line 9, in <module>
from pathlib import Path
ImportError: No module named pathlib
-
- ultra-n00b
- Posts: 4
- Joined: Sat Feb 22, 2020 11:45 pm
- Has thanked: 1 time
- Been thanked: 1 time
Re: StuntGP 3D/2D Files (.PC and .PMD)
Update on what was done for texture format:
- Now unpacker was rewritten from python to Go, it's 40x faster (still might be slower than martin solution, but it's now readable)
- no Python required, there is just a standalone .exe
- It also suppports Dreamcast textures (read/write)
- supports Playstation ones (read)
- can pack PC and Dreamcast textures