aboutsummaryrefslogtreecommitdiff
path: root/mapGen
diff options
context:
space:
mode:
authorInigoGutierrez <inigogf.95@gmail.com>2020-05-17 21:05:36 +0200
committerInigoGutierrez <inigogf.95@gmail.com>2020-05-17 21:05:36 +0200
commitdffcc04d93ea8aa1331f8bb3dbb97875f84e0926 (patch)
tree51a9fb7be677bdb75f8da65a1ea84183c7432e43 /mapGen
parent4e7cf6c285f1e932a04e16cf144917333b78e579 (diff)
downloadscripts-dffcc04d93ea8aa1331f8bb3dbb97875f84e0926.tar.gz
scripts-dffcc04d93ea8aa1331f8bb3dbb97875f84e0926.zip
Organized mapGen.sh
Diffstat (limited to 'mapGen')
-rw-r--r--mapGen/README.md89
-rw-r--r--mapGen/bicolor/Cchamber.jpg (renamed from mapGen/tiles/Cchamber.jpg)bin1278 -> 1278 bytes
-rw-r--r--mapGen/bicolor/Ddoor.jpg (renamed from mapGen/tiles/Ddoor.jpg)bin1282 -> 1282 bytes
-rw-r--r--mapGen/bicolor/Ggrass.jpg (renamed from mapGen/tiles/Ggrass.jpg)bin1275 -> 1275 bytes
-rw-r--r--mapGen/bicolor/Ppassage.jpg (renamed from mapGen/tiles/Ppassage.jpg)bin1286 -> 1286 bytes
-rw-r--r--mapGen/bicolor/SsecretDoor.jpg (renamed from mapGen/tiles/SsecretDoor.jpg)bin1280 -> 1280 bytes
-rw-r--r--mapGen/bicolor/Xwall-01.jpg (renamed from mapGen/tiles/Xwall.jpg)bin1267 -> 1267 bytes
-rw-r--r--mapGen/bicolor/Xwall-02.jpgbin0 -> 1274 bytes
-rw-r--r--mapGen/bicolor/Xwall-03.jpgbin0 -> 1272 bytes
-rw-r--r--mapGen/bicolor/Xwall-04.jpgbin0 -> 1264 bytes
-rw-r--r--mapGen/bicolor/Xwall-05.jpgbin0 -> 1256 bytes
-rw-r--r--mapGen/bicolor/Xwall-06.jpgbin0 -> 1267 bytes
-rw-r--r--mapGen/bicolor/ofloor-01.jpg (renamed from mapGen/tiles/ofloor.jpg)bin1263 -> 1263 bytes
-rw-r--r--mapGen/bicolor/ofloor-02.jpgbin0 -> 1259 bytes
-rw-r--r--mapGen/bicolor/ofloor-03.jpgbin0 -> 1262 bytes
-rw-r--r--mapGen/bicolor/ofloor-04.jpgbin0 -> 1270 bytes
-rw-r--r--mapGen/bicolor/ofloor-05.jpgbin0 -> 1267 bytes
-rw-r--r--mapGen/bicolor/ofloor-06.jpgbin0 -> 1270 bytes
-rw-r--r--mapGen/bicolor/xwall-01.jpgbin0 -> 1267 bytes
-rw-r--r--mapGen/bigmap.dg55
-rw-r--r--mapGen/chamber.xcfbin777 -> 0 bytes
-rw-r--r--mapGen/dg/Cfloor.pngbin0 -> 598 bytes
-rw-r--r--mapGen/dg/Xbricks-01.pngbin0 -> 577 bytes
-rw-r--r--mapGen/dg/Xbricks-02.pngbin0 -> 581 bytes
-rw-r--r--mapGen/dg/Xbricks-03.pngbin0 -> 585 bytes
-rw-r--r--mapGen/dg/ofloor-01a.pngbin0 -> 564 bytes
-rw-r--r--mapGen/dg/ofloor-01b.pngbin0 -> 564 bytes
-rw-r--r--mapGen/dg/ofloor-01c.pngbin0 -> 564 bytes
-rw-r--r--mapGen/dg/ofloor-01d.pngbin0 -> 564 bytes
-rw-r--r--mapGen/dg/ofloor-01e.pngbin0 -> 564 bytes
-rw-r--r--mapGen/dg/ofloor-01f.pngbin0 -> 564 bytes
-rw-r--r--mapGen/dg/ofloor-02.pngbin0 -> 567 bytes
-rw-r--r--mapGen/dg/ofloor-03.pngbin0 -> 583 bytes
-rw-r--r--mapGen/dg/ofloor-04.pngbin0 -> 594 bytes
-rw-r--r--mapGen/dg/ofloor-05.pngbin0 -> 589 bytes
-rw-r--r--mapGen/dg/ofloor-06.pngbin0 -> 577 bytes
-rw-r--r--mapGen/door.xcfbin804 -> 0 bytes
-rw-r--r--mapGen/examples/cave.jpgbin0 -> 15709 bytes
-rw-r--r--mapGen/examples/caveBig.jpgbin0 -> 53939 bytes
-rw-r--r--mapGen/examples/map.dg (renamed from mapGen/map.dg)4
-rw-r--r--mapGen/examples/randomMap.dg (renamed from mapGen/randomMap.dg)0
-rw-r--r--mapGen/examples/simple.jpgbin0 -> 1145 bytes
-rw-r--r--mapGen/examples/simpleBig.jpgbin0 -> 3360 bytes
-rw-r--r--mapGen/examples/tiledDungeon.jpgbin0 -> 37348 bytes
-rw-r--r--mapGen/examples/tiledDungeonBig.jpgbin0 -> 123621 bytes
-rw-r--r--mapGen/floor.xcfbin723 -> 0 bytes
-rw-r--r--mapGen/grass.xcfbin801 -> 0 bytes
-rw-r--r--mapGen/greenBlueRedOut.jpgbin16272 -> 0 bytes
-rwxr-xr-xmapGen/mapGen.sh28
-rw-r--r--mapGen/mapOut.jpgbin263440 -> 0 bytes
-rw-r--r--mapGen/out.jpgbin15478 -> 0 bytes
-rw-r--r--mapGen/passage.xcfbin795 -> 0 bytes
-rw-r--r--mapGen/secretDoor.xcfbin801 -> 0 bytes
-rw-r--r--mapGen/wall.xcfbin768 -> 0 bytes
54 files changed, 117 insertions, 59 deletions
diff --git a/mapGen/README.md b/mapGen/README.md
new file mode 100644
index 0000000..66e3363
--- /dev/null
+++ b/mapGen/README.md
@@ -0,0 +1,89 @@
+# mapGen.sh
+
+A shellscript to make grid maps from text files
+
+![Simple map example](examples/simpleBig.jpg)
+
+```
+xxxxx
+xGGxx
+xxooG
+xxGox
+xxxxx
+```
+
+## Dependencies
+
+- A POSIX-compliant shell (`bash`, `dash`, `sh`)
+- ImageMagick
+- Tools expected in a Unix environment: `grep`, `sed`, `awk`
+
+## Motivation
+
+The want for Vim to be a map maker.
+
+## Concept
+
+Given a text file in which each character represents a cell, have a script draw that map.
+
+`mapGen.sh` takes as input a text file with a block of text which ideally has a block of characters
+with no missing ones. It also takes a folder in which tile images are supposed to be. For each
+character in the file, it randomly takes one image in that folder which name starts with that
+characters and creates an image from the text file.
+
+## Examples
+
+![Cave dungeon example](examples/caveBig.jpg)
+
+![Tiled dungeon example](examples/tiledDungeonBig.jpg)
+
+Both images obtained from the same input:
+
+```
+XXXXXXXXXXXXXXXXXXXX
+XXXXXXooooooooXXXXXX
+XXXXXXoooooooooXXXXX
+XXXXXXooooooooooooXX
+XXXXCDooooooooooooDX
+XXXXXXooooooooooooXX
+XXXXXXooooooooooooXX
+XXXXXXoooooooooXXXXX
+XXXXXXooooooooXXXXXX
+XXXXXXXXXSXXXXXXXXXX
+XXXXXXXXooooXXXXXXXX
+XXXXXXXooooooXXXXXXX
+XXXXXXooooooooXXXXXX
+XooooXoooCooooXooooX
+XoCooXooooooooXooooX
+XooooXooooooooXooooX
+XooooXXooooooXXooooX
+XooooXXXooooXXXooooX
+XooooXXXXooXXXXooooX
+XXXoXXXXXooXXXXXooXX
+XXXoXXXXooooXXXXooXX
+XXXoooooooooooooooXX
+XXXXXXooooooooooooXX
+XXXXXXXXooooXXXXXXXX
+XXXXXXXXXooXXXXXXXXX
+XXXXXXXXXooXXXXXXXXX
+```
+
+## Usage
+
+```
+mapGen.sh [-s SIZE] [-f TILE_FOLDER] SOURCE_FILE
+```
+
+Where `SIZE` is the size of the tile images in pixels (default 8), `TILE_FOLDER` is the folder
+where the tile images are stored (default `./tiles`) and `SOURCE_FILE` is the text file with the
+layout of the map.
+
+## Possibilities
+
+The direct mapping of characters in text file to beginning of tile image name gives flexibility to
+either choose characters easy to read on the file or to use characters directly taken from the
+image names for easier memorization. Either way, the "configuration" of the relationship is
+trivial and freely customizable.
+
+For the examples I used tiles of 8x8 pixels, but other styles could be attained by using bigger
+ones.
diff --git a/mapGen/tiles/Cchamber.jpg b/mapGen/bicolor/Cchamber.jpg
index a325761..a325761 100644
--- a/mapGen/tiles/Cchamber.jpg
+++ b/mapGen/bicolor/Cchamber.jpg
Binary files differ
diff --git a/mapGen/tiles/Ddoor.jpg b/mapGen/bicolor/Ddoor.jpg
index 167a16d..167a16d 100644
--- a/mapGen/tiles/Ddoor.jpg
+++ b/mapGen/bicolor/Ddoor.jpg
Binary files differ
diff --git a/mapGen/tiles/Ggrass.jpg b/mapGen/bicolor/Ggrass.jpg
index a3f79e6..a3f79e6 100644
--- a/mapGen/tiles/Ggrass.jpg
+++ b/mapGen/bicolor/Ggrass.jpg
Binary files differ
diff --git a/mapGen/tiles/Ppassage.jpg b/mapGen/bicolor/Ppassage.jpg
index d21a0e9..d21a0e9 100644
--- a/mapGen/tiles/Ppassage.jpg
+++ b/mapGen/bicolor/Ppassage.jpg
Binary files differ
diff --git a/mapGen/tiles/SsecretDoor.jpg b/mapGen/bicolor/SsecretDoor.jpg
index ee974fa..ee974fa 100644
--- a/mapGen/tiles/SsecretDoor.jpg
+++ b/mapGen/bicolor/SsecretDoor.jpg
Binary files differ
diff --git a/mapGen/tiles/Xwall.jpg b/mapGen/bicolor/Xwall-01.jpg
index 7d70085..7d70085 100644
--- a/mapGen/tiles/Xwall.jpg
+++ b/mapGen/bicolor/Xwall-01.jpg
Binary files differ
diff --git a/mapGen/bicolor/Xwall-02.jpg b/mapGen/bicolor/Xwall-02.jpg
new file mode 100644
index 0000000..e67903e
--- /dev/null
+++ b/mapGen/bicolor/Xwall-02.jpg
Binary files differ
diff --git a/mapGen/bicolor/Xwall-03.jpg b/mapGen/bicolor/Xwall-03.jpg
new file mode 100644
index 0000000..2eefc61
--- /dev/null
+++ b/mapGen/bicolor/Xwall-03.jpg
Binary files differ
diff --git a/mapGen/bicolor/Xwall-04.jpg b/mapGen/bicolor/Xwall-04.jpg
new file mode 100644
index 0000000..816bba1
--- /dev/null
+++ b/mapGen/bicolor/Xwall-04.jpg
Binary files differ
diff --git a/mapGen/bicolor/Xwall-05.jpg b/mapGen/bicolor/Xwall-05.jpg
new file mode 100644
index 0000000..0c3f46f
--- /dev/null
+++ b/mapGen/bicolor/Xwall-05.jpg
Binary files differ
diff --git a/mapGen/bicolor/Xwall-06.jpg b/mapGen/bicolor/Xwall-06.jpg
new file mode 100644
index 0000000..220b228
--- /dev/null
+++ b/mapGen/bicolor/Xwall-06.jpg
Binary files differ
diff --git a/mapGen/tiles/ofloor.jpg b/mapGen/bicolor/ofloor-01.jpg
index d79d794..d79d794 100644
--- a/mapGen/tiles/ofloor.jpg
+++ b/mapGen/bicolor/ofloor-01.jpg
Binary files differ
diff --git a/mapGen/bicolor/ofloor-02.jpg b/mapGen/bicolor/ofloor-02.jpg
new file mode 100644
index 0000000..18c8dc1
--- /dev/null
+++ b/mapGen/bicolor/ofloor-02.jpg
Binary files differ
diff --git a/mapGen/bicolor/ofloor-03.jpg b/mapGen/bicolor/ofloor-03.jpg
new file mode 100644
index 0000000..5fca9da
--- /dev/null
+++ b/mapGen/bicolor/ofloor-03.jpg
Binary files differ
diff --git a/mapGen/bicolor/ofloor-04.jpg b/mapGen/bicolor/ofloor-04.jpg
new file mode 100644
index 0000000..2c5923b
--- /dev/null
+++ b/mapGen/bicolor/ofloor-04.jpg
Binary files differ
diff --git a/mapGen/bicolor/ofloor-05.jpg b/mapGen/bicolor/ofloor-05.jpg
new file mode 100644
index 0000000..981a8be
--- /dev/null
+++ b/mapGen/bicolor/ofloor-05.jpg
Binary files differ
diff --git a/mapGen/bicolor/ofloor-06.jpg b/mapGen/bicolor/ofloor-06.jpg
new file mode 100644
index 0000000..d463804
--- /dev/null
+++ b/mapGen/bicolor/ofloor-06.jpg
Binary files differ
diff --git a/mapGen/bicolor/xwall-01.jpg b/mapGen/bicolor/xwall-01.jpg
new file mode 100644
index 0000000..7d70085
--- /dev/null
+++ b/mapGen/bicolor/xwall-01.jpg
Binary files differ
diff --git a/mapGen/bigmap.dg b/mapGen/bigmap.dg
deleted file mode 100644
index 26f5289..0000000
--- a/mapGen/bigmap.dg
+++ /dev/null
@@ -1,55 +0,0 @@
-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-
-xGGxxxGGxxxGGxxxGGxxxGGxxxGGxxxGGxxxGGxxxGGxxxGGxxxGGxxxGGxxxGGxxxGGxxxGGxx
-xxGGGxxGGGxxGGGxxGGGxxGGGxxGGGxx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f
+++ /dev/null
Binary files differ
diff --git a/mapGen/dg/Cfloor.png b/mapGen/dg/Cfloor.png
new file mode 100644
index 0000000..8e1d600
--- /dev/null
+++ b/mapGen/dg/Cfloor.png
Binary files differ
diff --git a/mapGen/dg/Xbricks-01.png b/mapGen/dg/Xbricks-01.png
new file mode 100644
index 0000000..32faade
--- /dev/null
+++ b/mapGen/dg/Xbricks-01.png
Binary files differ
diff --git a/mapGen/dg/Xbricks-02.png b/mapGen/dg/Xbricks-02.png
new file mode 100644
index 0000000..6918a89
--- /dev/null
+++ b/mapGen/dg/Xbricks-02.png
Binary files differ
diff --git a/mapGen/dg/Xbricks-03.png b/mapGen/dg/Xbricks-03.png
new file mode 100644
index 0000000..ae258be
--- /dev/null
+++ b/mapGen/dg/Xbricks-03.png
Binary files differ
diff --git a/mapGen/dg/ofloor-01a.png b/mapGen/dg/ofloor-01a.png
new file mode 100644
index 0000000..b6b44f4
--- /dev/null
+++ b/mapGen/dg/ofloor-01a.png
Binary files differ
diff --git a/mapGen/dg/ofloor-01b.png b/mapGen/dg/ofloor-01b.png
new file mode 100644
index 0000000..b6b44f4
--- /dev/null
+++ b/mapGen/dg/ofloor-01b.png
Binary files differ
diff --git a/mapGen/dg/ofloor-01c.png b/mapGen/dg/ofloor-01c.png
new file mode 100644
index 0000000..b6b44f4
--- /dev/null
+++ b/mapGen/dg/ofloor-01c.png
Binary files differ
diff --git a/mapGen/dg/ofloor-01d.png b/mapGen/dg/ofloor-01d.png
new file mode 100644
index 0000000..b6b44f4
--- /dev/null
+++ b/mapGen/dg/ofloor-01d.png
Binary files differ
diff --git a/mapGen/dg/ofloor-01e.png b/mapGen/dg/ofloor-01e.png
new file mode 100644
index 0000000..b6b44f4
--- /dev/null
+++ b/mapGen/dg/ofloor-01e.png
Binary files differ
diff --git a/mapGen/dg/ofloor-01f.png b/mapGen/dg/ofloor-01f.png
new file mode 100644
index 0000000..b6b44f4
--- /dev/null
+++ b/mapGen/dg/ofloor-01f.png
Binary files differ
diff --git a/mapGen/dg/ofloor-02.png b/mapGen/dg/ofloor-02.png
new file mode 100644
index 0000000..74f153a
--- /dev/null
+++ b/mapGen/dg/ofloor-02.png
Binary files differ
diff --git a/mapGen/dg/ofloor-03.png b/mapGen/dg/ofloor-03.png
new file mode 100644
index 0000000..c513efb
--- /dev/null
+++ b/mapGen/dg/ofloor-03.png
Binary files differ
diff --git a/mapGen/dg/ofloor-04.png b/mapGen/dg/ofloor-04.png
new file mode 100644
index 0000000..c1303b4
--- /dev/null
+++ b/mapGen/dg/ofloor-04.png
Binary files differ
diff --git a/mapGen/dg/ofloor-05.png b/mapGen/dg/ofloor-05.png
new file mode 100644
index 0000000..0af94be
--- /dev/null
+++ b/mapGen/dg/ofloor-05.png
Binary files differ
diff --git a/mapGen/dg/ofloor-06.png b/mapGen/dg/ofloor-06.png
new file mode 100644
index 0000000..13b36d1
--- /dev/null
+++ b/mapGen/dg/ofloor-06.png
Binary files differ
diff --git a/mapGen/door.xcf b/mapGen/door.xcf
deleted file mode 100644
index fa1cc1a..0000000
--- a/mapGen/door.xcf
+++ /dev/null
Binary files differ
diff --git a/mapGen/examples/cave.jpg b/mapGen/examples/cave.jpg
new file mode 100644
index 0000000..727366e
--- /dev/null
+++ b/mapGen/examples/cave.jpg
Binary files differ
diff --git a/mapGen/examples/caveBig.jpg b/mapGen/examples/caveBig.jpg
new file mode 100644
index 0000000..802c975
--- /dev/null
+++ b/mapGen/examples/caveBig.jpg
Binary files differ
diff --git a/mapGen/map.dg b/mapGen/examples/map.dg
index 7da4706..54e3ba8 100644
--- a/mapGen/map.dg
+++ b/mapGen/examples/map.dg
@@ -1,5 +1,5 @@
xxxxx
xGGxx
-xxaaG
-xxGax
+xxooG
+xxGox
xxxxx
diff --git a/mapGen/randomMap.dg b/mapGen/examples/randomMap.dg
index 2ead560..2ead560 100644
--- a/mapGen/randomMap.dg
+++ b/mapGen/examples/randomMap.dg
diff --git a/mapGen/examples/simple.jpg b/mapGen/examples/simple.jpg
new file mode 100644
index 0000000..1f616ad
--- /dev/null
+++ b/mapGen/examples/simple.jpg
Binary files differ
diff --git a/mapGen/examples/simpleBig.jpg b/mapGen/examples/simpleBig.jpg
new file mode 100644
index 0000000..2b58279
--- /dev/null
+++ b/mapGen/examples/simpleBig.jpg
Binary files differ
diff --git a/mapGen/examples/tiledDungeon.jpg b/mapGen/examples/tiledDungeon.jpg
new file mode 100644
index 0000000..141371a
--- /dev/null
+++ b/mapGen/examples/tiledDungeon.jpg
Binary files differ
diff --git a/mapGen/examples/tiledDungeonBig.jpg b/mapGen/examples/tiledDungeonBig.jpg
new file mode 100644
index 0000000..b017888
--- /dev/null
+++ b/mapGen/examples/tiledDungeonBig.jpg
Binary files differ
diff --git a/mapGen/floor.xcf b/mapGen/floor.xcf
deleted file mode 100644
index a83e4c2..0000000
--- a/mapGen/floor.xcf
+++ /dev/null
Binary files differ
diff --git a/mapGen/grass.xcf b/mapGen/grass.xcf
deleted file mode 100644
index 3b11c90..0000000
--- a/mapGen/grass.xcf
+++ /dev/null
Binary files differ
diff --git a/mapGen/greenBlueRedOut.jpg b/mapGen/greenBlueRedOut.jpg
deleted file mode 100644
index 7448cc8..0000000
--- a/mapGen/greenBlueRedOut.jpg
+++ /dev/null
Binary files differ
diff --git a/mapGen/mapGen.sh b/mapGen/mapGen.sh
index 1be77f7..bf4bac3 100755
--- a/mapGen/mapGen.sh
+++ b/mapGen/mapGen.sh
@@ -3,13 +3,37 @@
# mapGen.sh
#
# Generate a map with ImageMagick from an input text file
+#
+# Usage: mapGen.sh [-s SIZE] [-f TILE_FOLDER] SOURCE_FILE
-inputFile="$1"
+usageMsg="Usage: mapGen.sh [-s SIZE] [-f TILE_FOLDER] SOURCE_FILE"
cellSize=8
tilesDir="./tiles"
+while echo "$1" | grep '^-' >/dev/null; do
+ case "$1" in
+ "-s")
+ [ -z "$2" ] && echo "Missing argument for -s. $usageMsg" >&2 && exit 1
+ cellSize="$2"
+ shift 2
+ ;;
+ "-f")
+ [ -z "$2" ] && echo "Missing argument for -f. $usageMsg" >&2 && exit 1
+ tilesDir="$2"
+ shift 2
+ ;;
+ esac
+done
+
+[ -z "$1" ] && echo "$usageMsg" >&2 && exit 1
+
+inputFile="$1"
+
+[ ! -f "$inputFile" ] && echo "File not found: $inputFile" >&2 && exit 1
+[ ! -d "$tilesDir" ] && echo "Directory not found: $tilesDir" >&2 && exit 1
+
height="$(wc -l <"$inputFile")"
width="$(awk '{print length($0)}' "$inputFile" | sort -nr | sed 1q)"
@@ -26,7 +50,7 @@ col=0
while read line; do
echo "$line" | (
while read -n1 char; do
- tileFile="$(find $tilesDir | sed 's|.*/||' | grep "^$char")"
+ tileFile="$(find $tilesDir | sed 's|.*/||' | grep "^$char" | shuf | sed 1q)"
tileFile="${tilesDir}/${tileFile}"
echo "$tileFile" | wc -l | grep 1 >/dev/null || continue
convert out.jpg "$tileFile" -geometry +"$col"+"$row" -composite out.jpg ||
diff --git a/mapGen/mapOut.jpg b/mapGen/mapOut.jpg
deleted file mode 100644
index 7067c52..0000000
--- a/mapGen/mapOut.jpg
+++ /dev/null
Binary files differ
diff --git a/mapGen/out.jpg b/mapGen/out.jpg
deleted file mode 100644
index d4a3964..0000000
--- a/mapGen/out.jpg
+++ /dev/null
Binary files differ
diff --git a/mapGen/passage.xcf b/mapGen/passage.xcf
deleted file mode 100644
index 926783a..0000000
--- a/mapGen/passage.xcf
+++ /dev/null
Binary files differ
diff --git a/mapGen/secretDoor.xcf b/mapGen/secretDoor.xcf
deleted file mode 100644
index 6963426..0000000
--- a/mapGen/secretDoor.xcf
+++ /dev/null
Binary files differ
diff --git a/mapGen/wall.xcf b/mapGen/wall.xcf
deleted file mode 100644
index e1cc359..0000000
--- a/mapGen/wall.xcf
+++ /dev/null
Binary files differ