LVD Level Data (Smash 4)

From OpenSA: Smash Engine Documentation Wiki
Jump to: navigation, search

Overview

LVD is the file type used by both versions of Smash 4 to store various bits of level data. They are used for spawns, respawns, collisions, blast zones, camera bounds, the per-stage locations of various final smash events (such as where Ike's final smash takes Ike and his opponent), and much more. It is even used to store the board paths for Smash Tour.

Structure

LVDs structure is relatively easy to read however it isn't possible to skip unknown data when parsing it due to it being a completely linear file type.

Header structure
Offset Type Description
0x0 uint32 Version number (Always 1)
0x4 byte[6] Magic ending in "LVD1"

After the header comes all the entries in the format

Entry List Structure
Offset Type Description
0x0 byte Value 0x1, a separator character
0x1 uint32 Number of Entries of this type
0x5 Entry[entryCount] Entries of this type

Note that if there is none of a type present that there still must be the separator and count of 0. The list of types in LVD version 1 (in order) is below:


Entry Types
Type Type Name Description
1 Collisions The actual collisions of the stage
2 Spawns Where the players spawn at the beginning of the match (in order by player number)
3 Respawns Where the player respawn on a platform when they die
4 Camera bounds How far the camera can move vertically and horizontally
5 Blastzones How far the player can go before losing a stock
6 Unknown No known example
7 ITEMPT_transform Used only on Smash Run
8 Enemy Generator Used only on Smash Run to spawn enemies
9 ITEMPT Used only on Smash Run
10 fsAreaCam Used only on Smash Run
11 fsCamLimit Used only on Smash Run
12 Damage Shapes Damage sphere and Damage capsule are the only subtypes I've seen. (Note: this is a hurtbox such as Luigi's Mansion Pillars
13 Item Spawners Lines that items "rain down" from, i.e. items spawn on the nearest collision under it
14 General shapes General rectangle, general path, etc. used for Smash Tour pathways and other random stuff
15 General points Used for points to be reference by code (such as Ike's final smash position among other things)
16 Unknown No known example
17 FsStartPoint Used only in Smash Run
18 Unknown No known example
19 Unknown No known example

Collisions

Collisions are stored as collision header data, vertices positions and line data. Line data includes how it reacts with physics, the angle you can pass through it, the ledges, etc.

Collision Structure
Name Type Description
Identifier byte[12] Always "03 04 01 01 77 35 BB 75 00 00 00 02"
Separator byte 01
Name char[0x38] Null padded string of length 0x38 containing the name (doesn't matter what this is)
Separator byte 01
Subname char[0x40] Null padded string of length 0x40, sometimes used to determine which model the collision is rigged to
Separator byte 01
Start Position float[3] Position to offset the collision by at the start, mainly for matching it to the start of a model's animation
Use Start Position bool (byte sized) Whether or not to actually use the start position
Separator byte 01
Unknown uint32 Always 0
Separator byte 01
Unknown byte[0xC] Always 0s
Unknown uint32 Always 0xFFFFFFFF
Separator byte 01
Bone to rig to char[0x40] Null padded string of length 0x40, sometimes random data other times it is the name of the bone to rig the collision to
Unknown byte Always 0 I think
Rig Collision bool (byte sized) Whether or not to rig the collision
Unknown bool (byte sized) Unknown flag
Drop through bool (byte sized) Whether or not the player can drop through the collision by hitting down when standing on it
Separator byte 01
Vertex Count uint32 Number of Vertices in the collision
Vertices Vector2[vertexCount] Vertices Positions
Separator byte 01
Passthrough Count uint32 Number of passthrough angles
Passthroughs Vector2[passthroughCount] One per line between every 2 neighboring vertices, describes the angle you can pass through the collision as a unit normal vector
Separator byte 01
Cliff Count uint32 Just use this to skip the cliffs, they aren't worth your time
CLIFFs Cliff[cliffCount] each is 0xFC in length, use that info to skip this stuff because it's most likely debug data as it does not affect gameplay whatsoever
Separator byte 01
Collision Material Count uint32 Number of collision "materials"
Collision Materials CollMaterial[collMatCount] Collision materials

Collision Materials

Stores all info about collision lines aside from passthrough angles. (Is it a left ledge, is it a right ledge, is it icy, etc.) is 0xC in size

Collision Material Structure
Name Type Description
Separator byte 01
Unknown byte[3]
Collision Physics byte Determines the type of physics used by the collision (i.e. ice is slippery)
Unknown byte[5]
Flags byte Right Ledge = Most significant bit, Left Ledge = 2nd Most significant bit, Don't allow wall jump = 3rd most significant bit
Unknown byte[4]