#metconst @ irc.esper.net
-> Documents -> Room expansion (part 2)
If you made it through part 1, then part 2 should be very easy because everything will be done within SMILE this time.
What you'll be doing/learning by following this guide (hopefully)
- Recognizing the width/height of a room
- Modifying the width/height to change its size
- Moving doors to a new location after the room's size has been altered
- Editing the game's map to reflect a room's new size
Section A: Vertical (height) expansion
Like part 1, this knowledge can be applied to just about any room in the game. I'll do my best to explain and illustrate this in a way that teaches you how. If you'll remember, at the end of part 1, we changed the level data pointer of room ID 79A44 and left it with 30976 tile data. For the sake of continuity, I'm going to use that one for this tutorial.
1. In SMILE, open room 79A44 and make sure that you've expanded it! By default, room 79A44 starts out with 242 / 276 tile data. This will NOT be enough space for what we're doing. If you followed part 1 of this tutorial, you should be good to go because you changed this room's level data pointer and bumped it up to around 30000 space already.
TILE DATA USAGE: [242 / 30976]
ROOM ID: 79A44
The above picture is how this room should look in SMILE for you right now. If you don't see the 2 blue squares, click "View" > "Options" > "Show Scroll Areas" and they will appear. Understanding these squares and how their number determines a room's size is very important if you're serious about editing Super Metroid in detail. Currently, room 79A44 is 2x1. This means that it is 2 squares long (width), and 1 square tall (height). The smallest a room can be is 1x1, and the largest it can be is anything that totals 50 squares in size.
2. Click "Edit" > "Room Properties" and look at the Width/Height fields. What do you know? 2 width, 1 height. Changing these numbers will change the size of the room, so let's do that.
3. Replace "Height: 1" with "Height: 3" (DON'T change the width yet! I'll explain why later). This will of course make your room go from being 2x1 to 2x3. Click "OK" - For this change to happen, SMILE must save and re-open this room! - click "OK" again.
"What's with all the yellow door chunks!?" This is normal. Right-click anywhere in the room where there's normal air and "erase" all of the yellow door pieces if you want to get rid of them right now. There you have it. Your room is now 3x larger than it was. That's the gist of increasing room size, but there's more to learn before this knowledge can be used to its full extent
This will be different depending on the room, but in the case 79A44, you probably noticed that a red square appeared, and that where 3 other squares should have been, there are none.
Click here to see what the above square diagram would look like within SMILE
Still with me so far? Okay, good.
4. Click "Tools" > "Scroll Editor (refreshes room)" to get a smaller view of the room. Click on the red square and change it to either blue or green.
You'll notice that the color of the square that your mouse cursor is inside will alternate between red, green, and blue every time you click. Clicking where there aren't any squares visible will "create" a square in that area.
If you don't know the difference between the red/green/blue squares, that's fine. Just use blue or green ones for right now. Also, the squares that aren't visible will behave as green squares by default, which are almost exactly the same as blue squares. If you leave those alone and don't "create" a square where they are, everything should still work fine. Basically, stick with only blue/green/invisible squares unless you know how to handle red ones.
That's almost all you need to know about extending the height of a room. But what about the width? Why did I tell you not to change it earlier? Well, there's one very good reason: IT'LL DESTROY EVERYTHING ... kinda.
Section B: Horizontal (width) expansion
Unlike adding height, which simply stuck a bunch of yellow door pieces at the bottom of your room, changing width will completely wreck the room's design, including doors. This means you will have to remake it all if you decide to increase the width of a finished room. There is a way to restore everything you've made, but it's a bit tedious (see section E). I haven't edited 79A44 yet, so obliterating the design's not a big deal since I'm remaking the room anyway.
5. Click "Tools" > "Scroll Editor (refreshes room)" again to return the room to its normal view. Before we give it more width, let's at least preserve our doors so we don't have to redo those. Right-click and hold it. While keeping the right-click button held down, move your cursor up/left. This makes the white box that you "draw" rooms with grow in size. Do this around a whole door so that it appears in SMILE's "ClipBoard" when you release the right-click button, like so:
You can also select huge parts of the room itself like this, not just doors
6. Now that you've got a door copied, click once next to the other door so they're beside each other. After you do that, put both doors on SMILE's "ClipBoard" so you end up with this:
If your room has more than 2 doors, put all of them together in a small cluster like this
Nice. Now that we've got our doors copied, it's time to break this room! Don't right-click anywhere until after you add width, or you'll remove the doors from SMILE's clipboard and have to re-select them.
7. Click "Edit" > "Room Properties" again. Yep, we're still at width 2, height 3. Replace "Width: 2" with "Width: 4" this time and click "OK" - For this change to happen, SMILE must save and re-open this room! - click "OK" again. See? Told you everything would get screwed up. Now, click anywhere in the room and the 2 doors you copied will be placed. Here's an updated version of our little doodle from earlier. The brighter squares are what we just now added to the room; ignore the dim ones.
Click here to see how the above diagram looks in SMILE's scroll editor
Assuming you didn't change any of the square colors in the scroll editor or erase the yellow door pieces, this is about how the room would look now.
8. Click "Tools" > "Scroll Editor (refreshes room)" yet again and turn the red squares into blue or green. To be on the safe side, leave the non-visible (gray) squares alone this time. Why is it safer doing this? See section E.
9. Remember how you selected the doors by right-clicking, holding the button and moving the mouse up/left? Do it again, but with a patch of regular air.
10. Erase EVERYTHING except the 2 doors. The whole room should now be completely black.
Section C: Moving doors
11. Place the doors on opposite ends of the room in the top row of scroll blocks. Make sure the doors are centered properly! The images below should illustrate the centering easily enough.
12. Create a bridge of "solid block" tiles connecting the two doors. Your top row of scroll blocks should be looking something like this:
As seen in SMILE's scroll editor
See what I mean by doors being centered properly inside of the blue squares? That little white square that always follows your mouse cursor around in SMILE is the size of 1 tile in the game. The red/green/blue scroll blocks are 16 tiles tall and 16 tiles wide. When in doubt, start at one corner and count 6 tiles towards the middle of the scroll block. Tiles 7, 8, 9 and 10 will be where your door goes (see image below; the "7 8 8 7" would be the same as counting "7, 8, 9, 10").
I don't think it's possible to convey it any clearer than this
Doors don't absolutely have to be centered, but it's how the game does it normally. Stick with doing it this way until you're more comfortable with editing doors and know more about how rooms connect to each other. Movin' on.
13. Let's test this room and see how everything works so far. If you use SMILE version 2.0 or higher, press the "E" key and select a standard emulator. The game will load room 79A44, and Samus will start wherever your mouse cursor was when you pressed "E." Uh oh. Are you seeing the same problem I am!?
Holy not good, Batman!
If you don't know what's going on in the picture above, pay very close attention, because it's important to be able to recognize exactly what causes doors to glitch up like this. In fact, a picture by itself doesn't do much justice. Here, watch a video of this exact error in action. Can you tell what's happening now? Room 79A44 is indeed much larger than it used to be, but the door on the right side of the room insists on placing us exactly where the door used to be before we moved it. The door on the left side of the room doesn't do this because we didn't change its actual location. The door on the right, however, was moved 2 scroll areas to the right. Here's a quick visual:
The yellow rectangle is where the door originally was, and where Samus still appears (see video)
So, how do we make Samus enter the room from where the door is now, and not from where it used to be? A wonderful process called "door cloning." Don't confuse that with actually adding more doors to a room (that's another tutorial for another day). Essentially, door cloning just means you're moving an existing door to another part of the room.
14. Look at the door itself. Notice the 4 tiles have the 01 over them? Put your mouse cursor over 1 of them and press the "C" key. A box will pop up, in which SMILE tells you to give the door a name. The name you give it doesn't matter, so we'll call it "door1" and click the "OK" button. Save the room, because we're going to another one in this next step.
15. With your mouse cursor still sitting on a 01 door tile, press the "E" key. Doing this 'enters' the door and will take you into the room that it leads to. In this case, it is room ID 792FD. Press the "C" key while your mouse is on any of the 06 tiles (the door leading back to room ID 79A44). Name it "door2" and click "OK" like we just did. Now press "E" while on a 06 tile to get back into room 79A44.
16. Set your mouse on a 01 again, but instead of E or C, press the "D" key to bring up SMILE's door editor window. Oh, lookie. There's the door1 and door2 that we just named.
17. Click on "door2" so it's highlighted. Click the "^---Transfer Properties---^" button. Click the "Remember --->" button. Close the door editor window. Save the room. Go back to room 792FD
18. Set your mouse on a 06 and press the "D" key. Click on "door1" so it's highlighted. Click the "^---Transfer Properties---^" button. Click the "Remember --->" button. Close the door editor window. Save the room. Go back to room 79A44.
That's it, congratulations. Door 01 should no longer spit Samus out halfway into the room. Memorize the door cloning process well, because you'll be doing it many, many times in the future if you're serious about revamping Super Metroid. Between repointing level data, adding width/height and moving doors, there's enormous potential for creative hacking if you're determined enough and are willing to devote a lot of time to it. But there's another loose end I wanna take care of...
Section D: Updating the game map
You might have noticed that the map is still the same. Our room 79A44 is 4x3, but the map continues to display the original 2x1. This means that some parts will overlap or show up completely blank.
19. Click "Tools" > "Map Editor" and look at the white box. That's our room at its new size. It covers several other rooms on the map now and looks like a real mess. When you breach the territory of changing room sizes and moving doors around, your map is going to fall into disarray pretty quickly. The only way to prevent this altogether is if you plan your maps out ahead of time and build your rooms to that design. Here's a look at the map editor (zoomed in x4):
The red area is how big 79A44 used to be
20. To be honest, there's no way for me to tell you exactly how to edit the map - why? Because the map editor itself is just that easy to use, and because the map design you choose would be different from mine anyway. The only thing I should point out is the "Move Room's X/Y With On Next Click (or hold 'M')" button. The white square surrounding the room is the room (see map image above), and it is what will be moved around if you use the button or hold the "M" key. You'll need to do this if you plan on moving a room someplace else, and probably some door cloning afterward. All the blue map tiles are for is showing the player where Samus is able to explore.
Just play around with it. Experimenting with the map editor is safe, and it shouldn't break anything - but make a back-up copy of your ROM before starting anyway. There you have it, part 2 of 2 is finique. If I did a good enough job at all of this, you should now be able to repoint level data, expand height/width and move doors around in any room. In closing...
Section E: Explanations and cautions
At the very end of step 4, I mentioned a way to restore a room's design after expanding the width and wrecking it. Here's a very cut and dry step-by-step.
Make a back-up copy of your ROM before you do this!
1. Expand the width to whatever you want it to be and save the room
2. Click "File" > "Open new ROM" and load the back-up copy you just made
3. Load a different room from the one you're in now, then go right back to the room you expanded
4. Right-click and hold it, then select a huge chunk of the room so it's on SMILE's clipboard
5. Click "File" > "Open new ROM" again and load the expanded ROM
6. Go to another room, then back to the expanded room again
7. Place the huge tile chunk we copied to SMILE's clipboard wherever you need it to be
8. Save the room
9. Repeat steps 2-8 until you're satisfied with how much of the room you've restored. This process is kind of monotonous, but it certainly beats rebuilding a whole room all over again.
Be very careful with how much you increase a room's width or height!
This has to do with why I told you to leave non-visible scroll areas alone in step 8. There is some game-destroying risk involved in making your rooms too large. You see, the red/green/blue scroll areas have their own place in the ROM. The non-visible areas write new scroll data to the ROM when you create the red/green/blue square around it. Add too many, and those new hex bytes may replace some other important values. What happens if you do this? Nearby rooms or potentially other areas of the game will shit all over themselves and die miserably. Nobody wants that.
I haven't researched what exactly happens myself. This is why you will need to test your expanded room and all of the other rooms nearby to make sure everything works as it should. Test often and extensively for peace of mind. Last but not least, if you're good at following instructions without all of the pretty little screenshots and diagrams, check out Black Telomeres' SMILE FAQ page. I learned much of what I know from this when I was just getting started.
I haven't decided yet, but I've entertained the thought of a part 3 that would teach repointing to add more enemies/PLMs to a room, adding doors, and possibly repointing scroll area data to avoid the risks associated with expanding a room too much. I've never added PLMs/enemies or repointed scroll data, so I'll have to get around to doing/learning those myself first before I can write them over. Until then, I hope you found all of this useful.
See you space cowboy.