Jump to content

SonicGLvl

From HedgeDocs
Info
This page is incomplete.
SonicGLvl
SonicGLvl
Author(s) DarioSamo


SonicGLvl is a LibGens tool for editing levels for Sonic Unleashed and Sonic Generations. Developed originally to assist in the development of the Unleashed Project mod, it has been a staple of level editing for Generations mods over the years.

Its main purpose is to modify dynamic objects in a pre-existing level. To make your own level, use Hedgehog Converter to generate terrain, and Havok Converter for collision.

For general information on how to use SonicGLvl, refer to this guide.

Features

Overview

An example of Jungle Joyride Act 1 (Night) in SonicGLVL, showcasing several features of the editor including game-accurate shaders, object templates, and more.
The SonicGLvl main window

SonicGLvl is designed to modify set object data from Unleashed and Generations. As such, it offers a full 3D viewport to navigate levels with 3D manipulators for changing position and rotation data. GLvl provides object palettes of different types of objects, such as common, stage-specific, and enemy objects, and helper objects such as "SonicSpawn" which can assist in iterating on level design. Each object has a collection of parameters that can be modified with live feedback depending on the type of object. How these parameters affect what is displayed in-editor can be configured by the user on a per-object basis, through modifying its "template," which will be explained later.

Levels in both games use "Layers" which categorize and organize objects of different types. In Generations, this is limited to a certain amount of layers that are always active (such as base, effect, sound, etc.), along with layers numbered 00 to 09 which can be enabled and disabled through trigger objects. In Unleashed, users can define as many layers as they want in Stage.stg.xml. These layers can be set as the "active layer" through the option on the bottom left of the window, titled "Current Object Set," along with a visibility toggle--for particularly large levels, this can be quite useful for removing visual noise while editing.

A view of the material editor for SonicGLVL showing an animated Sonic with game-accurate shaders.
SonicGLvl's material editor

SonicGLvl also features a material editor, with a live preview window utilizing translated shaders from the original games to provide an accurate view of what the user's materials will look like in-game. This window also allows the user to import a skeletal mesh and preview any animation, useful when designing new designs for set objects and decorations.

Object Templates

An example of a SonicGLvl object template for the object "ChangeMode_3DtoForward" as seen in Sublime Text 3.
An example of a SonicGLvl object template.

SonicGLvl uses "object templates" to define dynamic objects that can be placed in the game world. These are manually defined by the user based on the object definitions in a given setdata XML file. Note that if SonicGLvl does not recognize an object present in a level's setdata files, the program will generate a default template based on the available information. This template will be incomplete, however--it will assume default values based on what it's presented in the given file, will assume all values are floating point numbers when some may in fact be integer values, and it will not have a model reference or support extra features such as collision previews. These features must be added manually by the user after-the-fact in order to take full advantage of the template system.

Most objects have had their templates created for them, though at time of writing some may have their parameters misattributed or incomplete. Beyond that, understanding the template format can be very useful for anyone creating their own set objects, something only possible through code injection. Currently, only custom objects in Sonic Generations are supported through use of BlueBlur API.

In-game Parameters

There are two main types of parameters: In-game and "Extra." In-game parameters are read by the game directly and are saved in their provided setdata XML files. The structure of an in-game parameter can be observed below:

<PARAMETER_NAME type="---" default="---" description="" />

PARAMETER_NAME refers to whatever the name of a parameter is in an object's definition in an XML file.

description can be filled in by the user to provide a tooltip when the mouse cursor is overlaying the parameter. This field can be left blank, though for unintuitively named parameters this can be very useful.

default refers to the default value for this parameter whenever a new object is created from the object palette. This can vary depending on the parameter's type.

type defines what type the parameter variable is. A full list of available types is listed below:

Type Description
bool Can be either true or false, case-sensitive
integer Any number not containing decimal places.

Often used for object "types," i.e. size variants or different colors.

float Any number containing decimal places.

Most common parameter type.

string References a string of characters.

Somewhat uncommon; used by hint ring objects, object physics, Unleashed NPCs, and a few others.

id A special type of integer referring to another object's SetObjetID in the world

Setting this to id instead of integer allows SonicGLvl to select a target object from the 3D viewport.

id_list A list of SetObjectIDs that can be arbitrarily extended.

Often used for objects that target multiple objects, such as Switch or EventSetter.

vector A Position parameter containing X, Y, and Z float components. Defines a point in 3D space.

Note that positions in Unleashed have an unused "W" component. This defaults to 1 and can be ignored.

vector_list A list of Position parameters that can be arbitrarily extended.

Often used for "waypoints" for certain enemy types, or anything else that requires multiple points in space.


For reference, this is what a basic object would look like in a setdata XML:

<MyObject>
    <MyParameter>0</MyParameter>
    <Position>
        <x>0</x>
        <y>0</y>
        <z>0</z>
    </Position>
    <Rotation>
        <w>1</w>
        <x>0</x>
        <y>0</y>
        <z>0</z>
    </Rotation>
    <SetObjectID>1234</SetObjectID>
</MyObject>

This custom object "MyObject" only has one custom parameter, that being MyParameter with a value of 0. Defining this parameter in a template file would look like this:

<MyParameter type="float" default="0.0" description="" />

Note that some parameters, such as "Position," "Rotation," and "SetObjectID" are part of the default parameters for all objects in Unleashed and Generations, with Generations adding a "Range" value. Some objects could benefit from a higher range value, however, so adding one to your template with a desired default value is still recommended.

Extra Parameters

"Extra" parameters are specific to SonicGLvl and are useful for better representing objects in the viewport. Their syntax differs from in-game parameters in a few important ways. Here's an example:

<Extra type="Type" name="---" />

name contains a string of characters that are specific to whatever type the Extra parameter is. This can change drastically, and unlike "description" for in-game parameters, this should not be left blank.

type defines how this parameter interacts with SonicGLvl's editor, often affecting the viewport.

A full list of available types is listed below:

Type Description
model A string for a 3D model file from the game resources.

An example would be chr_Sonic_HD.model

skeleton A string for a .skl.hkx file from the game resources. Required for animation playback.

An example would be chr_Sonic_HD.model

animation A string for a havok animation (or .anm.hkx) file from the game resources.

An example would be sn_idle00.anm.hkx. This animation will loop perpetually.

Note that more than one "animation" parameters can be made to change the default animation.

description A string that describes the object.

Will show up as a tooltip when hovering over the object in the object palette.

scale_[*] This property will set the scale of an object. Accepts either numerical values or a string.

The [*] should be replaced with the desired axis to be scaled.


If a number is provided in the name field, it should be enclosed in quotation marks as if it were a string. Thus the syntax for a value of "3" in the X axis of this parameter should be written as:

<Extra type="scale_x" name="3" />


If a string is provided, it should match the name of an in-game parameter exactly. For example, the object SszUpDownPole uses the parameter ModelLengthWidth to control the X scale of the model. This syntax would be written as:

<Extra type="scale_x" name="ModelLengthWidth" />

offset_rotation_[*] This property will set the rotation of an object. Accepts either numerical values or a string.

The [*] should be replaced with the desired axis to rotate along in euler angles.


If a number is provided in the name field, it should be enclosed in quotation marks as if it were a string. Thus the syntax for a value of "180" in the Y axis of this parameter should be written as:

<Extra type="offset_rotation_y" name="180" />


If a string is provided, it should match the name of an in-game parameter exactly. For example, if an object had a parameter labeled Twist to control the Z rotation of the model, that syntax would be written as:

<Extra type="offset_rotation_z" name="Twist" />

offset_rotation_[*]_speed
This property will set the rotation of an object over time. Accepts either numerical values or a string.

The [*] should be replaced with the desired axis to rotate along in euler angles.


If a number is provided in the name field, it should be enclosed in quotation marks as if it were a string. Thus the syntax for a value of "120" units per second for the Y axis of this parameter should be written as:

<Extra type="offset_rotation_y_speed" name="120" />


If a string is provided, it should match the name of an in-game parameter exactly. For example, if an object had a parameter labeled TwistSpeed to control its Z rotation over time, that syntax would be written as:

<Extra type="offset_rotation_z_speed" name="TwistSpeed" />

preview_box_[*] This property will set the scale of a transparent box when selected. Useful for objects that have collision volumes, such as ChangeVolumeCamera. Accepts either numerical values or a string.

The [*] should be replaced with the desired axis to scale the preview box.

If a number is provided in the name field, it should be enclosed in quotation marks as if it were a string. Thus the syntax for a value of "1" in the Z axis of this parameter should be written as:

<Extra type="scale_z" name="1" />


If a string is provided, it should match the name of an in-game parameter exactly. For example, the object ChangeVolumeCamera uses the parameter Collision_Width to control the X scale of the collider. This syntax would be written as:

<Extra type="preview_box_x" name="Collision_Width" />

Note that these extra parameters only exist to make visual feedback in SonicGLvl more intuitive. They will not affect what is saved into the game's setdata files in any way.

Cookies help us deliver our services. By using our services, you agree to our use of cookies.