Using OoB tiles in your maps

Sep 25, 2019 at 7:55 PM
Deliverer of Sweets
Bobomb says: "I need a hug!"
Join Date: Jul 20, 2015
Location: Under sea level or something
Posts: 772
Age: 24
I'm a bit out of touch with the modding communities so I can't confirm but as far as I know this is a little useful quirk that isn't too well known, and I felt like it might as well be documented in a post like this.
Basically this is gonna be a post on the behavior of tilesets regarding the use of out of bounds tiles. I'm gonna assume that you have at least a bit about tileset modding.

As you may or may not know, tilesets can be 256×64 to 256×256 in resolution, if your tileset is smaller is smaller than the max size, then the tile space you're missing out on is considered out of bounds.

There's a couple ways to put an out of bounds tile in your map, as you can't just directly select one in Booster's Lab:
1. <CMP can set a tile directly to any tile you want, and if you <SMP beyond tile #0, it'll roll back to tile #255, regardless of tileset size (The same thing happens with <CMP, so don't bother trying to go beyond 255 because #256 will just be #0).
2. Editing your map with a larger tileset before switching over to whatever smaller tileset you intended to use.
3. Using the copy tool in BL by selecting tiles with an out of bounds ID in another map, and then using your selection in the map you want to put these in (This may not work in older versions as tile selections may not be global in them and i've no idea in what version this was changed).

Now that we know how to ruin our map with tiles that dont even exist in their tilesets, we must know why we actually want to do this.
Simply put, these out of bounds tiles will look like the tiles of previously loaded tilesets. Now putting it that way might not be so very clear, so lets go it over step by step.

First, we make this map using the vanilla White tileset (the one for the Balcony). If you don't remember how that looks like refer to the PrtWhite.bmp file in the data/stages folder.
unknown.png

This is a simple map, with a single pot entity. But say we want to make a version of the same map using the Outer Wall tileset (PrtOside), so we copy the tiles, fill in a new map, and change the ground a bit and add the pot. In the editor it should look like this;
unknown.png

However, if we use the pot to go from the first map to the second, it will look like this:
unknown.png

Now, as you may know, the Outer Wall tileset does not have grass, so how did it get into this map?!
Imagine the 'tileset memory' as a 256x256 image, if we load a map, it's tileset is loaded into this image right at the top, for example with Balcony's tileset it will be loaded like this (And my bad for the poor man's representation but I am too tired to worry about copyright issues and if they even apply in this case if I post the full tilesets):
unknown.png

The tileset (including all the empty black space the tileset has) is 256×240 in size, which means it almost fills up this entire 'tileset memory'.
Now you may normally expect the Outer Wall tileset to just replace the tileset already in the memory, but it will actually load on top of the current like this:
unknown.png

The previous tileset is still there! The new 256×64 tileset only has replaced a small portion of the previous one, which actually still leaves it perfectly usable. If White had any spikes in the non-overwritten area, we could've placed these in our map even if Oside didn't have them.
If we load another tileset, it'll be pasted on top of these two just like how Oside went onto White. Of course, these tilesets are loaded when Cave Story loads a map.

Note that by default, White will always be loaded because of the intro cutscene using this tileset.
And also very important: THIS DOES NOT SAVE.
Because of this, I severely discourage allowing the player to save in a map that makes use of this technique unless you know what you're doing. Nobody likes incorrectly loaded maps after all.

While writing this post I've also had a case of the 'tileset memory' being refreshed for whatever reason after tabbing in after a while, though I haven't managed to do this a second time so make of that what you will.

There's various ways to make use of this, but what you basically want to do is load a map from a map whose tileset has parts that you want to use in the new map. A cool side effect from this is that you practically can have variable tiles by using multiple maps, not only growing the amount of tiles you can technically use for one map, but also possibly greatly reducing the need of many <CMP commands or entrance events.
You can even make a map change time or season (though this sadly doesn't work on backgrounds so you gotta find a solution for that yourself) by just entering a door that fades out before fading in on a changed variant of the same map, hiding the fact that you actually loaded a different map and went back.
I recommend trying things out and see what you can come up with, there could be some pretty neat things that can be done with this that would otherwise require large amounts of TSC or even assembly.

I hope I covered everything surrounding this subject and well enough at that since I'm tired and not very confident about my writing as someone who doesn't speak native English and I've a tendency to mess something up when I make a thread anyway.
If there's anything I missed, made any mistakes or left some things unclear please mention that.

I'm posting this mostly so others can try this out and maybe find cool ways to make their mod's maps, and also so it's a bit better documented than just a profile post or random concept posts I may have made in Discord servers.
So yeah, thanks for reading this massive wall of text and I hope it comes to some use for someone.
 
Sep 25, 2019 at 9:11 PM
Best Cow
"Life begins and ends with Nu."
Join Date: Jun 27, 2013
Location:
Posts: 2653
Age: 27
I am previously aware of this quirk being a thing within Cave Story's engine. It's fine to come and go mess around with this if this is what you want. But just in case someone comes and asks "well, how do I make sure this doesn't happen?" I recommend just making all tilesets 256x256 in resolution so the large, blank, black space (which will be transparent in-game) can overwrite any of the overlapping tiles.
 
Sep 26, 2019 at 12:19 AM
Indie game enthusiast
"What is a man!? A miserable pile of secrets! But enough talk, have at you!"
Join Date: Apr 18, 2006
Location: Forever wandering the tower...!
Posts: 1772
I think I used a form of this in one of my unfinished things. If I recall correctly, I stumbled upon the fact if you don't set a tileset, the previously loaded tileset would be used.
 
Sep 26, 2019 at 1:51 AM
Soup Man
"In Soviet Russia, graves keep YOU!"
Join Date: Jul 15, 2014
Location: IN YOUR HEAD, SHIT FOR BRAINS
Posts: 670
Age: 6
this is cool but does it have any practical uses
There's various ways to make use of this, but what you basically want to do is load a map from a map whose tileset has parts that you want to use in the new map. A cool side effect from this is that you practically can have variable tiles by using multiple maps, not only growing the amount of tiles you can technically use for one map, but also possibly greatly reducing the need of many <CMP commands or entrance events.
You can even make a map change time or season (though this sadly doesn't work on backgrounds so you gotta find a solution for that yourself) by just entering a door that fades out before fading in on a changed variant of the same map, hiding the fact that you actually loaded a different map and went back.
I recommend trying things out and see what you can come up with, there could be some pretty neat things that can be done with this that would otherwise require large amounts of TSC or even assembly.

I'm not sure what you mean by any of this. If you need to load the new tileset on top of the old tileset anyway, isn't it just easier to have all the tiles on one tileset? if you need to fade out and fade in, most people just assume you're using a <TRA anyway. i can only see this as useful if you're too lazy to just copy the tiles from one tileset to another if you use two that have the same tiles.

this just seems like <TRA with extra steps, but it is an interesting mechanic. thanks for posting these findings

EDIT: wait nevermind i reread and understood what you meant with the changing seasons thing. guess thats more efficient than making a new map. i initially thought that this wasnt that useful then i realized you can actually change quite a bit of tiles with minimal effort this way. epic
 
Last edited:
Sep 26, 2019 at 6:09 AM
Deliverer of Sweets
Bobomb says: "I need a hug!"
Join Date: Jul 20, 2015
Location: Under sea level or something
Posts: 772
Age: 24
Just edit the pxm file. Come on...
I mean yeah you're not wrong, but do we even have any proper tools to do so? Just doing it in a hex editor sounds like a rough time.
 
Sep 27, 2019 at 7:21 PM
Senior Member
Modding Community Discord Moderator
CSE Discord Moderator
"Fly, Fly, Fly!"
Join Date: Jan 14, 2014
Location: Antarctica (The Penguins say Hi)
Posts: 142
Age: 22
...do we even have any proper tools to do so?

I added support for this in CMPGenerator, but it really isn't the most friendly editor to use for large map edits.
On a related note, CS doesn't clear the map (as in tiles) buffer when loading a new map either, so if you resize the map using OOB tsc, you can load in tile data from the previous map. It's way harder to use that than it is to use OOB tileset data though.
 
Top