Sonic and Sega Retro Message Board: So I made something that renders Sonic Rush level maps - Sonic and Sega Retro Message Board

Jump to content

Hey there, Guest!  (Log In · Register) Help
Loading News Feed...
 

So I made something that renders Sonic Rush level maps

#1 User is offline Techokami 

Posted 11 December 2010 - 06:28 PM

  • For use only on NTSC Genesis systems
  • Posts: 1051
  • Joined: 19-November 05
  • Gender:Male
  • Location:HoleNet!
  • Project:Sonic Edge
  • Wiki edits:63
Yeah it's nothing special, but it is the first thing released to the public that deals with levels in Rush-based games.
To make it work, you need a few things:
  • A ROM, obviously, to get files from. You can try it with Sonic Rush (E3 beta).
  • Tahaxan, or some other DS ROM file extractor plus a NARC extractor tool, to extract the files out of the ROM.
  • These three scripts. Don't forget to change the extension to .php after downloading!
  • Something that runs PHP and has the nuts to handle creating bigass images.

So, you go into the ROM and take from the desired level's NARC files:
  • The .bk file, which is the metatile mappings
  • The .ch file, which is the graphics data
  • The .pl file, which is the palette data
  • The .mp files, which are the level map data (one has an "_a" suffix, the other a "_b" suffix)

Now, you put these files into a directory that is in the same location as the three scripts. Then, you run rush_levelrip.php?game=A&level=B to generate the metatile images, which should only take a few seconds.
You replace A with the directory you put the files in, and B with the name shared by the files you extracted, usually a z with two numbers.

Finally, you run srlp.php?game=A&level=B to make the map images. This may take a minute or so to run, Sonic Rush levels are very large.
You replace A with the directory you put the files in, and B with the name shared by the files you extracted, usually a z with two numbers. You can optionally add in &meta=C, where C is a manual override for the metatiles to use. You won't need to use this, unless you're trying to make maps of the hidden island stages in Sonic Rush Adventure.

Also, in case you're wondering, here's how the .mp files are put together: the first word is the width of the level in metatiles (which are 64x64 pixels), the second word is the height of the level in metatiles, and every word after that until the EOF is a metatile ID. Little endian!

Hopefully this will encourage someone to look deeper into the other files that make up levels in the Sonic Rush games, or even start making a level editor! smile.png

#2 User is offline Cruizer 

Posted 15 December 2010 - 10:56 PM

  • Posts: 28
  • Joined: 21-November 09
  • Gender:Male
  • Location:Australia
  • Project:Reverse Engineering the Rush series
  • Wiki edits:38
So will this only work with Sonic Rush, or can its sequels actually work with this?

Had to increase PHP Memory allocation to 256MB to get these:
Leaf Storm 1-A
Leaf Storm 1-B
This post has been edited by Cruizer: 19 December 2010 - 03:23 AM

#3 User is offline Techokami 

Posted 19 December 2010 - 03:15 PM

  • For use only on NTSC Genesis systems
  • Posts: 1051
  • Joined: 19-November 05
  • Gender:Male
  • Location:HoleNet!
  • Project:Sonic Edge
  • Wiki edits:63
QUOTE (Cruizer @ Dec 15 2010, 08:56 PM)
So will this only work with Sonic Rush, or can its sequels actually work with this?
I wasn't very clear about it, but yes it works with any of the sequels (Rush Adventure and Colors)

#4 User is offline Cruizer 

Posted 20 December 2010 - 08:42 AM

  • Posts: 28
  • Joined: 21-November 09
  • Gender:Male
  • Location:Australia
  • Project:Reverse Engineering the Rush series
  • Wiki edits:38
QUOTE (Techokami @ Dec 19 2010, 08:15 PM)
I wasn't very clear about it, but yes it works with any of the sequels (Rush Adventure and Colors)


Well thats good to know. :P

I've done a little bit of snooping in the zone/act data myself, and it seems that the .rg files store the locations for rings. I've only gotten the basics of moving rings around, and am still having troubles understanding/properly moving them. But perhaps this information may be helpful in getting more features added to the maps? (Like Badniks and Springs/Gimmicks)

I haven't a clue on how the Mapping scripts work, let alone know anything about PHP, so I can't say that I can help in the actual development of the mapping procedure, just that I have the capabilities of running the scripts :P

EDIT: All maps have been done, except for Blizzard Peaks 2, and the hidden Islands.

Sonic Rush
Sonic Rush Adventure
Sonic Colo(u)rs

I have someone working on combining them at this very moment. So I'll updated when we have completed map layouts.
This post has been edited by Cruizer: 21 December 2010 - 02:20 AM

#5 User is offline Sparks 

Posted 21 December 2010 - 02:54 AM

  • Posts: 2495
  • Joined: 27-June 05
  • Gender:Male
  • Project:Gold's Curse
  • Wiki edits:21
Those maps are freakin huge. psyduck.png

And I see this got featured on the front page v.png

#6 User is offline Cruizer 

Posted 21 December 2010 - 03:45 AM

  • Posts: 28
  • Joined: 21-November 09
  • Gender:Male
  • Location:Australia
  • Project:Reverse Engineering the Rush series
  • Wiki edits:38
New update: The maps for Rush have been merged.

The ring mappings seem to be going well, once we've conclusively found a way to put them in the map, the maps will look much prettier.
This post has been edited by Cruizer: 21 December 2010 - 04:08 AM

#7 User is offline Techokami 

Posted 21 December 2010 - 07:39 AM

  • For use only on NTSC Genesis systems
  • Posts: 1051
  • Joined: 19-November 05
  • Gender:Male
  • Location:HoleNet!
  • Project:Sonic Edge
  • Wiki edits:63
QUOTE (Cruizer @ Dec 20 2010, 05:42 AM)
I've done a little bit of snooping in the zone/act data myself, and it seems that the .rg files store the locations for rings. I've only gotten the basics of moving rings around, and am still having troubles understanding/properly moving them. But perhaps this information may be helpful in getting more features added to the maps? (Like Badniks and Springs/Gimmicks)

whaaa? =O
Please do explain what you do know about the .RG files!

#8 User is offline Cruizer 

Posted 21 December 2010 - 10:54 AM

  • Posts: 28
  • Joined: 21-November 09
  • Gender:Male
  • Location:Australia
  • Project:Reverse Engineering the Rush series
  • Wiki edits:38
QUOTE (Techokami @ Dec 21 2010, 12:39 PM)
whaaa? =O
Please do explain what you do know about the .RG files!


Well, I've only tested it with Leaf Storm's Boss map, and really only tested vertical movement, but locations are stored in the latter half of the file. And this format seems to be consistent with all other levels and bosses (including Rush Adventure and Colours), and this format is even used in Sonic 4.

Anyway, looking into z13.rg from Sonic Rush, 0x20 seems to be the location where the locations are stored.

the 06 00 values (at 0x20/0x21 and 0x2E/0x2F; I -think- they both denote it, I may be wrong yet) determine how many locations are to follow. after which, the values are matched in pairs. XX and YY. The XX value is the horizontal position (from the left; in pixels by the looks of it), and YY is the vertical value, coming downwards from the top.

I'm also speculating that the first four values denote how many blocks there are of rings, or possibly something to do with the size of the ring map, and each block (I think it may be 256x256px or something around that size) is given a number of rings in it. I'm not entirely sure how this works yet, and this is only just educated guessing. I could be deadly wrong on this though. Thankfully, someone is helping me with it, so we'll get it soon yet.

Oh also, .dc and .ev files (also within z##_eve.narc along with .rg) seem to also control objects. I've been focusing with rings at the moment, so I haven't a clue on these just yet.

EDIT: Demonstrating. I changed 0xE0, 0xE2, 0xE4 (in z13_eve.narc) from "E8" to "D0" Here are the results:
Before:


After:

This post has been edited by Cruizer: 11 January 2011 - 09:54 AM

#9 User is offline Cruizer 

Posted 21 December 2010 - 12:09 PM

  • Posts: 28
  • Joined: 21-November 09
  • Gender:Male
  • Location:Australia
  • Project:Reverse Engineering the Rush series
  • Wiki edits:38
I know double posts are a cardinal sin, but it is with a breakthrough.

I have the .rg files completely figured out.

The first two words in the files, determine how many blocks of 256x256 pixel sections there are in the ring map.

Then follows a a number of sets of two words, the first points to offset of section's ring modifier, the second is -always- 0. The number of sets corresponds to the number of sections.

Finally, when at the offset the pointer specified, we get another word, which tells us how many rings there are in this section. After which, it is followed by two values/bytes, each for the X and Y positions within the section (as stated above).


Example:


First word 0052 (the values are backwards, I don't know why, but this is a key to this entire thing. Or perhaps it's always like this, and I'm completely new at hacking) means 82 horizontal sections (since 52(HEX) = 82(DEC)).
Second word 000F; 15 vertical sections.

Third word (appears 3C 13, but is actually 133C, pointing at 0x133C)




Since this is the first section, we can see that the previous two words point to the last section. And by reading the word at 0x133C/0x133D, we can see that there are 0 rings. So lets go to a word that gives rings, namely the one on screen at 0x13C6.

It says 09 00, which means 9 rings. the following values are the X and Y values (in hexadecimal pixels) of each ring. So there is a ring at each of the following:
CODE
(192, 160)
(192, 184)
(192, 208)
(192, 232)
(192, 136)
(216, 152)
(216, 176)
(168, 152)
(168, 176)



And there you have it. .rg files are done and dusted. I'll move onto .ev and .dc files tomorrow and stuff. They look similar so it shouldn't be too hard.

#10 User is offline Techokami 

Posted 21 December 2010 - 12:56 PM

  • For use only on NTSC Genesis systems
  • Posts: 1051
  • Joined: 19-November 05
  • Gender:Male
  • Location:HoleNet!
  • Project:Sonic Edge
  • Wiki edits:63
QUOTE
(the values are backwards, I don't know why, but this is a key to this entire thing. Or perhaps it's always like this, and I'm completely new at hacking)
Endians. The files in Rush use little endian format.

But very nice and thorough analysis of the rings layout data!

So here's the parts of a level we know:
AT - Level Attributes (needs further exploring!)
BK - Block Mappings
CH - Character Data (graphics)
MP - Map Layout (_a for Layer A, _b for Layer B)
PL - Palette Data
RG - Rings Layout

#11 User is offline Cruizer 

Posted 22 December 2010 - 01:30 AM

  • Posts: 28
  • Joined: 21-November 09
  • Gender:Male
  • Location:Australia
  • Project:Reverse Engineering the Rush series
  • Wiki edits:38
There is reason to believe that the .dc files are Badnik Locations, and .ev are all other Stage Objects, like Springs, Trick Rings and stuff. They are very similar to the format of .rg, but they differ so that all the different objects are able to be put in. So once again, I'll do some testing on a boss, and report back :P

Also just to question about the .at files, Leaf Storm Boss' was just rows of 00 values. So what attributes would it possibly be?

#12 User is offline Techokami 

Posted 22 December 2010 - 06:48 AM

  • For use only on NTSC Genesis systems
  • Posts: 1051
  • Joined: 19-November 05
  • Gender:Male
  • Location:HoleNet!
  • Project:Sonic Edge
  • Wiki edits:63
Polygon Jim mentioned over MSN that DC files are Decoration Locations, and that EV is for other general objects.
AT has at least information about where the top to bottom screen threshhold is.

#13 User is offline Cruizer 

Posted 22 December 2010 - 08:31 AM

  • Posts: 28
  • Joined: 21-November 09
  • Gender:Male
  • Location:Australia
  • Project:Reverse Engineering the Rush series
  • Wiki edits:38
QUOTE (Techokami @ Dec 22 2010, 10:48 PM)
AT has at least information about where the top to bottom screen threshold is.


If this is true, then how do we explain the values of 00's through the boss levels?


#14 User is offline Techokami 

Posted 22 December 2010 - 01:26 PM

  • For use only on NTSC Genesis systems
  • Posts: 1051
  • Joined: 19-November 05
  • Gender:Male
  • Location:HoleNet!
  • Project:Sonic Edge
  • Wiki edits:63
QUOTE (Cruizer @ Dec 22 2010, 05:31 AM)
QUOTE (Techokami @ Dec 22 2010, 10:48 PM)
AT has at least information about where the top to bottom screen threshold is.


If this is true, then how do we explain the values of 00's through the boss levels?

Because bosses only work on a single screen in Sonic Rush? To be honest I'm not completely interested in boss stage hacking, I'm focusing more on the normal levels.

#15 User is offline Polygon Jim 

Posted 22 December 2010 - 03:12 PM

  • Posts: 3071
  • Joined: 29-March 08
  • Gender:Male
  • Location:across town from Hinchy
  • Project:All the bitches.
  • Wiki edits:582
Good work on the .rg files, though for future reference you should probably check out big/little endian byte orders so you'll understand why things are in "reverse".

I'm not %100 positive if the .dc files will be decorations in Rush, but they are in S4 which uses the same naming system for everything so I would assume they still have the same function between the games. Good luck on the .dc/.ev files.

  • 3 Pages +
  • 1
  • 2
  • 3
    Locked
    Locked Forum

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users