I'm just going to throw this out there, hopefully in the form of a question. I might have a better understanding of how to do this just by explaining it in precise terms. Any feedback is appreciated.
So I wanted to make a tile-based game that consists of one "overworld" map that's comprised of smaller maps that link together. The best way to explain it is like the dungeons in zelda - each screen was it's own little tile-based map, but the rooms all connected to make up the whole dungeon. Many of the rooms were recycled though - for example, there are maybe 20-30 room types (i'm just guessing here), populated with different enemies, items, etc.
This is all relatively easy, but what I want to do is have each room in the dungeon have properties that affect things in a larger scale than the myopic approach of ignoring rooms you aren't in. For example, maybe I'd have a monster that follows you from room to room, or maybe fire that spreads from room to room. "global room properties"
I've thought of a couple ways to do this, but it seems too tricky
I'd want the rooms to be interchangeable from a map-editing perspective. So, I'm thinking I'd have re-usuable maps for each room, and their placement would be determined in a larger "overworld" map.
Easy, right? One big problem I'm encountering with this is coming up with a solution for locked doors that would otherwise connect two rooms. I guess my best solution here is to structure my overworld map like this:
Does that sound ok? It'd be just like defining certain tiles as walkable, !walkable, etc.
// Whereas 1-9 = room types,
// 0 = nothing,
// D0= open door, D- = locked door
map = [
[ 0, 0, 0, 0, 0, 0, 0],
[ 0, 1, Do, 2, D-, 1, 0],
[ 0, Do, 0, Do, 0, Do, 0],
[ 0, 3, Do, 4, Do, 5, 0],
[ 0, 0, 0, 0, 0, 0, 0] ];
Then I could affix common properties to rooms like heroIsInRoom=true/false, randomTreasure="arrows", monsters=[gorilla, gorilla, skeleton], etc.
It seems kind of silly to do it this way, as I'm ultimately planning on rendering the whole map on screen at once, but in terms of flexibility, this seems good to me, I'm just wondering if anyone has done something like this before - I could use a second opinion, maybe.