Level Editor - igorseabra4/HeroesPowerPlant GitHub Wiki

This page will guide you on using Heroes Power Plant's Level Editor for working with stage models for both Heroes and Shadow. The workflow is very similar for both games.

Understanding Heroes/Shadow Stages

  • Both Heroes and Shadow use multiple model files (RenderWare BSP models, unrelated to other types of BSP such as Source) for their stage models.
  • In Heroes, all models are contained in a ONE archive (a container, similar to a ZIP file) located in the dvdroot folder.
  • In Shadow, models are split across multiple ONE archives, but all archives for a stage are contained in a folder. You open the folder directly and HPP will manage the individual files for you.
  • Collision is handled by separate files in both games. See Collision Editor (Heroes) or Collision Editor (Shadow).

Note that the level editor only works on the PC, XBOX and GameCube versions of Heroes and Shadow; it can't display or extract the models from the PS2 versions, but can import new ones for it!

Since multiple models are used for stages, which models are visible at a given moment are controlled by the visibility file, which is also edited in the Level Editor.

Chunks

Chunks are the game's way of splitting a level into multiple parts, so only a some of them will show up at a time. Each chunk has a number and is made up of multiple BSP files, if your curiosity made you open one of the game's original ONEs you should have noticed that. This is how a BSP is named:

SLL_MM_NN.BSP or STGLL_MM_NN.BSP

  • The file name starts with S (in some Heroes stages) or STG (other Heroes stages and all Shadow stages).
  • LL is the level number. In Shadow, this is a 4-digit number (LLLL).
  • MM is the material setting identifier.
  • NN is the chunk number.
  • In Shadow, occasionally the material setting and the chunk number are in switched positions.

The files must be named properly for the game to recognize them. Check the Level List page to see your level's number (in the File Names and Data list). That will also tell you whether your files start with S or STG.

For the game to know which chunk to display at a given time, the camera must be inside boundaries set in the visibility file. In Heroes, if the chunk number is omitted (resulting in SLL_MM.BSP) the file will always be displayed (this is used for some levels' skyboxes).

The files also have different material settings (MM). They will set how the model is rendered.

For Heroes, they are the following:

Identifier Description
DN Sky model material
O Reflective material
OS Reflective floor material
ON Regular material
ONS Regular floor material
ONW Regular material without culling
ONWS Regular floor material without culling
P Alpha testing with reflective material
PS Alpha testing with reflective floor material
PN Alpha testing material
PNS Alpha testing floor material
PNW Alpha testing material without culling
PNWS Alpha testing floor material without culling
DA Alpha sky material
AF Alpha reflective material
AFS Alpha reflective floor material
AFN Alpha material
AFNS Alpha floor material
K Additive alpha material
KW Additive alpha material without culling
A Alpha reflective material
AS Alpha reflective floor material
AN Alpha material
ANS Alpha floor material

The Shadow list is quite similar to the Heroes one, but some identifiers are different. For example, in Shadow the letter N is removed from most identifiers that have them, and a new one is present (G for glowing/bloom models).

For Shadow they are the following:

Identifier Description
N Unknown
D Sky model material
OS Opaque Solid (ground)
OSL BAD DO NOT USE
O Opaque
OW Unknown
OL BAD DO NOT USE
P Unknown
AF Alpha - has some problems with stacking
A Alpha
AL BAD DO NOT USE
K Alpha / Transparency with depth/stacking
M BAD DO NOT USE
G Glow
GL BAD DO NOT USE

Note the descriptions are not as in-depth/accurate as Heroes. If you find more clear definitions feel free to update this and let us know in HHC.

Level Editor

Level Editor

Press F3 or open it from the Editors menu.

  • In the ONE File menu, you can create a new, open or save a Heroes stage ONE file.
  • In the BLK File menu, you can create a new, open or save a Heroes stage visibility file.
    • Usually, this will be managed automatically by HPP.
    • Here, you can also import a visibility file. Chunks loaded from the file will be added to the list. You can even import a Shadow visibility file to Heroes!
  • In the Shadow Level menu, you can create a new, open or save a Shadow stage folder.
    • You can also open the Shadow Collision Editor or Shadow Spline Editor.
    • Here, you can also import a visibility file. Chunks loaded from the file will be added to the list. You can even import a Heroes visibility file to Shadow!

Level Models

The area to the left of the Level Editor allows exporting and importing of level models.

Exporting

  • You can export models to multiple formats. DAE is the recommended one. You can select one or multiple files to export (if none are selected, all of them will be exported to a folder).
  • The exported OBJs contain vertices, triangles, texture coordinates and vertex colors; since OBJ traditionally has no support for vertex colors, you can use the script located in HPP's Tools folder to import these files to 3ds Max with vertex colors. Otherwise, they will be ignored. The material library expects PNG files in the same folder as the models (see Textures). Export to other formats is still experimental and might not be 100% functional.
  • This very outdated video explains how to extract stage models to OBJ files and import them in 3ds Max. Some of the methods used in the video are not necessary anymore.

Importing

  • You can also import a variety of formats, but the recommended ones are FBX, DAE, OBJ, or raw BSP.
  • The model must use triangular faces and must contain vertex position and texture coordinate data; vertex normals will be ignored and vertex colors are optional. Your model must contain only one channel of each data type (vertex position, texture coordinate, vertex colors and normals), otherwise the import will fail.
  • You can double click on a BSP to rename it. This allows you to choose the material flag and chunk number. HPP does not verify if your file name is accurrate, so name it properly.
  • Heroes Power Plant's rendering is not accurate to the game's. Always test your models ingame.
  • Raw BSP files extracted from Sonic Heroes will work in Shadow, but the opposite is not true.

Model Import Guidelines

The recommended 3d tool for creating Heroes/Shadow stages is 3ds Max, but nothing stops you from using another one. In this text, the terminology "mesh" is used for an individual model/piece of data in the 3d editor. Other 3d tools might call them differently.

You must split your models into meshes so that each mesh will be converted into one BSP file. You can first split the model into multiple by chunk, then split each chunk into the different components of it: floors should be in their own mesh (ONS) as they recieve shadows and walls (ON) don't. Parts of the model with textures with alpha testing should have the PN in their name, textures with normal alpha should have the AFN in their name, the skybox will be DN, effects such as water and glow will be K and so on.

Name your meshes the same name that their BSP file should receive. You can name your meshes the same name of their BSP so you won't have trouble renaming them later. A file name for the floor models of the third chunk in Seaside Hill would be S01_ONS_03.BSP, a name for a model with alpha textures for the fourth chunk in Casino Park would be STG05_AFN_04.BSP. Note that you can use the shaders from the original stages as well (such as animated water and blue roads from the city levels). Just take a look at the texture name in the original TXD and name your texture accordingly.

There's a maximum of 65535 vertices and triangles per BSP. The game has an internal limit which is actually much lower than that, but that can be disabled by using the TONERR mod (explained here). If you wish to stay within these limits for console versions or if you're not using TONERR for some reason, split your files into more chunks. Note that there is a limit of 256 chunks per stage.

Export each mesh to a separate OBJ or DAE file (remember to use Y axis = up). The model must use triangular faces, contain vertex positions and texture coordinates. Vertex normals are ignored as the game doesn't use them, and for DAE, vertex colors are supported (Heroes uses vertex colors extensively for shading and shadows on the models). Texture names will be the same ones of the textures you're using in 3ds Max. Their names cannot contain spaces. [http://www.scriptspot.com/3ds-max/scripts/batch-exportimport This addon for 3ds Max] can automatically export each model to a separate file just as we need.

Now, import your models using the Level Editor. Double-click the files to rename them if needed, then save.

Note: for Heroes, check the original game's dvdroot folder. If there's a s(tg)LL_h.one file for your level (notice the _h after the number), then that should be your ONE file name; if there isn't, save it as s(tg)LL.one. Save it inside your mod's Files folder, don't replace any of the original files.

Since you have no visibility file set up yet, nothing will initially show up; disable the Render By Chunk checkbox under Options (or press the H shortcut key) to disable per-chunk rendering. If you did everything correctly, your models should show up in HPP. See Textures to understand how to enable custom texture display.

Windy Valley in 3ds Max

This image shows igorseabra4's Windy Valley stage mod in 3ds Max. Note the division into meshes which correspond to different chunks. The skyboxes have been hidden for simplicity.

Visibility Editor

The area to the right of the Level Editor is the Visibility Editor.

Ingame, the models for each chunk are visible when the camera is inside the visibility boundaries defined in the visibility file.

  • In Heroes, visibility is in a sLL_blk.bin or stgLL_blk.bin file located in the dvdroot folder. LL is the stage number (explained above)
  • In Shadow, visibility is a stgLLLL.bdt file located in the stage's *_dat.one. LLLL is the stage number (explained above)

In both cases, HPP will manage opening and saving the visiblity file for you, so you do not have to worry about that.

  • You can edit each chunk entry's chunk number (you can have multiple entries enabling the same chunk) and bounding box values. Chunk boxes can overlap and multiple chunks can be displayed at once.
  • Make sure all maximum values are higher than the corresponding minimum, otherwise the chunk simply won't work (can you tell me a number which is higher than 20 and lower than 10? I think not!).
  • The AutoChunk function will automatically set chunk boundaries based on the extremities of the BSPs with the same number. The value you can set here on AutoChunk Add is an offset for the boundaries (will be added to positive values and subtracted from negative ones).
  • The AutoBuild function will automatically generate an entire visibility file based on the extremities of the BSPs for each chunk number. All existing visibility data will be deleted and replaced by this! This is the quickest way to generate visibility data for a custom stage as it just requires pressing one button.
  • You can verify that the chunks are rendered in the proper locations by disabling Render By Chunk and checking them out in HPP.

When you're happy with your visibility layout, save the file as s(tg)LL_blk.bin in your mod stage's Files folder along with the ONE (for Heroes). For Shadow, the visibility file is saved automatically when you save the level models. From now on, when opening the ONE in the Level Editor, the visibility file will be loaded as well.

If you have just finished importing custom models and visibility data for your stage, it's a good idea to test ingame and see if they are working. Correctly imported stages load normally even if they have no textures yet.

Disabling Restrictions in Shadow

If you're editing a Shadow level, the game has certain file names hardcoded which will make it not possible for you to use certain chunk numbers or file names depending on the level. This can be bypassed with the following gecko code:

$Unrestrict Geo/Coli Names v2 [dreamsyntax]
C21E280C 00000006
81E100F4 3E008004
62106720 7C0F8000
40820014 3DE0801E
61EF2814 7DE803A6
4E800020 2C030000
60000000 00000000

You probably want to leave this code on while creating a level for Shadow, even if you're not having issues initially.

Additionally it is recommended (unless going for console compatibility) to use the 64 MB MEM1 bi2.bin file for Shadow the Hedgehog, to reduce the chance of running out of memory in-game. Place the unlocked bi2.bin file in the \sys folder of your extracted game. This file can be taken from the ShdTH-Reloaded project. Don't forget to set Dolphin -> Config -> Advanced -> MEM1 to 64MB if you are using this.