Hmm... Depends how you implement it, technically you can read/write a map as a FileStream (with the v2 api or v1 equivalent would be RawFile) that would not require you to have anything to start with but it would take a bit a bit of setup.

If you use dataWriter.js's Write Struct feature you could do that by setting out something like this though adding a value field in each case (the below is intended for reading not writing so has an id and a type rather than a value and a type):

After the header there is a tile map, this is literally the index value of each tile one after the other all written with the uint16le from dataWriter.js.Note1: the number of tiles you put a value for must exactly equal the width of the layer times the height of the layerNote2: the tiles go from top left along each row then back to the start of the next row, there is nothing in the data dividing the rows.

After the tile data ends there is the obstruction segment data, each segment is just 2 coordinates stored as x1,y1,x2,y2; these use a larger number type uint32le from datawriter.js will handle it, 4 per segment. Note that the layer header above specified the number of segments.

After the segments you move on to the next layer with another layer header etc.

Once all the layers are done you'd go onto entity data and then zone data - may be easier to create the map with none of these and add such things layer with CreatePerson - though you could do it here.

Note at the end of the mapfile you should include the entire contents of the tileset file (unless alternatively you put in a tileset filename as one of the strings above - assuming you need to include the tileset file you could do this by opening it as a filestream and just reading the whole file into a variable then writing that variable to the map file you're making.)

Anyway that's the process does it make sense? Anything you'd like me to elaborate further?

Making an in Sphere map generator of some kind that uses the above method is my todo list but it has slide a long way down said list.

I was actually thinking of creating a random map generator at one point as well, but I have too many other projects and things that need attending to to get around to it.I think a general class for doing general operations on maps would be nice as well, possibly with load and save functions.