Difference between revisions of "Terrain Format"

From Staredit Network Wiki
Jump to: navigation, search
m (1 revision imported: Restoring SC1 backup)
(Updated formatting and information)
Line 1: Line 1:
*Nibble = 4 bits
+
Data in the format is read left to right, top to bottom (bitmap pixel locations, minitile locations, etc.). All values are unsigned.
*Byte = 8 bits
+
*Word = 2 bytes (Short)
+
 
+
All values are unsigned.
+
 
+
Data in the format is read left to right, top to bottom (bitmap pixel locations, minitile locations, etc.)
+
 
+
The following formats are organized from the topmost level to the bottom-most level (excluding dddata.bin.)
+
  
 
==CV5==
 
==CV5==
Description: This file defines the various tile groups that are referenced by the TILE/MTXM sections of the CHK (3 nibbles for the group, 1 nibble for the tile.)
+
This file defines the various tile groups that are referenced by the TILE/MTXM sections of the CHK (0x7FF0 for the group index, 0x000F for the tile index).
  
 
Struct Size: 52 bytes
 
Struct Size: 52 bytes
 +
ID Range: 0-2047
  
Max ID [referencing this file]: 0-4095
+
For non-doodad tiles:
 +
* '''u16''' Terrain Type - 0 for unused/unplaceable, 1 for doodads, 2+ for basic terrain and edges
 +
* '''u16''' Flags - Properties for this group of tiles
 +
* '''Rect16''' Edge Types - Determines what tile types can be adjacent to tiles in this group. Unsure if StarEdit actually uses these, or if they are just reference/outdated values.
 +
** '''u16''' Left
 +
** '''u16''' Up
 +
** '''u16''' Right
 +
** '''u16''' Down
 +
* '''Rect16''' Terrain Piece Type - Determines multi-tile blocks of terrain (e.g. 2x3 cliff pieces). A value of 0 can match any appropriate tile, otherwise the edge only pairs with a matching Terrain Piece Type value and tile index. Unsure if StarEdit actually uses these, or if they are just reference/outdated values.
 +
** '''u16''' Left - Unknown/unused (always 0)
 +
** '''u16''' Up
 +
** '''u16''' Right - Unknown/unused (always 0)
 +
** '''u16''' Down
 +
* '''u16[16]''' Tiles - VX4/VF4 MegaTile reference
  
For tile and edge pieces (IDs 0-1023):
 
*Word - Index?
 
*Nibble - Unknown
 
*Nibble - Buildable
 
**0 = Buildable
 
**4 = Creep?
 
**8 = Unbuildable
 
*Nibble - Ground Height - Deprecated? Some values are incorrect.
 
*Nibble - Unknown/Unused?
 
*Word - Left Edge? (not fully understood.)
 
*Word - Top Edge? (not fully understood.)
 
*Word - Right Edge? (not fully understood.)
 
*Word - Bottom Edge? (not fully understood.)
 
*Word - Unknown/Unused
 
*Word - Unknown - Edge piece has rows above it. (Recently noticed; not fully understood.)
 
**1 = Basic edge piece.
 
**2 = Right edge piece.
 
**3 = Left edge piece.
 
*Word - Unknown/Unused
 
*Word - Unknown - Edge piece has rows below it. (Recently noticed; not fully understood.)
 
**1 = Basic edge piece.
 
**2 = Right edge piece.
 
**3 = Left edge piece.
 
*16 Words - MegaTile References (VF4/VX4)
 
  
For doodads (IDs 1024+):
+
For doodad tiles (1024+ in pre-remaster tilesets, but SC:R puts some doodads before that index on some tilesets):
*Word - Index? (Always 1?)
+
* '''u16''' Terrain Type - 0 for unused/unplaceable, 1 for doodads, 2+ for basic terrain and edges
*Nibble - Unknown
+
* '''u16''' Flags - Properties for this group of tiles and doodad
*Nibble - Buildable
+
* '''u16''' Overlay ID - Sprites.dat or Units.dat ID, depending on flags
**0 = Buildable
+
* '''u16''' SC:R Doodad - Set to 1 on doodads added by SC:R
**4 = Creep?
+
* '''u16''' Group String - 1-based stat_txt.tbl string index
**8 = Unbuildable
+
* '''u16''' Unknown/unused (always 0)
*Nibble - Ground Height (Deprecated?)
+
* '''u16''' Doodad ID - dddata.bin index
*Nibble - Overlay Flags:
+
* '''u16''' Width - Width in tiles of the doodad
**0x0 - None
+
* '''u16''' Height - Height in tiles of the doodad
**0x1 - Sprites.dat Reference
+
* '''u16''' Unknown/unused (always 0)
**0x2 - Units.dat Reference (unit sprite)
+
* '''u16[16]''' Tiles - VX4/VF4 MegaTile reference
**0x4 - Overlay is Flipped
+
 
*Word - Overlay ID (Sprites.dat or Units.dat reference, depending on Overlay Flags)
+
 
*Word - Unknown/Unused
+
Flag Values (some flags appear to be unused/outdated, while others appear to be used internally by StarCraft. These values have been italicized):
*Word - Doodad Group String (1-based stat_txt.tbl index)
+
* '''0x0001''' - ''(Generally) buildable and/or passable terrain types?''
*Word - Unknown/Unused
+
* '''0x0002''' - ''Unknown/Unused''
*Word - dddata.bin Index
+
* '''0x0004''' - ''Impassable terrain types?''
*Word - Doodad Width (in tiles)
+
* '''0x0008''' - ''Unknown/Unused''
*Word - Doodad Height (in tiles)
+
* '''0x0010''' - ''Trees?''
*Word - Unknown/Unused
+
* '''0x0020''' - ''Unknown/Unused''
*16 Words - MegaTile References (VF4/VX4)
+
* '''0x0040''' - Creep (unbuildable for non-creep buildings)
 +
* '''0x0080''' - Unbuildable
 +
* '''0x0100''' - ''Objects/Rocks/Trees?''
 +
* '''0x0200''' - ''Mid Ground (deprecated? some values are incorrect)''
 +
* '''0x0400''' - ''High Ground (deprecated? some values are incorrect)''
 +
* '''0x0800''' - ''Unknown/Unused''
 +
* '''0x1000''' - Has Sprites.dat overlay
 +
* '''0x2000''' - Has Units.dat overlay
 +
* '''0x4000''' - ''Overlay is flipped (unused)''
 +
* '''0x8000''' - Allow Beacons/Start Locations to be placeable
  
 
==VF4==
 
==VF4==
Description: MiniTile flags for each Megatile. Referenced by CV5.
+
MiniTile flags for each MegaTile. Referenced by CV5.
  
 
Struct Size: 32 Bytes
 
Struct Size: 32 Bytes
  
Max ID: 0-65535 (1 word)
+
ID Range: 0-65535
  
*16 Words - MiniTile Flags:
+
* '''u16[16]``` - MiniTile Flags:
**0x0001 - Walkable
+
** 0x0001 - Walkable
**0x0002 - Mid
+
** 0x0002 - Mid
**0x0004 - High (Mid and High unchecked = Low)
+
** 0x0004 - High (Mid and High unchecked = Low)
**0x0008 - Blocks View
+
** 0x0008 - Blocks View
**0x0010 - Ramp - Appears on the middle minitiles of most ramps/stairs.
+
** 0x0010 - Ramp - Appears in the middle of most ramps/stairs
**Rest unknown/unused.
+
** Rest unknown/unused
  
 
==VX4==
 
==VX4==
Description: MiniTile graphic references for each MegaTile. Referenced by CV5.
+
MiniTile graphic references for each MegaTile. Referenced by CV5.
  
 
Struct Size: 32 Bytes
 
Struct Size: 32 Bytes
  
Max ID: 0-65535 (1 word)
+
ID Range: 0-65535
 +
 
 +
* '''u16[16]''' - MiniTile graphics
 +
** '''Bit 0''' (0x0001) - Horizontally Flipped
 +
** '''15 Bits''' (0xFFFE) - VR4 reference
 +
 
 +
==VX4EX==
 +
Replaces VX4 in SC:Remaster and tileset expanding plugins to allow for more minitiles. Note that SC:R itself does not use this file, it is used by SCMDraft.
 +
 
 +
Struct Size: 64 Bytes
 +
 
 +
ID Range: 0-4294967296
 +
 
 +
* '''u32[16]''' - MiniTile graphics
 +
** '''Bit 0''' (0x00000001) - Horizontally Flipped
 +
** '''23 Bits''' (0xFFFFFFFE) - VR4 reference
  
*16 Words - For each:
 
**15 Bits - Graphical References (VR4) ((AND 65534)/2 to find)
 
**1 Bit - Horizontal flipped flag (AND 1 to find)
 
  
 
==VR4==
 
==VR4==
Description: Graphical Data for minitiles. Referenced by VX4.
+
Graphical Data for minitiles. Referenced by VX4 or VX4EX.
  
 
Struct Size: 64 Bytes
 
Struct Size: 64 Bytes
  
Max ID: 32767 (15 bits)
+
Max ID: 32767 (VX4) or 2147483647 (VX4EX)
  
*64 Bytes[/b] - 1 byte WPE reference.
+
* '''u8[8][8]''' - WPE color index
  
 
==WPE==
 
==WPE==
Description: 256-color RGB Palette.
+
256-color RGB Palette.
  
struct Size: 4 Bytes (Entire file is always 1024 bytes.)
+
Struct Size: 4 Bytes (entire file is always 1024 bytes).
  
Max ID: 0-255 (1 byte)
+
ID Range: 0-255
  
*Byte - Red
+
* '''u8''' - Red
*Byte - Green
+
* '''u8''' - Green
*Byte - Blue
+
* '''u8''' - Blue
*Byte - Null (0)
+
* '''u8''' - Unused
  
 
==DDDATA.BIN==
 
==DDDATA.BIN==
Description: Doodad placeability. Referenced by CV5.
+
Doodad placeability. Referenced by CV5.
  
Struct Size: 512 Bytes (Entire file is 256KB.)
+
Struct Size: 512 Bytes (entire file is 256KB).
  
Max ID: 1-511
+
ID Range: 0-511
  
*256 Words - CV5 Group ID references for placeability. Only the first (Doodad Width * Height) words are used for each doodad. 0 is used for tiles that are null and placeable anywhere.
+
* '''u16[256]''' - CV5 Group ID references for placeability. Only the first Doodad Width*Height indexes are used for each doodad. A value of 0 is used on null tiles and can be placed anywhere.
  
 
[[Category:StarCraft]]
 
[[Category:StarCraft]]
 
[[Category:Reference]]
 
[[Category:Reference]]
 
[[Category:Modding]]
 
[[Category:Modding]]

Revision as of 23:17, 8 August 2022

Data in the format is read left to right, top to bottom (bitmap pixel locations, minitile locations, etc.). All values are unsigned.

CV5

This file defines the various tile groups that are referenced by the TILE/MTXM sections of the CHK (0x7FF0 for the group index, 0x000F for the tile index).

Struct Size: 52 bytes ID Range: 0-2047

For non-doodad tiles:

  • u16 Terrain Type - 0 for unused/unplaceable, 1 for doodads, 2+ for basic terrain and edges
  • u16 Flags - Properties for this group of tiles
  • Rect16 Edge Types - Determines what tile types can be adjacent to tiles in this group. Unsure if StarEdit actually uses these, or if they are just reference/outdated values.
    • u16 Left
    • u16 Up
    • u16 Right
    • u16 Down
  • Rect16 Terrain Piece Type - Determines multi-tile blocks of terrain (e.g. 2x3 cliff pieces). A value of 0 can match any appropriate tile, otherwise the edge only pairs with a matching Terrain Piece Type value and tile index. Unsure if StarEdit actually uses these, or if they are just reference/outdated values.
    • u16 Left - Unknown/unused (always 0)
    • u16 Up
    • u16 Right - Unknown/unused (always 0)
    • u16 Down
  • u16[16] Tiles - VX4/VF4 MegaTile reference


For doodad tiles (1024+ in pre-remaster tilesets, but SC:R puts some doodads before that index on some tilesets):

  • u16 Terrain Type - 0 for unused/unplaceable, 1 for doodads, 2+ for basic terrain and edges
  • u16 Flags - Properties for this group of tiles and doodad
  • u16 Overlay ID - Sprites.dat or Units.dat ID, depending on flags
  • u16 SC:R Doodad - Set to 1 on doodads added by SC:R
  • u16 Group String - 1-based stat_txt.tbl string index
  • u16 Unknown/unused (always 0)
  • u16 Doodad ID - dddata.bin index
  • u16 Width - Width in tiles of the doodad
  • u16 Height - Height in tiles of the doodad
  • u16 Unknown/unused (always 0)
  • u16[16] Tiles - VX4/VF4 MegaTile reference


Flag Values (some flags appear to be unused/outdated, while others appear to be used internally by StarCraft. These values have been italicized):

  • 0x0001 - (Generally) buildable and/or passable terrain types?
  • 0x0002 - Unknown/Unused
  • 0x0004 - Impassable terrain types?
  • 0x0008 - Unknown/Unused
  • 0x0010 - Trees?
  • 0x0020 - Unknown/Unused
  • 0x0040 - Creep (unbuildable for non-creep buildings)
  • 0x0080 - Unbuildable
  • 0x0100 - Objects/Rocks/Trees?
  • 0x0200 - Mid Ground (deprecated? some values are incorrect)
  • 0x0400 - High Ground (deprecated? some values are incorrect)
  • 0x0800 - Unknown/Unused
  • 0x1000 - Has Sprites.dat overlay
  • 0x2000 - Has Units.dat overlay
  • 0x4000 - Overlay is flipped (unused)
  • 0x8000 - Allow Beacons/Start Locations to be placeable

VF4

MiniTile flags for each MegaTile. Referenced by CV5.

Struct Size: 32 Bytes

ID Range: 0-65535

  • u16[16]``` - MiniTile Flags:
    • 0x0001 - Walkable
    • 0x0002 - Mid
    • 0x0004 - High (Mid and High unchecked = Low)
    • 0x0008 - Blocks View
    • 0x0010 - Ramp - Appears in the middle of most ramps/stairs
    • Rest unknown/unused

VX4

MiniTile graphic references for each MegaTile. Referenced by CV5.

Struct Size: 32 Bytes

ID Range: 0-65535

  • u16[16] - MiniTile graphics
    • Bit 0 (0x0001) - Horizontally Flipped
    • 15 Bits (0xFFFE) - VR4 reference

VX4EX

Replaces VX4 in SC:Remaster and tileset expanding plugins to allow for more minitiles. Note that SC:R itself does not use this file, it is used by SCMDraft.

Struct Size: 64 Bytes

ID Range: 0-4294967296

  • u32[16] - MiniTile graphics
    • Bit 0 (0x00000001) - Horizontally Flipped
    • 23 Bits (0xFFFFFFFE) - VR4 reference


VR4

Graphical Data for minitiles. Referenced by VX4 or VX4EX.

Struct Size: 64 Bytes

Max ID: 32767 (VX4) or 2147483647 (VX4EX)

  • u8[8][8] - WPE color index

WPE

256-color RGB Palette.

Struct Size: 4 Bytes (entire file is always 1024 bytes).

ID Range: 0-255

  • u8 - Red
  • u8 - Green
  • u8 - Blue
  • u8 - Unused

DDDATA.BIN

Doodad placeability. Referenced by CV5.

Struct Size: 512 Bytes (entire file is 256KB).

ID Range: 0-511

  • u16[256] - CV5 Group ID references for placeability. Only the first Doodad Width*Height indexes are used for each doodad. A value of 0 is used on null tiles and can be placed anywhere.