Import Levels Into Sonic Adventure DX: PC Using SADXLVL2
From Sonic Retro
|SCHG: Sonic Adventure|
(Original guide by ShadowBlitz) This is a basic guide on how to go about getting custom levels into Sonic Adventure DX: PC using the SADX Mod Loader.
- 1 Required Tools
- 2 Optional Tools
- 3 Step 1: Setting up your game folder for editing
- 4 Step 2: Set up a stage for import
- 5 Step 3: Getting your textures in
- 6 Step 4: Importing into SADXLVL2
- 7 Step 5: Adding objects from other levels
- 8 Step 6: Exporting from Struct Converter
- 9 Step 7: Setting up VS and compiling your Mod Loader .dll
- 10 Step 8: Putting your mod into SADX Mod Loader
- SADX Mod Loader Boots your mods up and contains some libraries you'll need for compiling your mod .dll.
- SA Tools This contains most of what you'll need to set up and run mods for this game.
- Some type of 3D editing software. Dude's scripts make it more convenient to use 3DSMax, but you really don't have to if you choose not to.
- Microsoft Visual Studio I use 2010 so my guide will be based around that, but newer versions and other compilers will work.
- Dude's max scripts. To start, the only thing you want here is sadxNodetable1_6.ms. Its not necessary, but it can make importing back into your SADXLVL2 much easier.
- Cracked SADX exe This might be needed for splitting files for use with mod tools.
- Puyo Tools This is for building PVM archives for custom textures. I mainly have this here for adding in transparent textures as PVMEditSharp gave me issues with them.
Additional Notes: Your end result .dll will only contain things you could compile into it. This means that if you want to distribute your mod with your SET, music, or textures for example, you will need to add these to your mod folder manually. To do this, simply add the files into a folder structure that mirrors what you see in your game folder. IE. If you wanted to add your music to the mod, make a folder structure in your mod folder that goes system/sounddata/bgm/wma and put your music file inside.
Step 1: Setting up your game folder for editing
- I'd recommend you have a backup folder for all of your game files since you will be making a bit of a mess. Once you're ready, move all of the files in SA Tools' SADXPC folder as well as the objdefs subfolder in its entirety into your game directory. Then you'll want to run splitall.bat which will extract models and various other things from the game exe and its dll's.
Step 2: Set up a stage for import
- I'm going to assume you have something or other you'd like to import. The Models Resource is a great place to get stuff if you like, but be sure to correct the normals, rotation and scale on the models if needed. Note that Sonic himself comes to about 0.125 meters wide and 0.25 meters tall for reference.
- Ideally, you should separate what you're importing by the materials/shaders it uses since at this time the editor will not accept multiple materials on one object. Basically, unless you plan to use the exact same texture for everything that you want to separate your models out and possibly combine as necessary. Dude's maxscript will combine objects of like materials if you're using max for this.
- If you're using 3dsMax and you're planning to import with Dude's script, you can edit the properties of your models before you export them by right clicking an object, going to obect properties, and adding text in User Defined Properties. For example, if you wanted your object to be solid you would put "solid=true" without quotations or spaces. Only one flag should be on any particular line.
- The available flags for User Defined Properties are: solid, water, nofriction, noacceleration, cannotland, increasedacceleration, diggable, unclimbable, hurt, footprints (only seems to work in Emerald Coast), and visible. By default your models will have solid and visible set to true unless you set them otherwise.
- When everything here is done, you export your models into separate files. If you're using the nodetable exporter, you can save yourself some time by running nodetable like this and hitting "Export Data". Be sure if you use the nodetable exporter that you convert everything to editable mesh that you are exporting!
Step 3: Getting your textures in
- There's a number of tools for doing this, but PVMEditSharp, which was included with SA Tools, is what we'll be using here for the sake of simplicity. Open up the PVM you'll be using, which should be the PVM for whatever level you're editing. A list of what PVM is for what can be found here: Sonic Adventure Texture List.
- To change a texture, hit import with one selected to put in an image over it. Add and remove at the bottom can also be used to do what you'd expect.
Step 4: Importing into SADXLVL2
- Start the program and load sadxlvl.ini from your game folder. From here, you can load levels. Most things work, but a few random things can't be imported back into the game. For now, lets go to Emerald Coast 1 just for example's sake. The editor will load up the level at its zero coordinates which in this case will put you just under the beginning of the level.
- To control the editor, use left click to select things and right click to bring up a dialog that lets you add obects, level pieces, cameras, or death zones. To move, hold middle mouse by itself and move the mouse to pan around, hold middle mouse and ctrl to move forward and backward, and use middle mouse and alt to look around.
- By default, the editor will import objects at the position your camera is at -20 from its Z position(also known as the Y coordinate in most 3D Software). This occurs even if you're using the import option under File->Import. So before importing, change level into the level you want and import without moving to a different position. Also note that if you import through File->Import that you have the option of clearing your level models which you may want to do if you're not editing anything.
- When importing, you have the option of importing a nodetable or importing an .obj. Note that if you import by .obj you WILL have to import your level parts individually.
- You will need to assign your textures for them to show up ingame and in the editor. To do this, left click an object, set the diffuse map to your texture, set "Use Texture" to checked, and Exp to 12. You will also probably want to turn on Super Sample and if you're using a transparent texture, Use Alpha. Setting a Diffuse Color from the color selector will allow you tint your texture although you can set it to white to make it appear more vibrant. Most other options are fairly self explanatory.
- Also remember that clearing level models does NOT clear death zones! So if you have your level going under where the water would be, you'll need to check Death Zones under View in SADXLVL2 and select/delete them if need be. Conversely, you can add them as mentioned before. Note that Death Zones can be as complex as any other level geometry if you so wish.
- Note that as of this writing, animated textures can not be assigned. Models with textures that were animated that are exported through SADXLVL2 will lose this effect ingame.
- Another issue that should be known is that making geometry go too far outside a certain area can cause levels to crash. The game doesn't seem to care too much about putting things way up in the air in most cases, but I've had problems putting geometry too far out horizontally in certain directions and too far under the original map in the past. Perhaps someone more knowledgeable could explain this phenomena. Regardless, staying within the original level bounds shouldn't cause issues.
Step 5: Adding objects from other levels
- If you just want to see your geometry ingame, you can skip this step. Now as you've probably noticed if you wanted to add anything to your level, you can only see objects from the level you've opened right now which if you've been following this guide is Emerald Coast. Now we're going to add an object from another level here.
- For the sake of this example, lets bring over the Boa-Boa, the pink snake enemy. To do this, you'll need to go into the levels folder that the split earlier should have made. We know that Boa-Boa can be found in Windy Valley so we'll go into that level folder.
- To bring it to another level, we'll need two things: Its object ID information and its texture ID information. First, open Object List.ini and go to Boa-Boa in SADXLVL2 in Windy Valley. You'll see its ID is 29. Now if we go back into Object List.ini, we'll see under ID 29 something with the name "E HEVY". Copy that whole block and put it at the end of the Object List.ini for Emerald Coast while making sure to correct the object ID to whatever would be next.
- For Object Textures.ini, we do pretty much the same thing as above except that there's no obvious way to get the ID other than knowing which textures apply to what. In this case, I happen to know that E_SNAKE is the name of Boa-Boa's textures so copy that to the end of Emerald Coast's Object List.ini and do the same thing as before.
- Save both files we've changed and reopen Emerald Coast in SADXLVL2. At the very bottom of your object ID's when you're making or editing a model, you should see Boa-Boa now. It doesn't have a model that will show up in SADXLVL2 by default, but it should show up in game properly when we compile later if everything went correctly.
Step 6: Exporting from Struct Converter
- Now that you've saved everything you've intended to edit, open Struct converter. Navigate to your SADX folder and select sonic_data.ini (or *whatever your game exe was named*.ini). After a moment, this should bring up a large list of things. Right now we only need a few so hit uncheck all.
- Select whatever you edited if you want it to show up. For the purposes of this guide, select Sonic or any other character's Start Positions if you changed them, select Emerald Coast's Death Zone's and LandTable (not Textures), and its Object List and Object Textures.
- When you're done, hit Export and save it somewhere.
Step 7: Setting up VS and compiling your Mod Loader .dll
- Start Visual Studio. Go to File->New->Project... and then select Win32 Project (or select Windows Desktop and Dynamic-Link Library (DLL) under Visual C++ in later versions). Name it and click OK. Next, select Application Type: DLL and hit finish. Next, copy ninja.h, SADXModLoader.h from the SADX Mod Loader's programming folder, the Modloader and SADXModloader folders, as well as the .cpp file you exported from Struct Converter into your project folder. Drag the .h files into Header Files and the .cpp file you made under Source Files all under Solution Explorer.
- Struct Converter's output needs one line added to make it compile correctly with the default project settings. Double click it in the Solution Explorer and go to the second, empty line. Paste in #include "stdafx.h" (BEFORE SadxModloader.h or expect many errors!) and save it.
- Near the top of Visual Studio, make sure to the left of the dropdown that that dropdown says Win32 or x86 that it says Release and not Debug.
- From here, we just compile by going to Debug->Build Solution at the top of the program or hitting F7 on the keyboard. Navigate to the folder directly above where your code files are and then go into the Release folder. Do not go to say MyProject/Myproject/Release instead of MyProject/Release or you're in the wrong place despite the similar folder names.
Step 8: Putting your mod into SADX Mod Loader
- Navigate to your SADX Mod Loader folder and into the mods folder. Make a new folder named whatever you want. Inside that, place your .dll file and make a file named "mod.ini". Open it in Notepad and put Name=(Your mod name), on the next line put Description=(Whatever you want here)., on the next line put Author=(You), and then on the last line put DLLFile=(your dll name.dll).
- And now you're done. If you load SADXModManager.exe and check your mod, it should show up ingame with whatever changes you've made assuming everything went well.