Author
|
Topic: Startropics level format and compression (Read 2 times)
|
Jigglysaint
Guest
|
|
« on: October 08, 2007, 08:49:38 pm » |
|
Ha! I bet you thought I was asking for help!
Anyway, since I haven't seen the game disassembled much, I though I'd find out where the levels are stored, and how they are compressed. After about a day of searching, I found it.
So basicaly, how things work, is that at offset 2201a in the Rom, there is a list of pointers, except they are like relative pointers. The first byte acts as usual, and the second byte is the page that's addressed. The first room is 02 04, so that makes the offset 22412, with the header added. This data leads to a second list of pointes that are also relative, with additional properties.
Rooms are assembled several pieces at a time. For example, room $01 in the C-Island cave, shares some common data with room $02. How it works is that each room has several pointers. Room 01 has 3, and room 02 has 2. Both rooms share a pointer to the top half of the room. Like with the first set of pointers, these ones have a similar format. The first byte + $10 is where on a given page the data starts. The second byte has the page number, but the upper bits control, as it appears to me, how much of the data to grab. In room 01, three pointers are needed, but in 02, only 2. That's because the second pointer in room 02 also inludes data from the third pointer in room 1. What's happening is that the pointers grab snippits of level data, and depending on if the room is finisted or not, there's additional pointers. It's still not totally figured out yet, but it's getting there.
$22F0D in the rom is where the data starts for the first pointer in room $01(and other rooms that use this data piece). The format is RLE, in different formats. The first byte, 86, tells the game to place tile $00 6 times. If $10 is set, then it will use that tile ID + 1. The next compression format is simple, and always seems to start with a $20. For example, 23 will tell the game to make the next three bytes tile ID values. The third format uses $10, with the second nybble being the length. This is used when the tiles needed exceed 7, because the one byte code only goes that far. $1A 0A would place tile $0A, which is a normal walkable surface, 10 times, wheras DA would end up placing normal tiles only 2 times because bit $10 is used to toggle between ID value and ID value +1.
The last format, and one that's rather odd, uses the upper bits between $40 and $60. When used, it seems to have a combination of two different tiles, usually water and steppable tiles. For example, $62 tells the game to have a water tile with a shadow appear, then a steppable tile. After that it's told to repeat the pattern 2 times, which makes 4 tiles appear in all. $6A on the other hand, seems to do the same, except it's reversed. If water came first, then this time the steppable tile would come first, then water. The 2 bits, $40 and $20, seem to have 3 combinations. I've seen shadowless water and shadowed water, shadowless water and tiles, and shadowed water and tiles.
So that's it basically. I've also found the room headers and event data, but not where each room leads when you exit it.
|
|
|
|
Spikeman
Guest
|
|
« Reply #1 on: October 09, 2007, 12:54:55 am » |
|
Nice work! You should submit a document so all this info isn't lost in a board pruning somewhere down the line. (Your Link's Awakening notes are very informative by the way. )
|
|
|
|
Griff Morivan
Guest
|
|
« Reply #2 on: October 09, 2007, 07:52:10 am » |
|
I need to learn how to do this stuff. Jig, when you get all of this together, PLEASE contact me either here, AIM, or my e-mail ( JustAnotherFace.Griff@gmail.com) and I would LOVE to make the first Star Tropics hack.
|
|
|
|
ETG
Guest
|
|
« Reply #3 on: October 09, 2007, 06:55:14 pm » |
|
I looked into Startropics a little bit a while back. I found data for the overworld map for C-island. I made a list of values that changed one tile, but I could not figure out anything else.
Here's from my notes.
2070 = TILE MAKEUP
2BF0 = Spot on map somewhere near the center of the island.
00 GRASS 01 GRASS, BOTTOM EDGE 02 BEACH 03 CLIFF SIDE 04 TREE 05 MOUNTAIN 06 WATER 07 WATER, TOP EDGE 08 WHITE WATER 09 WHITE WATER, TOP EDGE 0A GRASS, TOP EDGE 0B GRASS, TOP & BOTTOM EDGE 0C RED TREE; 0D BLUE TREE, NW OFF 0E WATER, TOP & LEFT & BOTTOM EDGE 0F WATER 10 GRASS, NW BUSH 11 GRASS, EDGE LEFT 12 GRASS, EDGE RIGHT 13 CAVE 14 LANDING PAD 15 GRASS, LEFT & BOTTOM EDGE 16 GRASS, RIGHT & BOTTOM EDGE 17 GRASS, LEFT & TOP EDGE 18 GRASS, TOP & RIGHT EDGE 19 GRASS, LEFT & BOTTOM & RIGHT EDGE 1A GRASS, LEFT & BOTTOM & RIGHT EDGE 1B LAB, LEFT SIDE 1C LAB, RIGHT SIDE 1D VILLAGE, LEFT SIDE 1E VILLAGE, RIGHT SIDE 1F STAIRS 20 WHITE WATER, LEFT & TOP EDGE 21 WHITE WATER, TOP & RIGHT EDGE 22 WATER, RIGHT EDGE 23 WATER, LEFT EDGE 24 WATER, LEFT & TOP EDGE 25 WATER, TOP & RIGHT EDGE 26 WATER, RIGHT & LEFT EDGE 27 WHITE WATER, RIGHT EDGE 28 WHITE WATER, LEFT EDGE 29 WATER, BOTTOM & RIGHT EDGE 2A GRASS, LEFT & RIGHT EDGE 2B GRASS, TOP & BOTTOM & RIGHT EDGE 2C CAVE, CLIFF SIDE 2D HUT 2E LIGHTHOUSE, TOP SIDE 2F LIGHTHOUSE, BOTTOM SIDE 30 WATER, LEFT & TOP & RIGHT EDGE 31 WATER, LEFT & TOP & BOTTOM EDGE 32 PORT, RIGHT 33 PORT, BOTTOM 34 WAVE WATER, LEFT & TOP EDGE 35 WAVE WATER, TOP & RIGHT EDGE 36 WAVE WATER, RIGHT EDGE 37 WATER ROCKS 38 GRASS, TOP & BOTTOM EDGE 39 MOUNTAIN 3A GRASS, LEFT & RIGHT EDGE 3B MOUNTAIN, PASS 3C BLACK 3D WATER 3E WHITE WATER, LEFT & TOP & RIGHT EDGE 3F WATER, LEFT & BOTTOM EDGE 40 CASTLE, LEFT SIDE 41 CASTLE, RIGHT SIDE 42 CAVE ENTER 43 WATER DOTS 44 WATER, LEFT & TOP EDGE /W SE DOTS 45 WATER, TOP & RIGHT EDGE /W SW DOTS 46 WATER, TOP EDGE /W BOTTOM DOTS 47 WATER, LEFT EDGE /W RIGHT DOTS 48 WATER, RIGHT EDGE /W LEFT DOTS 49 WATER, LEFT & BOTTOM EDGE /W NE DOTS 4A WATER, BOTTOM EDGE /W TOP DOTS 4B WATER, BOTTOM & RIGHT EDGE /W NE DOTS 4C WATER DOTS, RIGHT MT. 4D WATER DOTS, LEFT MT. 4E MT., LEFT & UPPER SIDE 4F MT., RIGHT & UPPER SIDE 50 MT., LEFT & LOWER SIDE 51 MT., RIGHT & LOWER SIDE 52 GRASS, LEFT & TOP & BOTTOM EDGE 53 WATER, BOTTOM EDGE 54 PORT, LEFT
|
|
|
|
Jigglysaint
Guest
|
|
« Reply #4 on: October 11, 2007, 09:46:58 pm » |
|
So now I need to figure out how the events data work, and also how the rooms are connected. I'm actually thinking of doing minihack, like a boss rush mode where you have to fight all the bosses room after room. There is one thing I've noticed, and that is that the game has a ton of free space to create levels and whatnot. In fact the game has more free space than is really physically capable of using. Also, in the game, data is not in order. The first room's data is near the end, and stuff at the beginning might be used for room $40 or somthing. Quite disorganized. It also does not use standard pointers in the least bit.
|
|
|
|
Griff Morivan
Guest
|
|
« Reply #5 on: October 12, 2007, 07:21:17 am » |
|
Oh god. Is Star Tropics the pokemon blue of NES action RPGs?
|
|
|
|
KingMike
Guest
|
|
« Reply #6 on: October 12, 2007, 11:05:51 am » |
|
Oh god. Is Star Tropics the pokemon blue of NES action RPGs?
|
|
|
|
Shadowsithe
Guest
|
|
« Reply #7 on: October 12, 2007, 11:28:35 am » |
|
Um... no?
|
|
|
|
Griff Morivan
Guest
|
|
« Reply #8 on: October 12, 2007, 12:43:54 pm » |
|
I mean that in that nothing is organized in a sensible format and that the entire game looks like it was put together as it seemed right.
|
|
|
|
Jigglysaint
Guest
|
|
« Reply #9 on: October 12, 2007, 02:26:39 pm » |
|
Yes, very much so then. For one thing the room headers for the second dungeon is before the room headers for the first dungeon, and so forth. It's like everything was coded backwards!
Edit: Okay so now I understand how the room order works. Basically it's a standard grid, 8x8 in size. Each room has a byte that tells the game which room is in which spot. As long as there is a room, the game will let you go there. If a room has not been defined, then the game will crash. The first room starts at 02, and above it(+8) is 0A. If I want the room to the left to be used, I'd put one of the rooms co-ordinates at 01, and to the right, 03. Quite simple.
|
|
« Last Edit: October 12, 2007, 09:54:28 pm by Jigglysaint »
|
|
|
|
Griff Morivan
Guest
|
|
« Reply #10 on: October 12, 2007, 10:12:18 pm » |
|
Oh. That seems simple enough, actually.
|
|
|
|
Jigglysaint
Guest
|
|
« Reply #11 on: October 12, 2007, 10:49:54 pm » |
|
On second look, it looks like it uses the entire 16x16 grid. Furthermore, stairs work by incrementing the rooms by a certain amount. For example, in Magma's cave in chapter 3, the stairs to the volcanic area is E2 in ram. When you go down the stairs, it changes to 22. Go down one more time at it goes to 62. So as it seems, that's how it works.
|
|
|
|
Griff Morivan
Guest
|
|
« Reply #12 on: October 13, 2007, 07:36:48 am » |
|
That seems like an odd jump...
|
|
|
|
Jigglysaint
Guest
|
|
« Reply #13 on: October 13, 2007, 12:45:12 pm » |
|
If you think that's weird, apprently in Captain Bell's cave, when you leave room that at position 58, you go to position 1F. I think I know why. It's possible that each dungeon has specific "areas" for each part of the dungeon. I didn't see anything like this on C-Island, although there is no wrapping arround in that dungeon. I guess how it works, is that each row is 8 rooms long, and when you reach the last in the row, it goes to the next row. So it could be like this:
38393A3B3C3D3E3F 78797A7B7C7D7E7F 3031323334353637 7071727374757677 28292A2B2C2D2E2F 68696A6B6C6D6E6F 2021222324252627 6061626364656667 18191A1B1C1D1E1F 58595A5B5C5D5E5F 1011121314151617 5051525354555657 08090A0B0C0D0E0F 48494A4B4C4D4E4F 0001020304050607 4011224344454647
And of course it repeats for the other 128 bytes. Dungeons can still be huge, but they have this form of a system rather than an actual grid with co-oridiates system like you would see in Zelda.
|
|
|
|
Griff Morivan
Guest
|
|
« Reply #14 on: October 13, 2007, 04:35:16 pm » |
|
Wow. I look up to you. I mean, I looked up to you when you covered SM:R, but this is awesome. This is like, my oldest favorite game. I loved Star Tropics.
|
|
|
|
|