User Tools

Site Tools


sm:technical_information:room_data_format

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
sm:technical_information:room_data_format [2024/11/14 21:59] – created felixwrightsm:technical_information:room_data_format [2024/11/14 22:03] (current) felixwright
Line 1: Line 1:
-Room associated data and it's format +====== Room associated data and it's format ====== 
-Room Header+ 
 +===== Room Header =====
  
 The room header is a long string of hex values which contains all of the data required for rooms to be displayed and function properly within the game and, likewise, SMILE. This page will aim to show you how the data is structured and how to make additional pointers and room headers (though in a less direct manner). You'll need some basic understanding of how to use a hex editor and remember that any and all addresses in this document will be in an unheadered ROM. Also of note, I will also be using SMILE 2.5 while writing this. The room header is a long string of hex values which contains all of the data required for rooms to be displayed and function properly within the game and, likewise, SMILE. This page will aim to show you how the data is structured and how to make additional pointers and room headers (though in a less direct manner). You'll need some basic understanding of how to use a hex editor and remember that any and all addresses in this document will be in an unheadered ROM. Also of note, I will also be using SMILE 2.5 while writing this.
Line 6: Line 7:
 First off, let's look at a room in SMILE which has a single state: room ID 793FE (the big open ocean room outside west of the Wrecked Ship). Opening your hex editor and going to that location (793FE) you should see the following: First off, let's look at a room in SMILE which has a single state: room ID 793FE (the big open ocean room outside west of the Wrecked Ship). Opening your hex editor and going to that location (793FE) you should see the following:
  
-05 00 26 00 08 06 90 A0 00 25 94 E6 E5 45 EB C2 00 0C 05 12 81 84 86 61 81 81 01 31 94 00 00 1B C1 DC 81 AE B7 CE 91+  05 00 26 00 08 06 90 A0 00 25 94 E6 E5 45 EB C2 00 0C 05 12 81 84 86 61 81 81 01 31 94 00 00 1B C1 DC 81 AE B7 CE 91
  
 Now, this is a large sized room and all that may look like gibberish, but don't get discouraged. Let's break it down byte-by-byte before any assumptions are made. Now, this is a large sized room and all that may look like gibberish, but don't get discouraged. Let's break it down byte-by-byte before any assumptions are made.
  
-05 - Room index +  05 - Room index 
-00 - Room area +  00 - Room area 
-26 - X-position on mini-map +  26 - X-position on mini-map 
-00 - y-position on mini-map +  00 - y-position on mini-map 
-08 - width of room +  08 - width of room 
-06 - Height of room +  06 - Height of room 
-90 - Up scroller +  90 - Up scroller 
-A0 - Down scroller +  A0 - Down scroller 
-00 - Special graphics bitflag +  00 - Special graphics bitflag 
-25 94 - Door out pointer +  25 94 - Door out pointer 
-E6 E5 - Roomstate used +  E6 E5 - Roomstate used 
-45 EB C2 - Level data pointer +  45 EB C2 - Level data pointer 
-00 - Tileset used +  00 - Tileset used 
-0C - Music: Collection +  0C - Music: Collection 
-05 - Music: Play +  05 - Music: Play 
-12 81 - FX1 pointer +  12 81 - FX1 pointer 
-84 86 - Enemy Pop/Allowed pointer +  84 86 - Enemy Pop/Allowed pointer 
-61 81 - Enemy Set pointer +  61 81 - Enemy Set pointer 
-81 01 - Layer 2 scrolling +  81 01 - Layer 2 scrolling 
-31 94 - Scroll pointer +  31 94 - Scroll pointer 
-00 00 - Unknown/RoomVar +  00 00 - Unknown/RoomVar 
-1B C1 - FX2 pointer +  1B C1 - FX2 pointer 
-DC 81 - PLM pointer +  DC 81 - PLM pointer 
-AE B7 - BG_Data +  AE B7 - BG_Data 
-CE 91 - Later1_2 (FX0/Setup code)+  CE 91 - Later1_2 (FX0/Setup code)
  
 This first 9 bytes (05 00 26 00 08 06 90 A0 00) are known as the room's properties and can be edited in SMILE 2.5 by going to “Edit > Room Properties.” E6 E5 tells the game which data to use for what roomstate. In our current example, this room only has one state and that's what we'll work with for now (I'll get to multi-state rooms later). The “tileset used, Music: Collection,” and “Music: Play” can all be edited directly in the main SMILE window off to the right under the “Other” tab (also located under where you'd select rooms). “Layers 2 Scrolling” is editable in Tools > Background Editor > BG Layer 2/SCROLLING. Everything else is editable via the pointers window (Edit > Pointers). This first 9 bytes (05 00 26 00 08 06 90 A0 00) are known as the room's properties and can be edited in SMILE 2.5 by going to “Edit > Room Properties.” E6 E5 tells the game which data to use for what roomstate. In our current example, this room only has one state and that's what we'll work with for now (I'll get to multi-state rooms later). The “tileset used, Music: Collection,” and “Music: Play” can all be edited directly in the main SMILE window off to the right under the “Other” tab (also located under where you'd select rooms). “Layers 2 Scrolling” is editable in Tools > Background Editor > BG Layer 2/SCROLLING. Everything else is editable via the pointers window (Edit > Pointers).
-Room Properties+ 
 +===== Room Properties =====
  
 Room properties define the physical characteristics of a room. Their area sub-map, width and height, and location on the mini-map are the major values that typically get edited. Additional, less impactful values are the up and down scroller, room index, and special graphics bitflag. *All* of these specific values can be edited in the Room Properties menu in SMILE rather than having to change them in hex. Room properties define the physical characteristics of a room. Their area sub-map, width and height, and location on the mini-map are the major values that typically get edited. Additional, less impactful values are the up and down scroller, room index, and special graphics bitflag. *All* of these specific values can be edited in the Room Properties menu in SMILE rather than having to change them in hex.
  
-05 - Room index +  05 - Room index 
-00 - Room area +  00 - Room area 
-26 - X-position on mini-map +  26 - X-position on mini-map 
-00 - y-position on mini-map +  00 - y-position on mini-map 
-08 - width of room +  08 - width of room 
-06 - Height of room +  06 - Height of room 
-90 - Up scroller +  90 - Up scroller 
-A0 - Down scroller +  A0 - Down scroller 
-00 - Special graphics bitflag+  00 - Special graphics bitflag
  
-Room Index+==== Room Index ====
  
 This is simply the number a room is given inside the game and and doesn't have any major effect on the room itself. Think “Crateria room #1, Crateria room #2, Crateria room #3, etc.” However, certain numbers in certain areas can have an affect on the footstep effects for the room (like the splashes Samus leaves when walking above water in specific rooms). This is simply the number a room is given inside the game and and doesn't have any major effect on the room itself. Think “Crateria room #1, Crateria room #2, Crateria room #3, etc.” However, certain numbers in certain areas can have an affect on the footstep effects for the room (like the splashes Samus leaves when walking above water in specific rooms).
-Room Area+ 
 +==== Room Area ====
  
 Tells the game which sub-map/area the room is to be located in. This determines various FX that can be used in the room depending on the area such as the heat bit (which causes heat damage without Varia Suit) only being able to be set in Norfair and Tourian (where it is unused by default). A list of values pertaining to each area are found below. Tells the game which sub-map/area the room is to be located in. This determines various FX that can be used in the room depending on the area such as the heat bit (which causes heat damage without Varia Suit) only being able to be set in Norfair and Tourian (where it is unused by default). A list of values pertaining to each area are found below.
  
-00 - CRATERIA +  00 - CRATERIA 
-01 - BRINSTAR +  01 - BRINSTAR 
-02 - NORFAIR +  02 - NORFAIR 
-03 - WRECKED SHIP +  03 - WRECKED SHIP 
-04 - MARIDIA +  04 - MARIDIA 
-05 - TOURIAN +  05 - TOURIAN 
-06 - CERES +  06 - CERES 
-07 - DEBUG+  07 - DEBUG
  
-X/Y-Position on Minimap+==== X/Y-Position on Minimap ====
  
 The x-position and y-position of the room's boundaries as displayed on the mini-map. Due to the way the mini-map works, the top row you see in SMILE's map editor is not recorded as the topmost row. The row below is however. Our example room is located at the coordinates “26,0” on the mini-map. The x-position and y-position of the room's boundaries as displayed on the mini-map. Due to the way the mini-map works, the top row you see in SMILE's map editor is not recorded as the topmost row. The row below is however. Our example room is located at the coordinates “26,0” on the mini-map.
Line 77: Line 80:
  
 There are two limitations here however! A room cannot have a total area of more then 50 screens (area = width x height) and neither dimension can be expanded beyond “0F” (16) screens in size (but remember “0F” is actually “15” in hex, yet we have to count “00” as “1” in this case). This means a room of 16×3 (0F,03) is acceptable while something like 16×4 is not. For reference, the largest possible room in Super Metroid (and the largest the engine can handle) can be found as room 79D19. There are two limitations here however! A room cannot have a total area of more then 50 screens (area = width x height) and neither dimension can be expanded beyond “0F” (16) screens in size (but remember “0F” is actually “15” in hex, yet we have to count “00” as “1” in this case). This means a room of 16×3 (0F,03) is acceptable while something like 16×4 is not. For reference, the largest possible room in Super Metroid (and the largest the engine can handle) can be found as room 79D19.
-Up/Down Scrollers+ 
 +==== Up/Down Scrollers ====
  
 To be completely honest, I'm unsure exactly what these do. I recall hearing that they have a very, very minute affect on the camera while moving through a room. You will be able to get by just fine without editing them or even setting them to 00,00. To be completely honest, I'm unsure exactly what these do. I recall hearing that they have a very, very minute affect on the camera while moving through a room. You will be able to get by just fine without editing them or even setting them to 00,00.
-Special Graphics Bitflag+ 
 +==== Special Graphics Bitflag ====
  
 The “special graphics bitflag” handles specific cases where parts of the CRE (Common Room Elements) are to be overwritten or refreshed/reloaded due to additional graphics being loaded. By clicking on the box next to it's input field in SMILE, you'll get a list of values that are common. Listed below are any special cases for each value along with a description. The “special graphics bitflag” handles specific cases where parts of the CRE (Common Room Elements) are to be overwritten or refreshed/reloaded due to additional graphics being loaded. By clicking on the box next to it's input field in SMILE, you'll get a list of values that are common. Listed below are any special cases for each value along with a description.
  
-00 - most common value used in the vast majority of rooms. +  00 - most common value used in the vast majority of rooms. 
-01 - used in Crocomire's and Draygon's rooms to unload CRE. Presumably to make room for their graphics in the CRE. +  01 - used in Crocomire's and Draygon's rooms to unload CRE. Presumably to make room for their graphics in the CRE. 
-02 - forces a refresh of the CRE. Used outside of Crocomire room. +  02 - forces a refresh of the CRE. Used outside of Crocomire room. 
-05 - used in Ceres elevator, Ceres Ridley's, and Kraid's rooms.+  05 - used in Ceres elevator, Ceres Ridley's, and Kraid's rooms.
  
-Tileset and Music+===== Tileset and Music =====
  
 The tileset defines the set of graphics the current room will be built with and is selectable on the right side of the main SMILE window via a drop-down box with selections between 1 and 29. For a list of tilesets, refer to this page. Likewise, music determines what song to play in the room and is also selectable on the right side of the main SMILE window, though under the “Other” tab. You can find a full list of music selections over here. Both tilesets and music selections are chosen per room being unique to it's room header, not shared between them (unlike pointers which can be). The tileset defines the set of graphics the current room will be built with and is selectable on the right side of the main SMILE window via a drop-down box with selections between 1 and 29. For a list of tilesets, refer to this page. Likewise, music determines what song to play in the room and is also selectable on the right side of the main SMILE window, though under the “Other” tab. You can find a full list of music selections over here. Both tilesets and music selections are chosen per room being unique to it's room header, not shared between them (unlike pointers which can be).
-Layer 2 Scrolling+ 
 +===== Layer 2 Scrolling =====
  
 These two bytes of information give the game important information about the room's background. This can be viewed by going into the Layer 2 scrolling window in SMILE 2.5 by going to “Tools > Background Editor > BG/Layer2 SCROLLING.” These affect what kind of background to use and how it “follows” the camera while the player moves around the room. It a bit hard to explain, and the room we've picked apart isn't a good example of this at all (since the scrolling sky is something else on its own), so you're best off to find another room a play with values there. These two bytes of information give the game important information about the room's background. This can be viewed by going into the Layer 2 scrolling window in SMILE 2.5 by going to “Tools > Background Editor > BG/Layer2 SCROLLING.” These affect what kind of background to use and how it “follows” the camera while the player moves around the room. It a bit hard to explain, and the room we've picked apart isn't a good example of this at all (since the scrolling sky is something else on its own), so you're best off to find another room a play with values there.
  
-81 01+  81 01
  
 The first byte is for the y-axis scrolling and the second is for the x-axis scrolling. Each byte ending with a 1 tells the game to use the BG_Data pointer in the pointers window. If there room were set to use a “Layer 2 background (Custom),” the bytes would end in 0, thus making our current example look like 80 00. Again, I suggest playing around in another room other than 791F8, 793FE, and 7968F (as all of these use the scrolling sky) to see the true effect. The first byte is for the y-axis scrolling and the second is for the x-axis scrolling. Each byte ending with a 1 tells the game to use the BG_Data pointer in the pointers window. If there room were set to use a “Layer 2 background (Custom),” the bytes would end in 0, thus making our current example look like 80 00. Again, I suggest playing around in another room other than 791F8, 793FE, and 7968F (as all of these use the scrolling sky) to see the true effect.
-Pointers+ 
 +===== Pointers =====
  
 Pointers point to specific locations in the game where data is stored. A good handful of these are vital to a room's function and as such, they will also be broken down and explained in their appropriate sections below. Pointers point to specific locations in the game where data is stored. A good handful of these are vital to a room's function and as such, they will also be broken down and explained in their appropriate sections below.
-Level Data+ 
 +==== Level Data ====
  
 This is the almighty important pointer. As the name suggests, this is the data for the level, or room. This contains the layout of tiles on both layer 1 and 2 and the block properties of every tile within the room. While you could write all the data of one of these pointers out in hex, it's highly, highly unrecommended. Not only does this tend to be an extremely large chunk of data, it is also compressed to reduce its size. This is the almighty important pointer. As the name suggests, this is the data for the level, or room. This contains the layout of tiles on both layer 1 and 2 and the block properties of every tile within the room. While you could write all the data of one of these pointers out in hex, it's highly, highly unrecommended. Not only does this tend to be an extremely large chunk of data, it is also compressed to reduce its size.
Line 110: Line 118:
 If we wanted to reserve (or maybe even use!) all of bank $E0 for level data, we'd put the following at the bottom of level_entries.txt: If we wanted to reserve (or maybe even use!) all of bank $E0 for level data, we'd put the following at the bottom of level_entries.txt:
  
-300000 +  300000 
-307FFF+  307FFF
  
 From there, we could put E00000 into the top box of the pointers window and start using the new space to build rooms! Once the room is finished however, you'll need to take a peak into a hex editor to find out where free space ends, note that address, and add it between the previous two entries we've made in level_entries.txt to tell SMILE when to stop reading level data. From there, we could put E00000 into the top box of the pointers window and start using the new space to build rooms! Once the room is finished however, you'll need to take a peak into a hex editor to find out where free space ends, note that address, and add it between the previous two entries we've made in level_entries.txt to tell SMILE when to stop reading level data.
  
 This is just a quick overview of how level data works and how it can be expanded on. For much more in-depth and hands on explanation, go read the room expansion guide. This is just a quick overview of how level data works and how it can be expanded on. For much more in-depth and hands on explanation, go read the room expansion guide.
-FX1+ 
 +==== FX1 ====
  
 Work in progress, more to be written. ~person701  Work in progress, more to be written. ~person701 
sm/technical_information/room_data_format.1731621550.txt.gz · Last modified: 2024/11/14 21:59 by felixwright