ID:1971614
 
(See the best response by Ter13.)
Code:


Problem description:

I'm wondering if it is possible to create maps during runtime(from a template) for housing purposes?
For example Player X buys Property, he then enters the Property and it makes a new map called "Player X_Home.dmm" using a template of a base home "Base_Home.dmm" or some such, and then teleports him to the entrance of that home were he can customize etc.

Best response
Yes.
How would I go about this? is there a tutorial or code example somewhere that I could look at? Or even just a syntax to look up for myself lol
Check out LummoxJR's swapmaps for a simple example. You probably don't want to use the .dmm format, because parsing it is slow. You'll want to create your map templates and then export them to a faster format. The less unique information you permit for each tile/object, the faster your map loading/saving algorithm will run.

My advice is to avoid declaring and modifying non-tmp variables on turfs/objects and instead use a databasing approach provided your game doesn't absolutely require turfs/objects to have saved unique tracked values.
It's non-trivial to do make new map files on the fly (no built-in functionality for it), but you can open up .dmm files in a text editor to see their format.
In response to Popisfizzy
IainPeregrine has a library for saving/loading .dmm files too.
It's non-trivial to do make new map files on the fly

This is largely because the DMM format was a horribly designed specification.

There are a few things that I absolutely without regret will admit I hate about BYOND, and the DMM format is in my top 2. Lummox isn't as passionate about it as I am, but he does (seemingly) agree that the format is littered with issues.

It does allow a lot of flexibility, which is nice, but the added flexibility, in my opinion almost always leads to massive design flaws and overcomplicates everything BYOND has to do as an engine, robbing it of speed at every turn.
Partly because it is essentially the equivalent of a bitmap file. Years ago I'd thought about making a library for a new map format that would slim things down a bit while still being human-readable, but that never happened.
Yeah, the .dmm format is severely limited. There are some things it just can't do.
So, would you advise against simply using the swapmaps library?
-edit: The irony of having posting this question seconds after the author of said library comments on my post xDD
SwapMaps doesn't rely on the .dmm format.
Oh I see, so it would be a useful resource for what I am trying to do?
Oh I see, so it would be a useful resource for what I am trying to do?

It's more or less exactly what you are looking for.
Thank you for the help :) (*cough* and sorry for the silly questions, I quite frequently confirm things by asking obvious questions, lol)
Okay, I'm having an issue, Whenever I try to create/save/load a map it seems to create a copy of the current map with the set dimensions and automatically put me there, and then if I log off boot up a different map and try to load the old map as a new map it simply copies the current map, am I doing something wrong?