Pokémon 4th Gen Mapping

Discussion in 'NDS - Tutorials' started by loco365, Oct 6, 2012.

  1. loco365

    loco365 GBAtemp Guru

    Sep 1, 2010
    I've finally gotten to know how to do map editing on the DS, although part of it is still touchy. I'll split this into several sections and cover each part of it.

    Table of Contents
    • 1. What you need
    • 2. Exporting a map
    • 3. Editing a map
    • 4. Importing a map
    • 5. Movement Permissions and objects
    • 6. Headers and the Map Matrix
    • 7. Credits and Final Info
    What you will need
    • Spiky's DS Map Editor (SDSME) - You can get the latest version from this thread. (Version 1.1 Min. required)
    • Nintendo NITRO SDK Plugins for either Maya or Autodesk 3DS Max (You can find these in a copy of the NITRO SDK. You'll have to Google for these, however, as they are copyright Nintendo.) and the program G3DCVTR, also in the SDK.
    • MKDS Track Editor (You can find the required version here)
    • Google Sketchup (Or another similar 3D editor that can import OBJ files. Note: If you're using Sketchup 8, download this (Click the orange Download button!) and install it, as it will allow importing of OBJ files.) Note: This is a paid program after the 8-hour limit, so it's up to you on what to do from there.
    • 3DS Max 6 OR Alias Maya versions 5.0, 6.0, 6.5 or 7.0 (Depending on what version of the SDK Plugin you want to use) (Note: These are paid programs, so it's your choice on how you plan to obtain these programs.)
    Exporting a Map

    To begin with your map editing, you'll want to export your map. To begin, download and open SDSME, and open your Rom of choice. Wait for it to open the Rom and simply dismiss the Headers Found messagebox. Afterwards, you're free to do whatever you wish, but for our needs, click the Matrix Editor tab, then underneath, click the Map Files sub-tab, as seen in the image below:
    Now, we must find the map you wish to edit. The map matrix is in the shape of the region of the game you're editing, so find the location that it is on that map, then double-click on the location where it is. Large locations are split into multiple maps as well, such as Jubilife City(DPPt) or Goldenrod City(HGSS). From here, we're going to export our map. Click the "Export" button underneath the 3D Model section. Save it to a location of your liking.

    Note, however, that it's in .nsbmd format, something we can't really edit yet. That's where the MKDS (Mario Kart DS) Track Editor comes into play. Now, just because it's for MKDS doesn't mean we can borrow other useful parts of the program for our needs. Start MKDS Editor, then click Tools, go to NSBMD, then click "Convert to OBJ".
    Browse to your NSBMD file you exported with SDSME, then click OK. Another box will pop up, a save file dialog, so choose the location where you want the OBJ to be saved. When typing in the name of the file, remember to add ".obj" to the end of it, it will save you much time later on. Click OK, then the program will export the NSBMD to OBJ. Now, close MKDS Editor, as we will not need it anymore. Now open Google Sketchup (Or whatever program you use to edit models), and import the OBJ file. Congratulations! You've successfully exported your map file!

    Editing a Map This part is geared towards Google Sketchup 8. Therefore, your mileage may vary.
    To import your map into Sketchup 8, ensure the plugin from fluidray is installed first. If not, click the link above to go to the download page, download and install the plugin. Then, restart Sketchup 8. From here, you'll want to start a new project, then delete the person that's standing at the origin of the 3D area, by clicking him/her, then pressing the Delete button on your keyboard. Now, go File -> Import... and select your OBJ file you exported with the MKDS editor. If Obj Files is not in your filetypes list, ensure the fluidray plugin is installed properly.

    From here, a window will pop up. Leave everything as it is, except for Flip YZ. If you believe your settings are different, compare them with the settings below:

    Units: Meters
    Flip YZ?: Yes (Doing so will set the map in the correct orientation. You can say No, and fix this later, but to prevent pains down the road, just set this to Yes.)
    Triangulate Polygons?: Yes (And please keep this to Yes. It will prevent pains later on!)
    Ignore Material Library?: Set this to No.

    Now, after you've clicked OK, the map file, with all it's textures, will be attached to your mouse for you to position. For simplicity's sake, place it on the Origin. You'll know it's on the origin, because it shows "Origin" in a popup window beside your mouse, like in the image below:
    Warning: Spoilers inside!

    From here, you're free to edit your maps. To break it down, select the map, then go Edit -> Component (It's the bottom option), and in the pop-out menu, click Explode. It will break it down into components, which in themselves, can be exploded in the same way. From there, you can select polygons, move them, expand them, add them, remove them, and so on and so forth. Once you're all done, go Export, click on 3D Model in the popout menu, then save it as an OBJ file. You are now done editing the model. We now begin the long, tedious task of importing the model.

    Note: When importing a model, the MKDS Editor will add a white, textureless box to the bottom of the model It is safe to remove, well, unless you wanna keep that there.

    Importing a Map
    (To be added later, as I need to perfect this.)

    Movement Permissions and objects
    Movement permissions are the most essential part of any map. They determine where grass is, where you can surf, where sandy slopes are, and more. To edit movement permissions, head back to the Map Editor tab on your chosen map of question. All the different parts represent movement permissions- whether they can be walked through, or if you can surf on it. The following spoiler contains a partial list of all the movement permissions for Diamond and Pearl (Feel free to document the rest, and for those of other games!)
    Warning: Spoilers inside!
    Warning: Spoilers inside!

    To edit a movement permission, click on a tile, then change it's value to one in the list above. Press Enter on the keyboard when you're done, and it will set the value of that tile. Of course, you can also set the ability for a tile to be passable or non-passable. To do this, select a tile, then in the top-right part of the window, choose between "Free Passage" or "No Passage". When done editing, click "Save Current" in the lower-left section of the window beside the movement permissions editor to write the changes to the map file. That's all there really is to editing movement permissions, but what about objects, like houses or fountains?

    To add a new object (Or edit an existing one), click the "Edit Buildings" button under the "Buildings" header. From here, a models list and a preview window (With your movement permissions) will show up. Select a building. To change what kind of building/model it is, change the Model Index number in the numeric number changer. If you don't know what it looks like, click the View button to preview it. The Command Prompt window that appears will provide instructions on how to manipulate the program. They are as follows:

    -Left Button held will rotate the model.
    -Right Button hold will zoom the model.
    -T toggles textures on/off
    -C toggles vertex colors (Not sure what this does, but okay)
    -W toggles wireframes (You can see a wireframe by disabling textures)
    -B toggles backface culling (What this is, is when you view a model from the back, you won't see anything. Enable this and you can see a model from the back with a mirrored image of the texture on the front side. It's easier to see this in action though, so just try it when you use the program.)
    -F toggles texture filtering (It will make the textures smoother, like it's rendered in a DS game if enabled.)
    -P toggles polygons (Some parts of models will disappear/appear when toggled)

    You can use that window to preview objects. If the model does not appear, that's because in the header, the textures 2 header byte does not display that object. Edit that header bit to change the model textures. (This will be explained later)

    You can change the width/height/length heights as well, with the text fields at the bottom of the Buildings window, and you can change the X/Y/Z co-ordinates of an object. Note, though...

    X - Move an object left or right
    Y - Move an object higher or lower from the surface of the map
    Z - Move an object up or down

    When done, click "Save Current", then just click the X in the top corner.

    Headers and the Map Matrix
    Headers are what allows you to choose what song plays on a map, weather, script sets, and more. To choose the proper map's header, head to the Matrix Editor, then click the Map Headers sub-tab.
    This also, like the map data tab, looks like the region of the map in your respective version. Find that map, then double-click on it. It will bring you to the headers tab with the respective header for that map highlighted.

    For the weather tab, you can replace that number with any of the following values (DPPt Only!) :
    Warning: Spoilers inside!
    Warning: Spoilers inside!

    Music can be any of the following DP values (I'm too lazy to translate) :
    Warning: Spoilers inside!
    Warning: Spoilers inside!

    Camera can use these values (DPPt Only) :
    Warning: Spoilers inside!
    Warning: Spoilers inside!

    Note: If you use the "Music Modifier", Weather Modifier, or Motion 3D Action Replay codes, the value you input into the calculator will be the same value you can use in these tabs.

    And with that, this concludes the DS Mapping Tutorial.

    Credits and Final Info
    I'd like to give my thanks to a few people and groups:
    • Spiky-Eared Pichu/Markitus95 for the amazing editor and for telling me some of these bits of info that got this tutorial going
    • Gericom for the MKDS Track Editor
    • The creator of the NSBMD viewer
    • Nintendo for the super-useful plugins
    • Google for Sketchup
    • Alias for Maya
    • Autodesk for 3DS Max
    • Kodewerx for the Header values

    This tutorial was written by Team Fail. If you wish to publish this tutorial on another site, please PM or VM me and we can discuss such options. In saying so, please do not post without express permission from me. If you find any unauthorized copies of this thread on the internet, please PM me at http://gbatemp.net/index.php?app=members&module=messaging&section=send&do=form&fromMemberID=261213.
    2 people like this.
  2. basher11

    basher11 GBAtemp's Official Vocaloid Lover

    Jun 29, 2009
    United States
    the creator of MKDS Track editor is Gericom

    and I would love to see where this goes from here.
  3. Rydian

    Rydian Resident Furvert™

    Feb 4, 2010
    United States
    Cave Entrance, Watching Cyan Write Letters
    Damn, and here I thought it was purely tile-based.

    The engine seems even more impressive now.
  4. loco365

    loco365 GBAtemp Guru

    Sep 1, 2010
    Awesome! Thanks! *Adds to credits*
    I totally wish they were tile-based. I find it bizarre that movement permissions are tile-based, though.
  5. Rydian

    Rydian Resident Furvert™

    Feb 4, 2010
    United States
    Cave Entrance, Watching Cyan Write Letters
    Well if the movement and maps are different it opens up more artistic freedom. Kinda' like 3D games having a different collision box than the actual levels and models indicate. If all videogame characters were boxes/cylinders and all the levels had to represent the actual collision boundaries things would look a lot more bland.