CAMM-Crystal-Alien-Map-Maker icon indicating copy to clipboard operation
CAMM-Crystal-Alien-Map-Maker copied to clipboard

Add shroud editing (manual clearing)

Open leveleditor opened this issue 5 years ago • 3 comments

Add editing features to manually select tiles on the map where the shroud of the map (aka fog of war) should be cleared.

This could potentially be done as either a brush selecting the tiles that should be clear (performing multiple 1x1 clears), or by adding a parameter to each clear point for how many tiles around it should be cleared (0 = the tile itself, 1 = expand in all directions by 1 tile, 2 = by two tiles, etc.)

leveleditor avatar May 12 '20 03:05 leveleditor

Having a brush to "un-fogify" tiles one by one to me would be pretty good. Since you already have editing modes for units, tiles, and buildings, fog could be an editing mode or be part of tile mode (unless it's easier to code I don't think you'll need a parameter for the radius).

Landlighter avatar May 12 '20 17:05 Landlighter

another thing that is technically a biiit limited by the CAC engine:

function(x,y,spread)
		{
		if (!spread)
			return;
		var toReveal = new Array({x: x, y: y});
		var xp1 = x+1;
		var xp2 = x+2;
		var xp3 = x+3;
		var xm1 = x-1;
		var xm2 = x-2;
		var xm3 = x-3;
		var yp1 = y+1;
		var yp2 = y+2;
		var yp3 = y+3;
		var ym1 = y-1;
		var ym2 = y-2;
		var ym3 = y-3;
		if (spread > 1)
			toReveal.push({x: x, y: ym1}, {x: xp1, y: y}, {x: x, y: yp1}, {x: xm1, y: y});
		if (spread > 2)
			toReveal.push({x: x, y: ym2}, {x: xp1, y: ym1}, {x: xp2, y: y}, {x: xp1, y: yp1}, {x: x, y: yp2}, {x: xm1, y: yp1}, {x: xm2, y: y}, {x: xm1, y: ym1});
		if (spread > 3)
			toReveal.push({x: x, y: ym3}, {x: xp1, y: ym3}, {x: xp1, y: ym2}, {x: xp2, y: ym2}, {x: xp2, y: ym1}, {x: xp3, y: ym1}, {x: xp3, y: y}, {x: xp2, y: yp1}, {x: xp3, y: yp1}, {x: xp1, y: yp2}, {x: xp2, y: yp2}, {x: xp1, y: yp3}, {x: x, y: yp3}, {x: xm1, y: yp3}, {x: xm1, y: yp2}, {x: xm2, y: yp2}, {x: xm2, y: yp1}, {x: xm3, y: yp1}, {x: xm3, y: y}, {x: xm2, y: ym1}, {x: xm3, y: ym1}, {x: xm1, y: ym2}, {x: xm2, y: ym2}, {x: xm1, y: ym3});
		var anyUpdate = false;
		for (var i in toReveal)
			{
			if (!this.tiles[toReveal[i].x][toReveal[i].y])
				anyUpdate = true;
			this.tiles[toReveal[i].x][toReveal[i].y] = true;
			}
		if (anyUpdate)
			this.needToUpdate = true;
		}

it is indeed possible to add this to CAMM, but it is currently limited to a certain range [looks to be 4]

Brian151 avatar May 12 '20 23:05 Brian151

Looks like it does support single tile clearing though (with a spread value of 1), so all the more reason to go for the brush-based clearing instead of trying to bypass the spread/range limitations.

leveleditor avatar May 12 '20 23:05 leveleditor