Actions

SCHG How-to

Creating Levels in Sonic Heroes

From Sonic Retro

Revision as of 21:23, 12 July 2017 by Igorseabra4 (talk | contribs) (Created page with "{{SCHG SH}} {{GuideBy|igorseabra4}} This guide will show you how to create a custom level in Sonic Heroes. == Introduction == First of all, you should come [https://github.c...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
SCHG: Sonic Heroes
Main Article
Mechanic Editing

DOL Editing
EXE Editing
Music Pointers
Object Parameter Data
Relocatable Editing (PC)
File Offsets

Model Editing
Collision Format
Model Format
Level Editing

Camera Editing
Event Editing
ID list
Indirect Editing
Light Editing
Level List
Object Editing
Object Porting
Spline Editing
Texture Animation Editing
Visibility Editing

Particle Editing
Particle Editing
Sound Editing
Music List

Sound Editing
Voices

SCHG How-Tos

Custom Object Material Effect Tutorial
Level Editing Tutorial

(Original guide by igorseabra4)

This guide will show you how to create a custom level in Sonic Heroes.

Introduction

First of all, you should come here and download pretty much everything in that page. It has every program this page mentions, except for HeroesONE, Magic.TXD, 3ds Max and HeroesCollisionEditor, all of which you should get as well.

If this is your first time creating a level for this game, it's a good idea to first extract and take a look at the original levels, to see stuff like their size, shape, how they're laid out, what types of textures are in each BSP etc. Use HeroesBSP2OBJ or File:Bsp2objv021sonic.zip to rip BSP models, Magic.TXD to rip textures and HeroesCL2OBJ to rip the collision models. You can also play a bit with Heroes Layout Editor and add random objects or teleport around the stage for a bit. Make sure to read the entire tutorial and as much of these wiki pages as you can, so you know what you're doing and you're not just throwing models at a wall to see what renders.

Since the console versions of Sonic Heroes use the same file types for most files and do accept BSPs from the PC version, you can create custom levels for the PC or any of the console versions, as long as you remember to save the TXD in the correct version. There's only start/ending position and spline editors for the PC EXE though.

Level Models

Tools you'll need:

For more information, see Model Format.

Level models are located in multiple .BSP files located inside .ONE archives in the dvdroot folder, which are named sLL.one or sLL_h.one or stgLL.one or stgLL_h.one (where LL is the level number). The _h indicates this is the version of the level with shaders on the models. The game will normally load only the version with shaders if it's present. HeroesONE is used to open and create the archives. The levels from Seaside Hill to Power Plant and from Hang Castle to Final Fortress and all bosses and multiplayer levels associated with them will have their files starting with s. The files for levels from Casino Park to Lost Jungle and all their bosses and multiplayer versions as well as special stages will have their files starting with stg. For a complete list of level numbers, see the File Names and Data level list.

The BSP model files are named in the form of SLL_XX_NN.BSP (or STG, accordingly with the .ONE name). LL is the level number, XX is the material setting identifier and NN is the chunk number.

Levels in Sonic Heroes are divided into multiple chunks when it comes to the rendered models. Each chunk has a number and can have a large number of model files set for it. All files with the same NN number make up the same chunk. For the game to know which chunk to display at a given time, it uses the *_blk.bin file. If the file has no number (SLL_XX.BSP) it'll be rendered all the time. This is used for Lost Jungle and Egg Fleet skyboxes, for example.

There are multiple files for each chunk so each one will have different material settings applied to them. For a complete list of material setting identifiers and the difference between each of them, see Material Flags. For normal level models, you'll mainly be working with the ON and ONS identifiers; the only difference between them is that on top of ONS, shadows will be cast. AFN will use alpha for transparent textures (and on AFNS it'll cast shadows). DN is for the skybox.

Drag an .OBJ file into HeroesOBJ2BSP to convert it into a BSP file. Name it according to the above explanation (if this is your first test, you should name it SLL_ONS_01.BSP) and place it inside the .ONE archive for your destination level with HeroesONE. You can drag any amount of .OBJ files for batch conversion, or just run it and it'll convert every .OBJ file it can find in the folder. Remember Sonic Heroes uses the Y-up format, not Z-up. Each BSP can have a maximum of 65535 vertices and/or triangles; if your level in total has more than that, that's one of the advantages of splitting into multiple files. This should already be enough for the model to load, as long as the file is named correctly and the camera is located inside the visibility boundaries, which are explained below.

Visibility

For more information, see Visibility Editing.

Each chunk is rendered if the camera is inside the visibility boundaries defined in the _blk.bin file. We'll use Heroes Visibility Editor to edit it. The file is named sLL_blk.bin or stgLL_blk.bin the same way the .ONE is. Open the file in the editor and set the minimum and maximum coordinates you want the model to be visible in. For precise values, create a box in 3ds Max and make sure it encompasses the entire chunk (but it doesn't have to; for example, skybox models are located far from the chunk boundaries). Then, export the box to a .OBJ and get the values from there (getting the values straight from 3ds Max is risky as it uses the Z axis for up, unlike Sonic Heroes which uses Y-up). You should test your model now, or wait to do so after adding the textures.

Textures

We'll be using Magic.TXD for the textures.

HeroesOBJ2BSP will try getting the texture names from the files specified in the .OBJ's referenced .MTL file. If you exported your model with the default 3ds Max settings, it should do this with no problem. If it fails to, it will use the material names (set by usemtl in the .OBJ file) as texture names. It will warn you if it does so.

The TXD files for level textures are located in dvdroot/textures. You'll probably figure out by now the name of your level's. Open it in Magic.TXD. Use Edit->Add or the Insert shortcut key or just drag your images into the list to add them to the file. Save and make sure the version of the TXD is correct (it should be Sonic Heroes PC, or GameCube or PlayStation 2 if you're editing those versions). Don't delete the original textures from the file unless you're sure of what you're doing. Remember this file contains textures for both level and object models. If you extracted the textures from the game already you obviously don't need to add them a second time. You should test your model now and it should render correctly.

Level Collision

For more information, see Collision Format.

First, you must create a collision model. You should start from your level's original model, but get rid of details such as plants that are not supposed to be touchable. You can also add invisible geometry to your collision model. Replace stairs with ramps. This model has a maximum size of 65535 vertices and/or triangles. Once converted, replace the collision file in the dvdroot/collisions folder.

Neither of the currently available tools for collision generation are complete at the moment; there's no way to tell them what's a floor or a wall yet, and no way to create pinball and bingo surfaces unless you hex edit the file yourself.

Using HeroesOBJ2CL

Once the model's ready, export it as an .obj and drag it into HeroesOBJ2CL. It ask you for a maximum depth level. If this is the first time you generate the file, you should try something between 3-5, as you probably want to test the level right away and don't want the operation to take too long. Lower maximums will take much less time to generate, but the resulting file is unoptimized, meaning the game will take more of your CPU and might slow down more often. If you're releasing your level now, try higher values, or just type 0 for the program to choose one atomatically (it'll try to make each quadtree node about 50 units in side). Models with lots of triangles and a high depth level can take a very long time to get ready (don't expect less than an hour, you should leave it running and go outside or something).

Using HeroesCollisionGenerator

HeroesCollisionGenerator is a much faster alternative for OBJ2CL made by sewer56lol. You can get the source here.

To do

Death Zones and Water

To do

Objects

For this, you'll need Heroes Layout Editor and Heroes SET ID Table Editor. Object layouts are contained in s**_p**.bin for each level and team. Please read the Object Editing and Object Porting pages for info on this.

Starting Positions, Ending Positions and Splines

For more information, see EXE Editing.

You'll use HeroesTweaker for all of those. This data is located in Tsonic_win.exe.

For starting and ending positions, the only thing that shouldn't be self-explanatory is the hold time; it's the time you spend running before you gain control of the characters. It only applies to a Running start mode. Get the coordinates from the object layout editor for convenience.

Splines are located in Tsonic_win.exe. There are 3 types of splines: autoloops, rails and ball paths. By the way, ball paths are those tubes used in Casino Park and BINGO Highway (it's them in those Power Plant green spheres as well).

HeroesTweaker lets you edit splines for most levels (we have all single player levels, but not all bosses and 2P levels yet; if you find the pointer list to the splines of any level, add its offset and amount of pointers to SplinePointers.ini and to this wiki please). It can edit the spline type for each spline, as well as export and import an OBJ file with them (when importing, make sure the only thing in the OBJ file is the spline). The imported file must have the same amount of vertices as the original one. You can't add or remove splines or vertices. If you wanna add more vertices to a spline, you must hex edit Tsonic_win.exe and do that there (if you wanna add more points to a spline, you'll have to switch some pointers around, but you can import the spline in HeroesTweaker after that).

Note that if you want a very long rail or autoloop and your level doesn't include that, you can glue the end of a spline to the start of the next and it will act like it's the same one (the original game actually does this all the time).

Other Stuff

Lightning data in s**_light.bin files. We don't know their format yet, but we do know they contain multiple light data entries. They are applied to characters and objects only (it's not environmental lightning). The main entry is applied all the time, and each of the other entries is applied by trigger objects.

Music is located in looping ADX files in the bgm folder. If the music's not looped, it won't start again after ending.

We also have Indirect Editing and Particle Editing.

There's one thing we do not know anything about yet; those are cameras. For now, just replace the _cam.bin file with an empty one. Eventually we'll be able to edit them as well.