I am developing a Roguelike in JavaScript using ROT.js. I'd like to keep with traditional gameplay (permadeath, randomly generated dungeons/mobs/items), but I want to have a statically defined overworld with randomly generated dungeons beneath.
Currently, I use the TILED map editor to create my overworld map and export it to JSON/JS format and import/parse the map into my game. For randomly generated dungeons, I use ROT.js's built in dungeon generator tool to create dungeons that are in the same JSON/JS format that the TILED maps are in.
The issue I am facing is finding an efficient way to store these maps and levels once they are generated, alongside the overworld. Right now, I just throw the generated maps into a JavaScript object indexed by the name of the map. Here's an example of how I do this currently:
levels = {};
// map class parses TILED map json and creates actors based on ascii
let map = new Map(TiledMaps["overworld"]);
levels["overworld"] = map;
let dungeon = new Map(randomMap(...)); // random map generates tiled map
levels["dungeon1"] = dungeon;
// to switch levels, just set the current game map
Game.map = levels["dungeon1"];
Is this a good approach? I would like to consider the possibility of having different types of dungeons. So, in the overworld, you might visit different sections of the world and those have different dungeons. Something like Link to the Past perhaps? Any advice?