Any way to scale up map?

I know there’s a Resize map, but that only increases the bounds. I want to double the size of my map so that there for every 1 tile, there are now 4 (2 horizontal, 2 vertical). Is there any way to do that?

No, as that’s a very unusual scenario - tiles can’t be scaled, so what would you fill the new cells with? You could resize your map to be twice as wide and twice as tall, but it sounds like that’s not what you want.

If you’re just looking to output a larger image when exporting as an image, you can zoom in in the editor to the zoom level you want, and then check “Use current zoom level” when exporting.

I’m just saying I want the map to be twice the resolution - my world is too small. But I want the same land masses - I just want them bigger. Just like doubling the size of an image in Photoshop where 1 pixel would become 4. Then I would go through and smooth out the rough edges. Does not seem like such an unusual request to me…

Ah, now I understand.

Tiles don’t work like pixels do; for the majority of tilesets, scaling the map up this way would give meaningless results and require practically redrawing it anyway, so it is a pretty unusual request xP In most tilesets, there are various transition tiles and multi-tile shapes that would get repeated and turned to nonsense, rather than the map just being larger but blockier.

There’s no built-in way to do this. If you’re familiar with JavaScript, you could write a script for Tiled that scales the map up in this way. You would resize it to the desired size, then iterate over the original portion of the map starting from the right or bottom side and copy the tiles, doubled up, to the new spots. Starting from those bottom or right keeps you from overwriting the original tiles before you’ve dealt with them.

If scripting isn’t an option for you, you could export the original map as an image at the desired scale, resize your map, and place the reference image as a Tile Layer in the map, and then trace over it with tiles. This is of course more work than having it as a built-in feature or a script, but it’s better than redrawing it without a guide.

I guess whether the results would be meaningless depends on the type of game. My game is like an old Ultima game, so there’s no multi-tile shapes. Yeah I guess I will just have to write a program to do it.

Bob, I’m learning how scripting works in Tiled so as an exercise I whipped up something that may work for you. Just copy this into a file (I named it upscale.js) in the tiled/extensions directory and the action should appear in the Map menu.

/* Double map size.  Each tile becomes a 2x2 block. */

var upscale = tiled.registerAction("UpscaleMap", function(action) {
    var map = tiled.activeAsset;
    if(!map || !map.isTileMap) {
        tiled.alert("The active asset must be a TileMap.");
        return;
    }
    var origW = map.width;
    var origH = map.height;
    map.resize(Qt.size(map.width * 2, map.height * 2));
    for(var l = 0; l < map.layerCount; ++l) {
        var ml = map.layerAt(l);
        if(ml.isTileLayer) {
            var edit = ml.edit();
            for(var y = origH - 1; y >= 0; --y) {
                for(var x = origW - 1; x >= 0; --x) {
                    var t = ml.tileAt(x, y);
                    var dx = x*2;
                    var dy = y*2;
                    edit.setTile(dx,   dy,   t);
                    edit.setTile(dx+1, dy,   t);
                    edit.setTile(dx,   dy+1, t);
                    edit.setTile(dx+1, dy+1, t);
                }
            }
            edit.apply();
        }
        else if(ml.isObjectLayer) {
            for(var i = 0; i < ml.objectCount; ++i) {
                var obj = ml.objectAt(i);
                obj.x *= 2;
                obj.y *= 2;
            }
        }
    }
});
upscale.text = "Upscale Map x2"

tiled.extendMenu("Map", [
    {action: "UpscaleMap", before: "OffsetMap"}
]);
2 Likes