Cartographer Filters

Dec 26, 2005 23:46 Cartographer Filters
* From DAllen's idea in the "Cartographer" thread *

Cartographer is a very good tool for map creators, even if it needs some more functions to be complete (see here to read the discussion about it). I can say to you that Ianbanks wants to continue his work on it : he just need our encouragements, to find some time, and to see that we use it ;)

The object of this thread is that Cartographer allows us to create and use Filters written in LUA.

I give here some scripts I made.
  1. Create a "Filters" directory in the same directory than "Cartographer.exe".

  2. Copy all the content of each script in a new Notepad file. I recommend you to name the file like the 1st line of the script (without the"-- "). Don't forget the ".lua" extension when saving.

  3. Open Cartographer. Open Filters menu and you will see the new filters.[/list:o:c1344c573b]
    *EDIT 2006-07-31 : You can download my complete collection of filters, ready to use, on my "Alain's WinBolo Micro-Site" here ;)


    A simple script to understand the terrains codes :
    [code:1:c1344c573b]-- Tool - Terrains Codes.lua
    -- Cartographer Filter
    -- By Alain

    for i = 0, 16 do
    line(i+5, i, i+10, i, i)
    end[/code:1:c1344c573b]

    The center of the square made by this 2nd filter is the absolute symmetry center of the map. Draw in a quad and then use the 4 other symmetry filters to complete the other quads.
    [code:1:c1344c573b]-- Tool - Symmetry 0 Center Point.lua
    -- Cartographer Filter
    -- By Alain

    line(127, 127, 128, 128, 4)
    line(127, 128, 128, 127, 0)[/code:1:c1344c573b]

    [code:1:c1344c573b]-- Tool - Symmetry 1 West-East.lua
    -- Cartographer Filter
    -- By Alain

    for y = 0, 255 do
    for x = 0, 127 do
    setpoint(255-x, y, getpoint(x, y))
    end
    end[/code:1:c1344c573b]

    [code:1:c1344c573b]-- Tool - Symmetry 2 East-West.lua
    -- Cartographer Filter
    -- By Alain

    for y = 0, 255 do
    for x = 0, 127 do
    setpoint(x, y, getpoint(255-x, y))
    end
    end[/code:1:c1344c573b]

    [code:1:c1344c573b]-- Tool - Symmetry 3 North-South.lua
    -- Cartographer Filter
    -- By Alain

    for y = 0, 127 do
    for x = 0, 255 do
    setpoint(x, 255-y, getpoint(x, y))
    end
    end[/code:1:c1344c573b]

    [code:1:c1344c573b]-- Tool - Symmetry 4 South-North.lua
    -- Cartographer Filter
    -- By Alain

    for y = 0, 127 do
    for x = 0, 255 do
    setpoint(x, y, getpoint(x, 255-y))
    end
    end[/code:1:c1344c573b]

    Some other examples of filters (some of them already posted by others and modified) :
    [code:1:c1344c573b]-- Tool - Border Limits.lua
    -- Cartographer Filter
    -- By Alain

    tile_type = OCEAN

    for i = 0, 9 do
    line(i, 0, i, 255, tile_type)
    line(0, i, 255, i, tile_type)
    line(255-i, 0, 255-i, 255, tile_type)
    line(255, 255-i, 0, 255-i, tile_type)
    end[/code:1:c1344c573b]

    [code:1:c1344c573b]-- Background - Random Diagonals.lua
    -- Cartographer Filter
    -- By Alain

    for n = 1, 10000 do
    x = math.random() * 225 + 10
    y = math.random() * 225 + 10
    line(x, y, x + 10, y + 10, math.random() * 10)
    end[/code:1:c1344c573b]

    [code:1:c1344c573b]-- Background - Explosion.lua
    -- Cartographer Filter
    -- By Alain

    for x = 0, 1000 do
    line(127, 127, math.random(10, 245), math.random(10, 245), math.random(0, 9))
    end[/code:1:c1344c573b]

    Tell me if you want that I send you all these files "ready to use".

    Then... if you make some interesting filters, please post them here :D[/url][/b]
Last edited: Jul 31, 2006 16:07 (edited 2 times)
Dec 27, 2005 00:05
Neat, but it'd be nice if we had a description of what each filter did.
Dec 27, 2005 00:14
The titles / file names says it, Nova...
Dec 27, 2005 00:17
I suppose it does, I just didn't understand at first.
Dec 27, 2005 00:23
I send you the files Nova, I think that you will like the tools. :wink:
Dec 27, 2005 00:28
Very nice, Alain. Thank you.

edit: You could upload the files somewhere like www.uploadit.org that way everyone could do the same.
Apr 23, 2006 20:42 Re: Cartographer Filters
Alain wrote:


  1. Create a "Filters" directory in the same directory than "Cartographer.exe".

  2. Copy all the content of each script in a new Notepad file. I recommend you to name the file like the 1st line of the script (without the"-- "). Don't forget the ".lua" extension when saving.

  3. Open Cartographer. Open Filters menu and you will see the new filters.[/list:o:09cf45629f]



a bit of more detales?
it dident work for me.
Apr 24, 2006 11:51
#2 : I will send you a ZIP file of a directory "Filters" containing all these precedent filters. Just unzip it in the same folder then "Cartographer.exe". Open Cartographer and you will see the new filters in the menu "Filters". Good luck ! :wink:
Apr 24, 2006 12:01
thanks!

but please can you send it to metric810@hotmail.com ?
May 13, 2006 08:21
New filter !

To try it, open a new map, draw some lines, empty or filled circles, squares... and run the filter : all the terrains surrounded by sea will grow !

For the ones who wants more details :
This filter records in a table the terrain values of all the squares of the map. But not the squares included in the minefield : 10 tiles from each border. The filter don't do anything in this zone = security. Then, if a recorded square is not deep water, it tests all the 8 squares around it. If and only if one of this 8 is deep water (sea), the square analysed becomes the same terrain than the center recorded square. The "recording / analyse / drawing" runs by west to east square, line by line, and from north to south. You can use it any time you want on the map.

[code:1:8c4007593c]-- Tool - Morphing Grow All.lua
-- Cartographer Filter
-- By Alain

terrain = {}

for y = 11, 244 do
for x = 11, 244 do
terrain[y * 234 + x] = getpoint(x, y)
end
end

for y = 11, 244 do
for x = 11, 244 do
ter = terrain[y * 234 + x]
if ter ~= 16 then
if getpoint(x - 1, y - 1) == 16 then setpoint(x - 1, y - 1, ter) end
if getpoint(x - 1, y) == 16 then setpoint(x - 1, y, ter) end
if getpoint(x - 1, y + 1) == 16 then setpoint(x - 1, y + 1, ter) end
if getpoint(x, y - 1) == 16 then setpoint(x, y - 1, ter) end
if getpoint(x, y + 1) == 16 then setpoint(x, y + 1, ter) end
if getpoint(x + 1, y - 1) == 16 then setpoint(x + 1, y - 1, ter) end
if getpoint(x + 1, y) == 16 then setpoint(x + 1, y, ter) end
if getpoint(x + 1, y + 1) == 16 then setpoint(x + 1, y + 1, ter) end
end
end
end
[/code:1:8c4007593c]
May 13, 2006 08:40
New filter to make random background or "hexagonal maze" : each terrain shape is in contact with 6 other terrain shapes. Then you can modify and keep any part you want, make it symmetric or not and build maps from that...

[code:1:4422260c7f]-- Background - Hexa Maze.lua
-- Cartographer Filter
-- By Alain

for y = 12, 240, 6 do
for x = 15, 239, 4 do
ter = math.random(1, 10)
if ter == 10 then ter = 16 end
line(x, y, x+1, y, ter)
line(x-1, y+1, x+2, y+1, ter)
line(x-1, y+2, x+2, y+2, ter)
line(x, y+3, x+1, y+3, ter)
end
end

for y = 15, 237, 6 do
for x = 13, 241, 4 do
ter = math.random(1, 10)
if ter == 10 then ter = 16 end
line(x, y, x+1, y, ter)
line(x-1, y+1, x+2, y+1, ter)
line(x-1, y+2, x+2, y+2, ter)
line(x, y+3, x+1, y+3, ter)
end
end
[/code:1:4422260c7f]

Note : I post these filters to give some examples of what we can do with Cartographer. You can use them like they are, but you can modify them with your own values and add your own scripts to do specific drawings...

If some of you write some interesting scripts, post them here please :D
Jun 05, 2006 09:47
New filter that I'm using to create zet_Land : Tool - Copy With Rotation From North-West Quad. It is very quicker and simpler than using BoloReich !!!

[code:1:dbf434a617]-- Tool - Copy With Rotation From North-West Quad.lua
-- Cartographer Filter
-- By Alain

for y = 0, 127 do
for x = 0, 127 do
setpoint(255 - y, x, getpoint(x, y))
setpoint(255 - x, 255 - y, getpoint(x, y))
setpoint(y, 255 - x, getpoint(x, y))
end
end[/code:1:dbf434a617]

And to have the limits of the North-West quad :

[code:1:dbf434a617]-- Tool - North-West Quad Limits.lua
-- Cartographer Filter
-- By Alain

line(128, 0, 128, 128, 4)
line(0, 128, 128, 128, 4)
[/code:1:dbf434a617]

Draw IN this quad and to copy it in other quads with a 90° rotation, use the "Copy With Rotation From North-West Quad" tool. 8)
Jul 14, 2006 23:21
Just ask me if any1 want a ".rar" file of all the filters I posted here :)
Last edited: Jul 20, 2006 23:39 (edited 1 time)
Jul 20, 2006 23:33
4 new filters of diagonal symmetry (from every corner !). These filters ignore the diagonal axis which is already symmetric to itself. You can draw only a quad between 2 diagonal axis and a complete border, including diagonal axis, and copy/symmetry it to all the map with 2 mouse-clics only !

[code:1:296229d046]-- Tool - Symmetry 5 Diagonal SW-NE.lua
-- Cartographer Filter
-- By Alain

for y = 1, 255 do
for x = 0, y-1 do
setpoint(y, x, getpoint(x, y))
end
end[/code:1:296229d046]

[code:1:296229d046]-- Tool - Symmetry 6 Diagonal NE-SW.lua
-- Cartographer Filter
-- By Alain

for y = 0, 254 do
for x = y+1, 255 do
setpoint(y, x, getpoint(x, y))
end
end[/code:1:296229d046]

[code:1:296229d046]-- Tool - Symmetry 7 Diagonal NW-SE.lua
-- Cartographer Filter
-- By Alain

for y = 0, 254 do
for x = 0, 254-y do
setpoint(255-y, 255-x, getpoint(x, y))
end
end[/code:1:296229d046]

[code:1:296229d046]-- Tool - Symmetry 8 Diagonal SE-NW.lua
-- Cartographer Filter
-- By Alain

for y = 1, 255 do
for x = 256-y, 255 do
setpoint(255-y, 255-x, getpoint(x, y))
end
end[/code:1:296229d046]

Bonus one : build perfect random stars with this one (or custom stars if you change the random values to your own : branch_nb, dim_int, dim_ext. Don’t change anything else !). It’s better to start using it on a new map. It automatically draws a “quad” of star and copy/symmetry it on the other quads to make it perfectly symmetric around the 127,127 point. (I can’t fix it perfectly symmetric by mathematic drawing only… Limits of LUA code ???) The random is not so “random”, then if a star is not nice, use the “UNDO” button and use the filter again… Then you can cumulate some stars and fill the spaces made into the branchs with diferent terrains types and symmetry : nice maps in view ! Try it now !!!

[code:1:296229d046]-- Shape - Random Star.lua
-- Cartographer Filter
-- By Alain

branch_nb = math.random(2, 8) * 2
dim_max = 25
dim_int = math.random(1, dim_max)
dim_ext = math.random(dim_int, dim_max * 2)

for a = 0, branch_nb / 4 do

x1 = 127 - math.sin(math.pi * 2 / branch_nb * a) * dim_ext
y1 = 127 - math.cos(math.pi * 2 / branch_nb * a) * dim_ext
x2 = 127 - math.sin(math.pi * 2 / branch_nb * (a + 0.5)) * dim_int
y2 = 127 - math.cos(math.pi * 2 / branch_nb * (a + 0.5)) * dim_int
x3 = 127 - math.sin(math.pi * 2 / branch_nb * (a + 1)) * dim_ext
y3 = 127 - math.cos(math.pi * 2 / branch_nb * (a + 1)) * dim_ext

line(x1, y1, x2, y2, 4)
line(x2, y2, x3, y3, 4)

end

for y = 0, 255 do
for x = 0, 126 do
setpoint(254-x, y, getpoint(x, y))
end
end

for y = 0, 126 do
for x = 0, 255 do
setpoint(x, 254-y, getpoint(x, y))
end
end[/code:1:296229d046]

:) Just ask me by email to get all my filters in a ".rar" file in return :)
Jul 21, 2006 01:19
Alain, you're awesome. That helps so much.

By the way, if you hang on the Cntrl+F key after you've selected "random star," you get some interesting results. Especially if you change the terrain each time.
Jul 21, 2006 23:28
Yes, there's many options with this filter "Shape - Random Star" to get awesome drawings. Like I said, you can play with the values (create a "Shape - Random Star Custom" filter), only keep the best stars, or the ones with a certain number of branchs, fill some parts, change terrains............
And many other things to get infinite perfectly symmetrical maps !
Jul 31, 2006 16:08
You can, now, download my complete collection of filters on my "Alain's WinBolo Micro-Site" here

I will add in this archive every new filter I will post here.

Please have a look at it :D
Jul 31, 2006 22:13
Alain, you might want to put a link to that site in your signature.
Aug 01, 2006 10:49
Good idea Nova, thanks 8)

--------------------------------
Alain's WinBolo Micro-Site
Feb 06, 2009 10:48
Something was broken on the site, I fixed it :)