Sonic ‘06 – Greenflower Zone Mod Technical Write Up

A rewrite/translation of this post from my Tumblr, as Tumblr isn’t the best source for a longform write up, and its out of date at this point due to being written around the time of the 1.1 update for Greenflower Zone. With 1.3 having being out for over seven months(!) at the time of writing, I felt like I should finally get back off my ass and get to work on bringing the write up up to date.

Original Proof of Concept

Image

Back in May of 2019, I started toying around with some old Sonic ‘06 tools, thanks to my interest in modding the game rising following improvements in Xenia which made the game more playable within it. As I’d previously done Greenflower Zone Act 1 for Shadow The Hedgehog in February of the same year, I decided to use it as an experiment for importing stage terrain into ‘06; as I already knew the rough process for converting a model to an XNO thanks to me trying to put one of my Sonic Forces Avatars over Sonic.
However, we didn’t have a way to do collision at this point, and I didn’t yet understand how formats wrapped in Sega’s proprietary BINA container worked, so my initial plan was to use the common_stopplayercollision object to kind of fake the collision so I would at least be able to walk around it. Unfortunately, the character doesn’t treat that object as ground, so they just float above it, the next solution was to slap down a random prop object (one of the Wave Ocean Parasols) and then use the Purple Gem to fly around, which did work. I then decided to place some objects around by manually typing in coordinates based off the object placements I’d previously done for the Shadow port, just to get a feel for how the stage would potentially look in ’06.

Initial Collision Experiments

Image

Shortly afterwards, Melpontro offered to convert a collision mesh for me using an old, private LibS06 based tool from around 2014. While we didn’t have surface tags on it, it was a good enough job to let me experiment more with the stage, which I did by continuing to copy and paste object coordinates from the Shadow port, again, all in plain text XML files. As a result, objects weren’t rotated correctly due to Quaternion Rotation being a hell I still don’t fully understand, positions were also weird as I would have to check an object in game to even see if it was close to being correct due to the lack of any form of visual editor.

Initial Usage of SonicGLVL

Image

At some point, I hit upon the idea of using SonicGLVL (the Sonic Generations Level Editor) to visualise the object placements. This mostly came about due to me remembering that object rotations in Generations SET Files are also Quaternions, so I could copy and paste their values to get the rotations correct. While I was still hand typing everything, this made it easier to determine object placements, especially considering Shadow The Hedgehog could spawn multiple Rings from one Ring object, a feature ‘06 lacks, as a result, I always had to guess the right coordinates for the other Rings with no way to check it without booting up the game, whereas GLVL allowed me to at least visually eyeball it.

This allowed me to very quickly place objects in, as I was still referencing the hand placement of things I had done for the Shadow port. After a bit of time, I decided to code an automatic converter, which massively sped things up, as I was no longer manually typing values into a rapidly growing XML.

Surface Properties and Sticky Walls

Image

A few days after I’d done more SET work, I sent Melpontro a version of the collision with various meshes tagged by type, allowing him to create collision with various Surface Properties, resulting in proper footstep sounds for surfaces. However, this also led to an issue caused by ‘06′s unusual tagging system for collision meshes.

Walls in ‘06 need to be tagged as such, resulting in quite a bit of trial and error until we got it mostly working (although I’m sure there was still some ones that got overlooked in the initial tests).
With Act 1 done to a good enough state for a couple of proper proof of concept video clips, it was time to move on to Act 2.

WinForms and HedgeLib

Image

Around the time of working on Act 2, I decided to start cobbling together various small C# programs using HedgeLib to try and help me with the learning process, while I was roughly familiar with bits and pieces of the ‘06 SET Format thanks to my previous work on the Sonic ‘06 Randomiser there was still a lot of things I didn’t know.

One of the first things I wrote was something that would load a SET File and allow me to see all the parameter values of the objects within the SET. This allowed me to document what I thought the parameters for certain objects do (while also discovering a frustrating quirk in HedgeLib). As time passed, work continued on Act 2, while I also started creating an original layout for Shadow, designed under the mindset of playing the stage backwards. Before I got sidetracked working on something else.

The Mod Manager’s Early Beginnings

Image

Over time, I gradually became frustrated with having multiple copies of ‘06 and accidentally cross contaminating them with various mods thanks to me copying them to the wrong install. While Hyper had a GitHub page for a Sonic ‘06 Mod Manager, it didn’t actually work, leading to me to write a small C# Command Line application to copy and remove the Greenflower files for me. This eventually led to me creating a small GUI for it with the ability to load multiple mods together, which would soon be expanded upon.

Around the same time, I also experimented with Melpontro’s old Emerald Coast stage mod thanks to me being given the files (still not sure I was ever meant to have them…), managing to get it running on Xenia, while also figuring out how ‘06 handles volume objects such as camera volumes. I also brought back a joke Sonic Forces mod at this point, Chair The Sonic, which would evolve into Furniture Adventure 3 before I killed the joke thanks to it going far enough to become unfunny.

Greenflower did take a backseat at this point, only really being used to test Vertex Colours for underwater colouring, as well as experimentation with the game’s dynamic lighting system. Though it would soon be used as a testing ground for something.

The GLVL Converter

Image

On the 2nd of June, I posted the above image to my Twitter, based on the wording of my tweet, it sounded like I already had a system in place to convert Generations objects to ‘06. However, I would have still had to do all the parameters manually in an XML. This process seeked to change that, with me manually creating GLVL Templates for objects as I needed them and writing code to auto convert them (shamelessly ripping off the GensToForcesSETConverter in the process). At a future point, I wrote a tool that would autogenerate the templates for me, although the object parameters were just labelled as Parameter1, Parameter2 and so on.

Throughout the process of experimenting with and understanding objects, Greenflower was used as my test bed, as I was too lazy to make a proper test stage for myself at the time and didn’t really have easy access to the unused test level recreations.

The Mod Manager and Tropical Jungle Extra

Image

While working on the SET Conversion experiments, I continued to work on my Mod Manager alongside it before creating a new experiment to mess around with the DLC system and the converter. I started creating a layout for the third section of Tropical Jungle for Sonic, as he does not normally visit that segment of the stage.

Greenflower took a massive backseat at this point, as most of the focus went into Tropical Jungle Extra, before me and Hyper teamed up to create a better Mod Manager out of both of our work. After releasing Tropical Jungle Extra, I worked on a similar concept for Silver and the first section of Dusty Desert, although this never saw the light of day, nor did my short lived attempt at creating a DLC episode for Knuckles.

Lost in Translation and Camera Experiments

At some point in July, I started tinkering with Greenflower again, rebuilding the SET files from the ground up with our new templates and the GLVL Converter, while also experimenting with using dynamic cameras for some parts, at some point I also inserted the music thanks to our XMA workarounds. However, thanks to me having no ability to experiment with the collision, I drifted away from it again and started working on a new project, messing around with Google Translate’s API. This project became Sonic The Hedgehog: Lost in Translation.

I was still working on the Randomiser at this point, so my attention was very divided, with Greenflower slipping down the priority list. At this point, I was also aware of SRB2 2.2′s intent to redesign the zone from the ground up, which pushed it even further down while I waited for it.

The Public Collision Converter

Image

Towards the end of the month, I remembered Sajid’s previous attempt to write a Collision Converter for me using LibS06, after requesting that code, Skyth provided me with the line to make it work, which I tested on a shoddy import of the Sonic Adventure 2 version of Green Hill Zone Act 1.

With a Collision Converter in hand, I started experimenting with other stages, creating a version of Westopolis for ‘06, as well as some other experiments that didn’t go very far. Before eventually jumping back into and finishing Lost in Translation.

Image

At this point, Greenflower was still on the backburner, with me only really using it to see how the Sonic Adventure HUD mod would look with it and also putting it into the ‘06 demo for the hell of it.

More focus was placed into the Mod Manager around this time, with us rewriting it (leading to the creation of the Aldi Mod Manager jokes).

Image

I also randomly messed around with Mortar Canyon from Sonic Forces for some silly reason, there isn’t really much to say about it, other than the fact that I needed to use the Switch terrain, as the PC terrain behaved unusually.

Image

Sonic Robo Blast 2 Version 2.2

Following the release of Sonic Robo Blast 2 Version 2.2, I tested opening and exporting the Greenflower Act 1 terrain for it from Zone Builder to see if it still worked, and it did. As a result, I started messing with it again, although my priority at the time was on my Tropical Jungle mod for Sonic Forces. Issues with the Zone Builder export also lowered my motivation to work on it, although I continued to experiment in the background, trying to find fixes.

About a week later, I toyed around with the Zone Builder source code, finally managing to correct the issue, which was caused by Zone Builder’s OBJ exporter “optimising” the exported terrain by throwing out certain vertices.

With the source for Zone Builder, I also experimented with having 100% accurate object placement, writing a small hack to export the Thing Placement into a text file which I could then use to write into a SET file with HedgeLib. However, object heights are handled incorrectly in Zone Builder, requiring me to fix certain objects manually.

Image

As I finished up work on Tropical Jungle for Forces, I started working more on Greenflower in the background, while also experimenting with some dumb jokes. However, I soon hit another motivational block, The water and grass edges…

Nonami the Material God

Thanks to poor documentation of the XNO format (and the Ninja library itself being a GARBAGE thing), we had no clue how to make transparent objects look good or how to make translucent objects at all. As a result, I kinda trailed off for a while. However, on the 2nd of March, Nonami showed an image on the Lost Legacy Discord server of translucent water in their Emerald Coast mod and also told us the byte to hex edit to enable it. A quick test later, and I had translucent water

I soon moved the level over to the Kingdom Valley slot, as I wanted to use the breakable wall object that stage has, which meant I needed that slot for the sound, before following up with creating Vertex Colours for the underwater terrain.

Hyper later took over some work on the Skybox and Grass Edges, experimenting with hex edits and texture upscaling to help smooth out the transparent edges while I worked on creating the SET files for the other characters  He also worked on fixing up the fence collision for me, as the way it exported from Zone Builder caused Sonic to be able to fairly easily clip through them.

Image

Eventually, I decided (with very little thought behind it) to make various elements of the stage grindable, before following it up with (incredibly tedious to make) Light Dash splines.  Eventually, me and Hyper screwed around with it in Multiplayer late into the night, giving us the inspiration to start trying to create a Prop Hunt gamemode for ‘06 too (see the Silly Proof of Concepts page for information on that trainwreck).

With most of the motivational stumbles out of the way, I decided to tackle the flowers and trees by recycling models from Sonic Lost World and Sonic Generations, a process which proved extremely tedious, as the XNO Converter we use only allows for one model at a time. A fact which didn’t help when I needed to export every single flower and tree one by one.

The Act 1 Release

On the 18th of March 2020, I decided to FINALLY release a version of Greenflower, with it soon being updated to correct a few small issues I’d overlooked. After a small break, I started working on Act 2. Thanks to my workflow developed for Act 1, Act 2 went fairly smoothly at first, as I already knew what I needed to do to make the grass edges and water look good. I could also copy the Skybox from Act 1 with no problems, which was nice.

The Act 2 Retargeting Whack-a-Mole

When it comes to level layouts for ‘06, easily the biggest annoyance comes from objects such as Springs. In ‘06, Springs can target other objects by their IDs, which is a really nice feature. However, if the object IDs get changed around, then the target will no longer match up, as a result, I had multiple points where I had to comb over the act to make sure every Spring still targeted the correct object. This was an issue that was much more pronounced in Act 2, due to there being many more Springs in it.

To make matters worse, the object IDs shown in SonicGLVL seem random, so to get the ID of the object I wanted to target, I’d have to convert the SET and look for the object there to get the correct ID. Towards the end of development, I hacked something together that would make the GLVL IDs match the converted ones, making it much easier to handle, if still tedious. My insistence on deleting unneeded objects in the various other character SETs is the primary reason for this headache.

Another problem I noticed a lot in Act 2 (and have since noticed in a few spots in Act 1) were seams in the terrain where Zone Builder didn’t export the terrain correctly, while these were (mostly) easy to fix, it was tedious every time. As it involved the following process.

  • Remove the Skin Modifer
  • Edit the affected meshes so they’d join up correctly
  • Reapply the Skin Modifier
  • Export the edited meshes
  • Import them one at a time
  • Edit the collision
  • Export the collision
  • Convert the collision

Not hard, just tedious, as with a lot of the work that needed to be done on this project.

Specular Mapping

At some point, I toyed with the idea of adding a small specular map on the windows and roofs of the various houses scattered around the zone. After multiple attempts which blew up in my face, Nonami pointed me to a shader that would do what I wanted, creating this nice, actually fairly subtle effect which was also added to Act 1 for consistencies sake.

However, attempting to add this trick to the water did not go well at all…

Developer Time Trial

At some point when working on Version 1.0 of Greenflower, I changed the text for the Hard Mode selection on the stage select to Not This One. Thanks to me not bothering to make a Hard Mode SET thanks to me finding them to be a waste of time.

In Version 1.01, I did sneak a small SET in that would be loaded if you selected the option, but it otherwise served no purpose.

While messing with the Town Mission timer for Prop Hunt, I realised I could use it to create a Developer Time Trial mode, by simply recording my best time and setting it as the Timer’s value. Originally I intended to record runs for all nine characters, but a limitation of the DLC system prevented me from neatly adding them for the amigo characters, so it was cut down to just Sonic, Shadow and Silver.

These also use slightly modified SETs, mostly to remove the Bronze Medals, Starposts and Voice Triggers.

Bronze Medals

When initially importing the SETs, I decided it would be a cute idea to replace the Emblem and Emerald Tokens in SRB2 with the very underused Bronze Medals. As it turns out, ‘06 actually has a counter for these medals that goes unused in the final game, activating the counter was a simple as adding  OpenMedal(_ARG_0_, 15) to the main event in the stage’s Lua file. While the medals serve no purpose in Greenflower, I felt like enabling the counter just to show an unused piece of ‘06 off while also encouraging exploration in the form of Medal Hunting. Although the Act 1 medals did find a use later on.

Christmas Greenflower Zone Act 1

One of the things I’d noticed early on with the import of Act 2 was a collision error at the very end of the act, where a hole in the wall that is meant to be solid turned out to have a hole in it that the player could fall out of bounds through.

Rather than fixing this up, I decided to have some fun with it and throw a secret act in. The first time a 3D version of Greenflower Zone appeared was in Version 0.93 of the Christmas Demos back in March 2000. Due to how SHORT this version of the act was, I felt it would be trivial to put in, which turned out to be true.
The hardest part was actually acquiring the terrain, as the floating Rings in those older versions were done in a very messy way. So, instead, I turned to the SRB2: The Past project and used that as the base for the terrain.

Hyper also took and tweaked the collision for that act as well, as he wanted the snow to be a little higher than the player so the footprints they “leave” in it looked correct.

Red Volcano Zone

Image

At some point, following Version 1.1’s release, I started working on another “small” project. However, unlike with the rest of my stuff I decided to present it in a different way, by cropping screenshots to only certain points of interest. An act that turned out to be quite amusing to me and I would later repeat with Seaside Hill.

The idea to throw Red Volcano into Greenflower out of left field came from my knowledge of old Sonic Robo Blast 2 versions. In Final Demo 1.09.4, there was an early version of the act available as a secret level, accessible by clearing the game three times then jumping on the House at the beginning of Greenflower Zone Act 1 a few times. The idea to do something with this was in my head for a while, to the point where I was thinking about linking the Xmas Demo 0.93 act to it in some way.

It also turned out that the act in Final Demo 1.09.4 is encrypted, preventing me from using it. I was tempted to use the terrain from the SRB2: The Past WAD like I did with the Xmas GFZ1, before deciding that the 2.2 one would be a better fit and a more interesting challenge. At the time, I was only making the layout for Sonic, so I based everything around his moveset; a choice that would turn out to require a lot of rejigging later down the line.

Ironically, Red Volcano ended up being longer than both the acts of the main mod COMBINED. I also never SAID how to access it in a public source, although the 1.3 overview DOES show its access method.
The 1.2 update was almost entirely focused on Red Volcano, however it DID tweak Greenflower a bit by replacing the ambience_collision objects with an unused version just called ambience. This allowed me to have sounds in a point in 3D space, rather than just having them play when in a volume.

Version 1.3 and a Development Throwback

A few months after I released Version 1.2 (and gave it a small update to tweak some ambience stuff) I managed to uncover an old, pre SRB2 2.2 version of Greenflower Zone and decided to do one more content update. By redoing the 2.1 Version of the zone that I was initially experimenting with back in 2019. Very little actually happened in the 2.1 Revision’s development, although I did decide to slip in one more secret act, in the form of the version of Techno Hill Zone Act 1 that was seen in SRB2 Demo 2, the first time it appeared.
Not much to say on both fronts really, as I never actually had anything major to share regarding it, I’d mostly nailed down the workflow at that point so it didn’t take much to throw together.

The Refactoring Nightmare, or, Why I Learned To Hate A Lack of Foresight

At some point during the development of Version 1.3, I decided that I would go through and refactor all of the object SETs for a 1.3.1 update, as part of the reason I never bothered to give Shadow, Silver or the Amigos access to Red Volcano was due to not wanting to bother with cloning every object nine times. Almost immediately after I pushed Version 1.3, I got to work on manually sorting everything, going through Sonic’s SET (as all the others were based off of his) and finding objects that all nine characters have. Once I sorted that, I moved them to a base SET which is loaded underneath the individual character’s SET. A process that took a LOT of time as there would be points where I’d realise “Oh this object isn’t needed by [x] character. Oh wait it is goddammit!”, leading to a lot of back and forth. Once it was FINALLY done, Version 1.3.1 ended up SMALLER than Version 1.3, despite having MORE content.

I did somehow break Red Volcano’s collision though, requiring a 1.3.1.01 update…

Closing Words

While it may not seem like too much on the surface, I personally am actually quite happy with how Greenflower has turned out. Its long development time and various restarts have given it the chance to fully take advantage of our advancements in the Sonic ‘06 modding scene (which are still ongoing even today). While there is still a lot left for us to learn, I’m content with this project’s release state and am ready to move on to something new in the future.

Greenflower for ‘06 took me a long time to make, and I’m glad to have been able to see it through. A special thanks goes to the people who helped me in this mod’s creation, it wouldn’t look as good as it does without Nonami’s XNO research and it may not even have gotten finished if Hyper hadn’t helped me test it and thrown some ideas my way.

Here’s hoping we can do some more quality ‘06 mods in the future and realise some of the potential this game never got to show (and maybe do some silly stuff along the way too!).