News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: Marble Madness Editor  (Read 8227 times)

Trax

  • Hero Member
  • *****
  • Posts: 518
    • View Profile
    • Trax ROM Hacking
Marble Madness Editor
« on: July 08, 2013, 06:12:54 pm »
Anyone else thinks Marble Madness is a cool game? Probably. This is a very short game, although quite hard, and it means that when you beat it a few times, there's not much left to do. But if we could change the courses, that would be nice. I gave it a try:

I think it's not too bad for a beginning. I use a single arbitrary palette for now. The first thing that becomes obvious is how the orthogonal faux 3D makes it harder to match with straight square tiles...

The game uses the AOROM mapper (mapper 7), it has 8 PRG banks and no CHR banks. Graphics are compressed using a mix of litterals and RLE repetitions of either 00 or FF. At 0x18D23 (bank 6), there's a table with addresses for PPU loading. It gives offsets and number of bytes to process. Each level has its own set of "chunks" of graphics to feed to the PPU...

The tile mappings also use a specific type of compression. When you read 0xFF, the next byte's bits 4-7 define a type of tile pattern, and bits 0-3 define the number of tiles that must be repeated using the pattern. The patterns are completely arbitrary, each of them is a function. Most of them makes tiles alternate between two values. There's a pointer table for Level 1 tiles mappings at 0x121AB (low byte) and 0x121FC (high byte). Each pointer accounts for a single row of compressed tile codes. Level 1 is 0x51 rows high. Immediately after the tile mappings are the palette mappings, not compressed. Each 8 bytes accounts for 4 rows...

That's it for now. More to come later...
« Last Edit: July 08, 2013, 06:53:14 pm by Trax »

VioletFox

  • Jr. Member
  • **
  • Posts: 6
    • View Profile
Re: Marble Madness Editor
« Reply #1 on: July 08, 2013, 09:06:13 pm »
I have loved marble madness since I was a kid, still haven't beaten it though lol.

henke37

  • Hero Member
  • *****
  • Posts: 643
    • View Profile
Re: Marble Madness Editor
« Reply #2 on: July 09, 2013, 03:06:13 am »
This sounds like a "fun" game to code for.

mrrichard999

  • Hero Member
  • *****
  • Posts: 686
  • So Goooood! :D
    • View Profile
    • GameFAQS Profile
Re: Marble Madness Editor
« Reply #3 on: July 09, 2013, 04:12:42 am »
Nice :) Will there be a Windows release for that program?

snarfblam

  • Submission Reviewer
  • Hero Member
  • *****
  • Posts: 590
  • CANT HACK METROID
    • View Profile
    • snarfblam
Re: Marble Madness Editor
« Reply #4 on: July 09, 2013, 05:47:14 pm »
Nice :) Will there be a Windows release for that program?

I highly doubt it! That said, I look forward to a Marble Madness hack as excellent as your Contra hack.

This is off topic, but I spent a couple of hours sorting through the code for Biker before I decided it would be easier to write a new editor from scratch than port it from Objective-C. If there's anything you have that you're particularly interested in making available to Windows users, and you have detailed notes, I can (and would be happy to) bang out an editor in C# in no time. Just thought I'd throw that out there.

Mega-Dog

  • Jr. Member
  • **
  • Posts: 30
    • View Profile
Re: Marble Madness Editor
« Reply #5 on: July 09, 2013, 08:20:53 pm »
Nice :) Will there be a Windows release for that program?

I doubt it I was building a windows one years ago and just quit.

I hope to continue projects one of these days.

Trax

  • Hero Member
  • *****
  • Posts: 518
    • View Profile
    • Trax ROM Hacking
Re: Marble Madness Editor
« Reply #6 on: July 09, 2013, 11:24:25 pm »
Snarf, at least I'm relieved you didn't go into cardiac arrest seeing my code! Sorry about that. I'll keep your offer I mind...

As for Marble Madness, I'm into the slow process of disassembling the ROM to find out more about palettes, enemies and how the game defines borders and such. Right now, it's only a window that displays tiles, so there's not much to show. I'll add information here as the editor progresses...

Mega-Dog, if you have any information that could be useful, please share it...

Mega-Dog

  • Jr. Member
  • **
  • Posts: 30
    • View Profile
Re: Marble Madness Editor
« Reply #7 on: July 10, 2013, 12:38:30 am »
Snarf, at least I'm relieved you didn't go into cardiac arrest seeing my code! Sorry about that. I'll keep your offer I mind...

As for Marble Madness, I'm into the slow process of disassembling the ROM to find out more about palettes, enemies and how the game defines borders and such. Right now, it's only a window that displays tiles, so there's not much to show. I'll add information here as the editor progresses...

Mega-Dog, if you have any information that could be useful, please share it...

Your as far as I got.  I gave up to start the batman editor I belive.

Also trax you should give me your email so we have better way to comunicate.

Trax

  • Hero Member
  • *****
  • Posts: 518
    • View Profile
    • Trax ROM Hacking
Re: Marble Madness Editor
« Reply #8 on: July 10, 2013, 05:28:31 pm »
Here we go, a few other things are decoded. I found the palettes and applied them successfully to the tiles using the palette mappings that follow immeditely after the compressed level tile mappings. The palettes for each level start at 0x7AB4, 0x10 bytes for background palettes and 0x08 bytes for sprite palettes. Repeat for the 6 levels...

Okay, everything seems fine and dandy, but no. Some tiles are weird, like they don't belong there. At first, I thought there was some sort of bug in the decompression routine, but if you look closely, the tiles are correct, it's their respective palettes that is not. But changing the palette of a single tile is impossible (not with this mapper, at least). Below, the entire level 1 where I highlighted the tiles that don't show correctly:



Why these tiles in particular? I have no idea. Does anyone have a clue?

snarfblam

  • Submission Reviewer
  • Hero Member
  • *****
  • Posts: 590
  • CANT HACK METROID
    • View Profile
    • snarfblam
Re: Marble Madness Editor
« Reply #9 on: July 10, 2013, 08:45:46 pm »
Well, take a look:

Spoiler:

Looks like they overcame the attribute table limitations by using sprites to patch things up. Best way to check it out is by disabling sprites in the emulator (warning: makes it a bit hard to play).

Mega-Dog

  • Jr. Member
  • **
  • Posts: 30
    • View Profile
Re: Marble Madness Editor
« Reply #10 on: July 11, 2013, 12:36:48 am »
They could be rendering the tiles by code or the represent flags and repeated tiles.  I remember the same thing decoding it.

Trax

  • Hero Member
  • *****
  • Posts: 518
    • View Profile
    • Trax ROM Hacking
Re: Marble Madness Editor
« Reply #11 on: July 11, 2013, 02:24:21 pm »
Yes, you've got it right. I just found out about it. Each line of tiles of the level has a variable number of sprites associated to it (which can be zero), and sprites are rendered on screen as you go down (or up) the level. This sucks, but it's better than having color artifacts all over the place. The tables follow the palettes mappings for each level...

For Level 1, there's an offseted pointer table at 0x12AFD and 0x12B51. Each pointer points to a variable string of bytes that define sprites. The length of the strings of bytes should be 3n+1, where n is the number of sprites to display on that specific line. The strings must be zero-terminated. Sprite definitions for Level 1 start at 0x12BA5.

Each sprite has 3 bytes, in order: Tile Code, Attributes (color code, flipping, bg drawing), X Position. In other words, the standard sprite attributes, except Y Position which is determined by the line number.

With that information, we can display the level correctly:

Of course, there's a lot missing. This is only the appearance of the level. Parameters that determine terrain type, slopes, walls, holes, etc., is another beast to tame. There's also enemies and extra sprites, like the orange ramps at the beginning of level 1, the flags at the end of each level. Each level has its own set of sprites with specific behaviors...

But this is just the beginning. The search goes on!

Trax

  • Hero Member
  • *****
  • Posts: 518
    • View Profile
    • Trax ROM Hacking
Re: Marble Madness Editor
« Reply #12 on: July 19, 2013, 04:38:27 pm »
It's progressing, but rather slowly. Level 2 doesn't show up as expected. What we can see from the screenshot below is that the state of the PPU changes from level to level, except I ignore where it is triggered. All levels seem to have a "basic set" of tiles, and then specific modifications are done to the PPU. Other than that, the tile layout itself seem ok. All levels use the same patterns routine, so there's nothing to change for that...

If anyone wants to join the search party, don't hesitate...

Mega-Dog

  • Jr. Member
  • **
  • Posts: 30
    • View Profile
Re: Marble Madness Editor
« Reply #13 on: July 26, 2013, 08:42:02 pm »
It's progressing, but rather slowly. Level 2 doesn't show up as expected. What we can see from the screenshot below is that the state of the PPU changes from level to level, except I ignore where it is triggered. All levels seem to have a "basic set" of tiles, and then specific modifications are done to the PPU. Other than that, the tile layout itself seem ok. All levels use the same patterns routine, so there's nothing to change for that...

If anyone wants to join the search party, don't hesitate...

Not me.  I got my own projects.

Trax

  • Hero Member
  • *****
  • Posts: 518
    • View Profile
    • Trax ROM Hacking
Re: Marble Madness Editor
« Reply #14 on: August 14, 2013, 05:19:52 am »
I finally found something useful. Apparently, all levels have the same "basic" graphics set loaded into the PPU, and then, at the start of the level, specific chunks of graphics data are loaded. Not to mention that during levels, there can be changes in the PPU. But that's not all: the compression algorithm used for these chunks of graphics is not the same as for the "basic" graphics. What a load of crap...

Now it renders correctly. I didn't yet find how the game starts loading graphics during the level, but I presume there is some sort of special object that triggers such event, when you reach a certain Y coordinate. Something like that. Or it's completely arbitrary, which wouldn't surprise me either. Level 1 worked fine from the beginning because it's the only level that doesn't have any graphics change...

As you can see, even with all the corrections on the PPU, there is still some graphics that don't show up correctly up to that point. This is because the PPU is loaded as it would be at the beginning of the level. If there's only one change of graphics per level, then it will be relatively easy to implement: by switching between the "normal" graphics, and the "alt" graphics, like in my Contra editor Red Falcon...

Visually, the only thing missing is the sprites, like the guard rails at the beginning of Level 1, the flags at the end of each level, the enemies, etc. But the hard part will be to decipher how the game processes the actual physics of the game: collisions, walls, slopes, holes, tubes, ice, gratings, etc...

Elipsis

  • Newbie
  • *
  • Posts: 1
  • Speedrunner
    • View Profile
Re: Marble Madness Editor
« Reply #15 on: December 15, 2015, 12:55:11 am »
I signed up just to check in on this thread, as there is a whole Marble Madness romhack in my head and I would love to make it come to life.  I take it this never got finished?
-...

Midna

  • Hero Member
  • *****
  • Posts: 704
  • Resident Panel de Pon Nut
    • View Profile
Re: Marble Madness Editor
« Reply #16 on: December 18, 2015, 05:04:27 am »
Considering the last post in here was made over two years ago...

FAST6191

  • Hero Member
  • *****
  • Posts: 2612
    • View Profile
Re: Marble Madness Editor
« Reply #17 on: December 18, 2015, 11:57:35 am »
For what it is worth marble madness is probably only slightly lower down on the list than tetris, asteroids and pong in terms of things that get homebrew remakes on all the systems.
http://filetrip.net/nds-downloads/games/download-marble-f2826.html is my favourite one for the DS and includes a level editor.