Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SG files and new editing tools
#1
I was working on a Python script to help get track boundaries centered relative to the track centerline, and ended up decoding most of the SG file. Here is what I found. With the exception of the first 4 bytes which is "SG  " in little endian, everything in the file is a series of 4-byte Int32 values. All values are in 500ths.

With this knowledge I'm also thinking of making a tool to automatically create walls based on track width, change walls to armco, toggle fences or no fences, check if walls from one section are connected to the next section, etc. some of which are things I actually need to do on Detroit but too lazy to do it in SFE.

Section 1: Header
Position / Description
0 = "SG"
1 = Unknown, always 1?
2 = Unknown, always 1?
3 = Unknown, always 0?
4 = Number of sections
5 = Number of height lines

Section 2: List of DLATs of height lines
0 = DLAT of the rightmost height line
1 = DLAT of the next height line
etc.

Section 3: Sections
0 = Type (1 = Line, 2 = Curve)
1 = Next section number
2 = Previous section number
3 = Start X coordinate
4 = Start Y coordinate
5 = End X coordinate
6 = End Y coordinate
7 = Start DLONG
8 = Length
9 = Center X (when section is a curve)
10 = Center Y
11-12 = Heading vector (Start)
13-14 = Heading vector (End)
15 = Radius
16 = Unknown, always 0?

Subsection 3.1: Heights
17 = Height
18 = Grade
etc. for each height line

Subsection 3.2: Fsections
19 = Number of fsections

20 = Type (see below)
21 = Type 2
21 = Start DLAT
23 = End DLAT
(repeated 10 times)

Types:
0 Grass
1 Dry grass
2 Dirt
3 Sand
4 Concrete
5 Asphalt
6 Paint (Curbing)
7 Wall
8 Armco

Type 2:
0 Rough marbles No fence
2 Rough marbles Fence
4 Rough groove No fence
6 Rough groove Fence
8 Smooth marbles No fence
10 Smooth marbles Fence
12 Smooth groove No fence
14 Smooth groove Fence
Reply
#2
(06-03-2020, 05:01 AM)checkpoint10 Wrote: I was working on a Python script to help get track boundaries centered relative to the track centerline, and ended up decoding most of the SG file. Here is what I found. With the exception of the first 4 bytes which is "SG  " in little endian, everything in the file is a series of 4-byte Int32 values. All values are in 500ths.

With this knowledge I'm also thinking of making a tool to automatically create walls based on track width, change walls to armco, toggle fences or no fences, check if walls from one section are connected to the next section, etc. some of which are things I actually need to do on Detroit but too lazy to do it in SFE.

Section 1: Header
Position / Description
0 = "SG"
1 = Unknown, always 1?
2 = Unknown, always 1?
3 = Unknown, always 0?
4 = Number of sections
5 = Number of height lines

Section 2: List of DLATs of height lines
0 = DLAT of the rightmost height line
1 = DLAT of the next height line
etc.

Section 3: Sections
0 = Type (1 = Line, 2 = Curve)
1 = Section number
2 = Section number counted backwards from total
3 = Start X coordinate
4 = Start Y coordinate
5 = End X coordinate
6 = End Y coordinate
7 = Start DLONG
8 = Length
9 = Center X (when section is a curve)
10 = Center Y
11-12 = Heading vector (Start)
13-14 = Heading vector (End)
15 = Radius

Subsection 3.1: Heights
16 = Height
17 = Grade
etc. for each height line

Subsection 3.2: Fsections
18 = Unknown, always 0?
19 = Number of fsections

20 = Type (see below)
21 = Type 2
21 = Start DLAT
23 = End ELAT
(repeated 10 times)

Types:
0 Grass
1 Dry grass
2 Dirt
3 Sand
4 Concrete
5 Asphalt
6 Paint (Curbing)
7 Wall
8 Armco

Type 2:
0 Rough marbles No fence
2 Rough marbles Fence
4 Rough groove No fence
6 Rough groove Fence
8 Smooth marbles No fence
10 Smooth marbles Fence
12 Smooth groove No fence
14 Smooth groove Fence

I have looked into the type 2 stuff with Foxman. Might have some notes about that hanging around. Devilish
IIRS Driver Champion (2005-2007, 2010-2014)
IIRS Team Champion (2004-2014)
Reply
#3
(06-03-2020, 06:58 AM)Wolf_pd Wrote: I have looked into the type 2 stuff with Foxman. Might have some notes about that hanging around. Devilish

Do any of those Rough/Smooth/Marbles/Groove make a difference in ICR2? Or just relevant to the NASCAR games?
Reply
#4
From what we tested, there was no difference for the ICR2 tracks. What I did was creating a trk file for each surface and run the same track, setup and car and compared speeds. Don't know/have the exact testresults anymore, but the difference was neglible, more based on taking a slightly different line than anything else.
IIRS Driver Champion (2005-2007, 2010-2014)
IIRS Team Champion (2004-2014)
Reply
#5
(06-03-2020, 07:06 AM)checkpoint10 Wrote:
(06-03-2020, 06:58 AM)Wolf_pd Wrote: I have looked into the type 2 stuff with Foxman. Might have some notes about that hanging around. Devilish

Do any of those Rough/Smooth/Marbles/Groove make a difference in ICR2? Or just relevant to the NASCAR games?

To the best of my knowledge those different surface types do not make a difference in ICR2. But I would love to be proven wrong Smiley

Really well done on finding out all that information about the values in the SG file! Who knows what nice things you (or someone else) can do with that... Smiley
Reply
#6
(06-03-2020, 07:50 AM)Tjerk Wrote: To the best of my knowledge those different surface types do not make a difference in ICR2. But I would love to be proven wrong Smiley

Really well done on finding out all that information about the values in the SG file! Who knows what nice things you (or someone else) can do with that... Smiley

Tjerk, thanks for the excellent track editing tutorial which made it possible for me to learn track editing. This forum has been helpful as well, both from active members and older posts. I'm posting whatever I learn in the hopes that it will help somebody and help us get more tracks made.
Reply
#7
(06-03-2020, 09:57 AM)checkpoint10 Wrote: Tjerk, thanks for the excellent track editing tutorial which made it possible for me to learn track editing. This forum has been helpful as well, both from active members and older posts. I'm posting whatever I learn in the hopes that it will help somebody and help us get more tracks made.

You're very welcome! I am happy to see that a good amount of people have had some use of it. Even if it is just to gain the confidence and interest to take up the edit tools themselves. Which in turn leads to new discoveries. In that sense the old collaborative modding mindset is still as alive as it was back when we started doing all of this. Pretty cool Cool
Reply
#8
(06-03-2020, 05:01 AM)checkpoint10 Wrote: Type 2:
0 Rough marbles No fence
2 Rough marbles Fence
4 Rough groove No fence
6 Rough groove Fence
8 Smooth marbles No fence
10 Smooth marbles Fence
12 Smooth groove No fence
14 Smooth groove Fence
From my tests years ago rogh/smooth parameter has no effect on trk file. In alll cases resulted trk files will be the same. And as you know car 'rides' on trk file, 3do is just for visual things.
ICR2,N1,N2,N3 trk files can have only this surfaces and walls:

walls
0 - armco no fene
2 - armco with fence
4 - wall no fence
6 - wall with fence

surfaces
46 - asphalt
38 - concrete
6 - grass
14 - dry grass
30 - sand
22 - dirt
54 - paint/curbing

Maybe rough/smooth parameter can have effect on 3do file. But again you create trk from sg at first, and then generate 3do from trk. So I don't know how sg file can affect 3do.
Reply
#9
Do we know if the cars drive the same on concrete vs. asphalt?

And is there any difference between grass/dry grass/sand/dirt besides what textures they use for the track 3DO file? I believe all of these will kick up the same kind of dirt when driven over and feel similarly rough/slippery when driven on.
Reply
#10
In N2/N3 concrete has less grip than asphalt. And in icr2 grass, drygrass, dirt and sand are feel the same I think.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)