diff --git a/docs/custom-track.md b/docs/custom-track.md index b18cf919a..c2221bb5a 100644 --- a/docs/custom-track.md +++ b/docs/custom-track.md @@ -1,79 +1,194 @@ -# Custom Tracks -This guide is -* Hastily written -* Made for advanced users -* A work-in-progress +# Custom Track Overview -This guide is not all encompassing and may be missing important information. A better manual will be drafted in the future. +This guide is not all-encompassing but rather covers the basics for track creation. ## Dependencies -* Blender v4.3 (older should work fine too). +* Blender v4.3 or older. * Harbour Masters Fast64 https://github.com/HarbourMasters/fast64 +## Configuration +* Set Fast64 Global Settings to `MK64` +* Set F3D Microcode to `F3DEX` +image -## How to use -* Add an empty <-- All of your meshes and path will go here. Place it at coordinate 0,0,0 -* Add a bezier curve <-- This will be the track path. Place it at coordinate 0,0,0 -* Add some mesh <-- The drivable surface should be a flat-plane, not a box. - * Goto the object menu and select a surface type (asphalt, grass, etc.) - * Stuff like buildings or walls should be separate meshes to not mess with the collision generator. - * The track/pavement should be a separate mesh from the rest of the scene. +## Adding the surface + +* Add an empty and place it at coordinates 0, 0, 0 +image + +* Select the empty and in the object panel select `Course Root` + * This is the root of the custom track. All mesh and path are placed within. +image + +* Remove the default cube +image + +* Add a plane and place it at coordinates 0, 0, 0 +image + +* The drivable surface *must* be a flat mesh. It cannot be a cube. +* Select the plane and scale it to a reasonable size by pressing the `s` key and dragging with the mouse. + * Z coordinate 420.0f must have mesh under it for the players to spawn correctly. + * This is approximately -16.8 Y in Blender units (420 / scale of 25) + +* One method to test the plane size is by adding a cube +image + +* You will likely want the surface mesh to be a bit bigger. However, this size will meet the spawn requirements. +* Delete the cube + +You now have a valid surface for racers to drive on. Multiple surfaces, hills, bumps, cubes, walls, spheres, etc. are all applicable types of mesh to add to the track. The specifics of crafting the track will be covered in another guide. Just know that there are proper ways to connect mesh together so the racers do not fall through while traversing from one mesh to another mesh. + +### Adding a Path +* Allows CPUs to follow the track +* Allows game to track players progress as they navigate the track + +* Add a nurbs path or bezier curve + * The nurbs path is easier to use and outputs very smooth results + * The steps below apply to *both* types of curve/path + image + +* Select the path +* Enter `Edit` mode (Press tab) +* Enable Normals +image + +* Normals shows these arrows which tell us which way is forward. +image + +Thus, the point marked as `1` is the first path point. This must be placed at 0, 0, 0. If it were to be placed at 5, 0, 0, it would have an unexpected offset in-game. + +* Move the other points farther forward so that they do not get in the way, and then set the first point at 0, 0, 0. +image + +* If you zoom out, this point should be placed at the very center of the plane. If it is not at the center, press `tab` to switch to `object` mode, and move the whole path to 0,0,0. Then switch back to `edit` mode and place the first path point at 0, 0, 0 + +* The point should now be at the center (presuming the plane is also centered at 0, 0, 0) + +* This next step is incredibly important +image + +* See the green Y in the compass at the top right corner? This shows the positive Y-axis. This is the direction players are facing when they spawn. As such, your path must go in this direction. If it goes in any other direction the CPUs will turn 90 degrees and drive off the track. + +#### Path Point Alignment +* Enter *Quad View* as this allows moving points from the top-down +image + +* Next enable *Magnet* mode (shift-tab) and *Snap Target* set to *Face* +image + +* Now you can drag using the all-axis mode (the white circle) and the points will snap to the mesh surface. +image + + +* Path points are now running in the correct direction +image + +* Next select that last point in the path and press `E` to extrude (add) another point to the path and place it farther forward. +* Continue adding new path points until you make a complete circle. +* The average track has ~800 path points. There's no specific number required, just enough that the CPUs traverse smoothly. + * If using the Nurbs Path, do not worry about how many path points. Just that the line connecting the points is smooth. + * If using the bezier curve, ignore the line that connects the points. Only the points matter! +* Keep adding points until you have a complete circle +image + +* Note that the start/end points do not need to connect to each other or anything like that. Just make them close +* If using the bezier curve you *must* place at least ten points behind the starting line in a straight line. + * The NurbsPath requires this as well. However, you don't actually have control over the number of points. So, just make sure there's 16.8 units of space behind the finishline. + +## Prepare for export +* Drag and drop the mesh and path into the empty so that they are within it. This can be done at the beginning or prior to export, either is fine. +* Hold shift while dragging an object --> place the cursor over the empty, and drop the object +image + +* Note that these objects have been named. This is not required. +* All the objects that need to be exported, must be inside the empty. + +## Export +* Name the track +* Choose a mods path +* Scale should be set somewhere around 20-25. 100 results in really big models in-game +image + +### Mods Path +* This should be something like `desktop/mycoolmods` or similar. All your mods will go here. +### Name +* This will determine what folders your track will be placed in. +* If you name your track `mytrack` then it will be placed in `desktop/mycoolmods/tracks/mytrack/files_are_placed_here` + +* Select the empty or any object inside of the empty and click export. If it says *Success!* then you should see files in the track folder. + +## Packaging +The track is now ready for packaging and import into the game for your first test! + +* Find the `desktop/mycoolmods/tracks` folder and place a mods.toml file beside the tracks folder. Place the following in it and save: +```toml +[mod] +name = "mymod" +version = "1.0.0" +``` +* Highlight the tracks folder and the mods.toml file. +image + +* Right-click --> *Add To Archive* and turn into a stored zip archive. + * This file should *not* be compressed. +* If you wish, you may rename this file to mod_name.o2r or mod_name.zip + +If you open the zip folder, you should immediately see the `tracks` folder and the mods.toml file. Inside `tracks` should be a folder with the name of your track, and some files inside of that folder. + +If it does not contain any files similar to the below then something has gone wrong. + +image + +* If all checks out, go to your game executable +* Add a `mods` folder. Drag and drop your mod into the mods folder. + +### Game Test +* Launch the game + +* Press `ESC` and enable *Debug Mode* +image + +* Navigate away and back to the start screen and a debug menu should pop up. +Use the left/right arrow keys to switch tracks. Custom tracks are placed at the end of the list. + +* Press *Launch HM64 Labs* to configure your track and place actors. +image + +* Select your track +image + +* Navigate to the Track Properties winow to modify track name and settings +image + +### Extra info +* Goto the object menu and select a surface type (asphalt, grass, etc.) +image + +* Stuff like buildings or walls should be separate meshes to not mess with the collision generator. +* The track/pavement should be a separate mesh from the rest of the scene. +* Any number of tracks may be placed in the tracks folder +* After opening your track in the editor for the first time. A scene.json file is created in your tracks data folder. + * If something ever goes horribly wrong you could manually edit this file or back it up to restore it later. +* If the game crashes when you try to play it. Then there is an issue with track path or mesh. + * The game generates the collision mesh automatically. +* Lighting changes are not currently saving to the scene file yet. ## Materials * Youtube tutorials discuss how materials work. * Fast64 often defaults to a CI8 palette texture, always change `Format` to `RGBA-16 bit` or `RGBA-32 bit` The Colour Index (CI8) format can cause issues if not used correctly. It's easy to confuse this as directly below this box it says `RGBA 16-bit` Example of incorrect texture format: + image Example of correct texture format + image ## Export * Check `Ignore Textures Restrictions` failing to do so may result in errors image - - -* FAST64 MUST BE SET TO F3DEX MODE (The others *should* work but they don't) -* Select the empty and click the SpaghettiKart and Harbour Masters profiles - -* Name: Track name here -* internal_game_path: must have `tracks/your_track_name_here` -* export_path: Choose an export location -* decomp_path: Leave blank -* Click Export - -## Preparation -* Place files in folder `tracks/your_track_name_here/the_files_here` -* Right click on the folder `tracks`, and turn into stored zip archive. - * This file should *not* be compressed. -* If you wish, you may rename this file to mod_name.o2r or mod_name.zip - -## Import -* Place mod in `mods` folder beside game executable. -* Launch the game -* Enable HM64 Labs in the ESC enhancements menu -* Enable Debug Mode in the ESC Developer menu (only required if using the debug menu to play tracks) - * If you are at the start screen, navigate away and come back, the debug menu will appear. -* In the Content Browser click `Tracks` -* Your track should be in here with an exclamation mark. Your track needs to be initialized. - -## Track Initialization -* An initialized track has a scene.json file in it. The game creates this file automatically. -* In the Track Properties window setup how you want and then click on your track in the Content Browser. -* The scene file should now be generated. If the game crashes, just restart. -* If the track no longer has the exclamation mark, your scene file has successfully been created. -* The track should now show up in the debug track list. - * You can use the debug menu to play your track. - * You can click on your track in the Content Browser under `Tracks` to play your track. - -## Playing Your Custom Track -* If the game crashes when you select it. Issue with track path or mesh is most common cause. - * The game generates collision mesh automatically. -* Adjust the settings in the track properties to whatever. -* Add actors or more mesh using the Content Browser -* Actors/Objects and Lighting changes are not currently saving to the scene file yet. - * You can place stuff. But it will not save. # Tips