Hey, this is a very simple tutorial that I decided to write after working on The After Years II for a bit. Since we've had an issue of running out of space "so dang quickly", me and Mellon investigated a bit on what we were doing wrong. Maybe it was the fact we were using a lot of graphics, or maybe we're using a lot of samples...perhaps our ASM might be too large. However, while those are pretty big factors, we managed to save a ton of space by simply optimizing the actual stages.
We will give ourselves this, we thought
we were saving space. However, it turns out there were a handful of mistakes that ended up turning our levels into space hogs. So I thought this knowledge could be handy for those who have some nasty habits that could cost your entire 80+ exit hack plans.
(For demoing purposes, I will be using a new rom for every example.)
First, let's take a good look at Level 105 for a second. But first, let's quickly expand our rom a bit and then go to the ne-wait hang on, stop right there. When you saved Level 105....what was the size of that level?
0x0190 bytes? If you quickly take a look at any of your custom VLDC levels, you might notice almost none of your levels even come close to being that small. Well that's because placing tiles from the Map16 Page
is what increases the size dramatically. Every Super Mario World level uses almost exclusively Standard Objects, which only require a small amount of code to actually compile and render onto the level's layout.
Now of course, without map16, we wouldn't even be here today would we? I'm not advicating that we go back to using Standard Objects, that would be completely absurd (especially if it's chocolate). This is just simply a reflection on how costly a map16 tile is, because a map16 tile is essentially a special block that holds specific data read from the game's rom at any dimension and length. To put it into perspective, a 2x2 tile of map16 costs just as much as a full 16x16 tile pasted from the map16 editor! (a single 1x1 tile is half the size, which is smart on LM's end)
Now that's bonkers isn't it? So with this knowledge, you might be able to see now that the size of your tiles highlighted from the map16 page doesn't matter.
Let's break one misconception, and that is that using too much custom map16 can take up a lot of space. As you read on, you'll find that this isn't exactly true. Yes, you can increase the size if your map16 is within 40-7F and C0-FF (because LM is smart enough to check if those tiles are null), but you will find that the sacrificed space of those pages will save you a lot of space for the levels themselves. The actual map16 pages don't matter, so if you happen to see someone doing this for example:
While this may seem like a waste of map16 space, this is actually smart if you happen to be using this in multiple levels. Let's compare the differences between the "built from scratch" version and the "one map16 object" method:
Even though we are using single map16 tiles (which are 4 bytes each instead of 8), we still used more space than the alternative. Repeated usage of using single tiles can increase the size of your rom a lot
, and that was one of our biggest mistakes. So basically if you see anyone make their levels like this at all:
Alright so I've covered the basic understanding of how you can use map16 more effectively. So tutorial's done right? ...Well, let's go over some examples on some common mistakes.
THE WORLD IS STILL BRICKS! [/caddicarus]
So you have a pattern that's like this right?
What is the best way of making a whole tileset with this specific pattern?
Let's look at the gifs.
The left way is how a lot of people attempt to save map16 space by just using a single row of tiles on each "layer" kinda sandwiched together. Since we've already proved that map16 space isn't that important, the right is how you should
be handling tilesets like that.
I recommend your map16 page looks like this so you can cover both the bottom and top sides for whenever you need each, as well as the specific "walls".
You thought it was block, BUT IT WAS ME! BLOCK! god dammit a jojo reference
Alright, so sometimes you have this situation:
You might be thinking "well, those blocks behind the one block are just deleted ingame right?" Not quite,
and this little explanation is why the infamous 1-up checkpoint/dragon coin/moon trick actually works. If you place a tile above another tile, what the game will do is render the tile, then render the other one on top of it. So when you place the 1-up checkpoints, those blocks are no longer rendered once they are activated, so those blocks are deleted the next time you enter the level and what was behind those objects appear instead. So the next time you make your level, make sure you aren't overlapping a tile completely.....speaking of which.
Crossroads I don't have a funny meme to reference this time
Okay so what I said earlier can be used to your advantage when optimizing your levels.
Let's say you want something in between something. Maybe a decoration, or etc. Well...
instead of placing cement blocks to the left and right of the used blocks, you can instead place the used block tiles over
the cement blocks. This prevents the game from having spend 3 objects rendering something instead of two. This is very handy if you want to really branch out your objects in order to save just a tiny amount of space.
That being said, don't do this with Tile 25 (the transparent block). This is silly, as you could just place two objects instead and that costs the exact amount of space. To use Tile 25 properly with the crossroad method, this can prevent four objects and instead just have two:
This Symbol is Trademarked raring to go
Okay, so you're the kind of guy (or girl) who likes to have a sort of signature, or symbol, to represent your romhacks. You usually draw it with coins, since that's the easiest object you can think of that's fun to interact with. Well, if you're going to have this exact symbol of coins throughout the various stages, maybe consider spending some of that on your map16?
Keep in mind, like the goal post example from earlier, make sure you're actually using this enough times for this sort of thing to be worth it. Of course, this is a pretty specific example, but even just this can be truly useful since anything involving placing single objects might as well just be combined into one block:
Now this trick can also be used for if you're going for portrait rooms (seen in Kaizo:Light Romhacks), and all you're doing is using different graphics for the exact same map16 page. This basically achieves the same effect of saving level space from using a single giant map16 object.
Okay, sometimes, you have a pattern that requires space in between, but it's consistently the same distance. This is another good use of Tile 25, but not in the overlap sense. Let's say you have a very consistent cement block gap that's always 3 tiles a part from each other.
So what if that entire section is actually a single map16 object?
This can be handy for if you need a coin trail that is always coin-space-coin-space, or if you're alternating between two objects with space between. and it remains consistent for a bit. This trick is very handy for optimization purposes that have like a tileset with torches, or pillars with a gap between them.
So my final tip kind of goes back to the beginning of this whole thing between map16 and standard objects, and that is....
Learning how to use ObjecTool
Yes one of the best ways of optimizing your chocolate hacks is creating your own custom standard objects. I personally don't know how to use this patch, and this isn't a tutorial on how to use the current version of it (this one
is for 0.4). However since map16 objects can have so many properties per block, using objecTool instead of map16 is your best bet if you're really tight on space. Just a note, but they will appear glitched when you insert the objects in lunar magic, but ingame they should appear normally (assuming you've used it correctly).
I will probably come back to this thread with more tips, but for now these are my best pieces of advice I can give. Maybe in the future I can organize this a little better (it's 7 in the morning here jees). For now, hope it's useful!