Thread: [TEC] Modding SH3
View Single Post
Old 04-22-16, 01:46 AM   #3
Tycho
Sonar Guy
 
Join Date: Oct 2009
Location: Sofia, Bg
Posts: 384
Downloads: 264
Uploads: 1


Default

Let's start with:
Recently, I decided to deepen in the types of terrains in the game. And here will share what I learned.
I saw relationship between TerrainTypes.raw, Terrain.cfg and folders Terrain\Textures and Forests.

First TerrainTypes.raw, it is pure data grayscale image, without any header, every byte define one shades of gray.
Next is Terrain.cfg, there have a IDX converter, where different shades of gray are specify to 9 terrain types.
OK, let's look over:
 
^
This is original TerrainTypes.raw, I made it more brighter to see it.

But because in Terrain.cfg, 32 indexes are simplified to 9 terrain types, so actually it work like (layered over the SH3 World and colorized):
 


For example, I experimented a bit, and made a new one with more simple drawing, but with 11 terrain types. In the future, I always may edit it as I want.
Code:
[IdxConversion]
IDX 1=2       ;Polar cap zone, 1 season
IDX 2=3       ;Subpolar zone, 3 seasons
IDX 3=0       ;Temperate zone, 4 seasons
IDX 4=1       ;Temperate mountain zone, 2 seasons
IDX 5=4       ;Subtropical zone N, 4 seasons
IDX 6=5       ;Subtropical mountain zone, 2 seasons
IDX 7=6       ;Desert zone, 1 season
IDX 8=7       ;Tropical zone N, 2 seasons
IDX 9=8       ;Tropical mountain zone, 1 seasons
IDX 10=9      ;Tropical zone S, 2 seasons
IDX 11=10      ;Subtropical zone S, 4 seasons
Will take me so much time to pick textures for all this.
Look like:
 


In Terrain.cfg, you define different terrain types:
Code:
[TerrainTypeDef03]
TerrainType=0
StartDate=0601
EndDate=0831
ForestName=Forest
Tex01=data/Terrain/Textures/Summer/summer_s0.tga
Tex02=data/Terrain/Textures/Summer/summer_g0.tga
Tex03=data/Terrain/Textures/Summer/summer_r0.tga
Tex04=data/Terrain/Textures/Summer/summer_d.tga
You may separate terrain type to different seasons, with different textures and different forest file.
This thing is not dynamic, if you sail over these parameters on 31 august, summer:
Code:
TerrainType=0
StartDate=0601
EndDate=0831
On the next day, 1st september, the textures will not changed to the autumn.
The changes will happen on the next game loading, according to the in-game date of your save.

Terrain.cfg is editable through notepad.
TerrainTypes.raw is editable through hex editor (very cumbersome), or with graphic editor. Probably Photoshop open and edit it, but I use PaintNet.
So I first need to convert it. For conversion I use ImageMagick, here is how:
1 - Go on ImageMagick site and download, I prefer the portable version.
2 - Extract the archive somewhere on your computer, in my case: "D:\Programs\ImageMagick\"
3 - Let's say, that you have somewhere a working folder with the "TerrainTypes.raw" file. Make a batch file (RawToTga.bat) with the following line:
Code:
"D:\Programs\ImageMagick\convert.exe" -depth 8 -size 2160x1080 gray:TerrainTypes.raw TerrainTypes.tga
Change the path to the convert.exe, according to your.
Now, when you start the "RawToTga.bat" file, ImageMagick\convert.exe will convert it and create a new file "TerrainTypes.tga".

4 - In the reverse case, you create "TgaToRaw.bat" with the following line:
Code:
"D:\Programs\ImageMagick\convert.exe" -depth 8 -size 2160x1080 TerrainTypes.tga gray:TerrainTypes.raw
Change the path to the convert.exe, according to your.
When you start the "TgaToRaw.bat" file, ImageMagick\convert.exe will convert TerrainTypes.tga and create a new file "TerrainTypes.raw".
Video:
 


So now you are able to experiment with terrain texture drawing in the game.
You want Saint Helena island to be with the specific textures, no problem.
Let's go!


Quote:
Originally Posted by Anvar1061 View Post
Where you can download them?
I don't need to download nothing. If you ask for yourself, then:
Let me check my Russian!
Не имеется ничего для скачивания. Я говорю люди, как они могут редактировать свою игру.

Nothing for download. I write how someone can edit its own game.
__________________
If you ride like lightning, you're gonna crash like thunder.

Last edited by Tycho; 05-03-17 at 03:54 AM.
Tycho is offline   Reply With Quote