First attempt at creating a script for cooking assets
6
assets/levels/.gitignore
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
*.MAP
|
||||
*.LVL
|
||||
*.COL
|
||||
*.psxlvl
|
||||
**/collision16.json
|
||||
**/tilemap128.csv
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 16 KiB |
|
@ -1,64 +0,0 @@
|
|||
-1,-1,-1,-1,-1,-1,-1,-1,12,10,10,10,10,10,10,13,97,98,99,-1,-1,-1,-1,-1,32,-1,-1,-1,-1,-1,-1,-1
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,12,10,10,10,10,10,10,13,10,107,113,114,115,-1,-1,-1,34,-1,-1,-1,-1,-1,-1,-1
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,12,10,10,10,10,10,10,13,10,10,10,10,10,2,2,2,36,32,-1,-1,-1,-1,-1,-1
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,12,10,10,10,10,10,10,13,10,10,10,10,10,10,10,10,10,34,-1,-1,-1,-1,-1,-1
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,12,10,10,10,10,10,10,13,10,10,10,10,10,10,10,10,10,36,32,-1,-1,-1,-1,-1
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,12,10,10,10,10,10,10,13,10,10,10,10,10,10,10,10,10,10,34,-1,-1,-1,-1,-1
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,12,10,10,10,10,10,10,13,10,10,10,10,10,10,10,10,10,10,36,32,-1,-1,-1,-1
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,12,10,10,10,10,10,10,13,10,10,10,10,10,10,10,10,10,10,10,34,-1,-1,-1,-1
|
||||
28,-1,-1,-1,-1,-1,-1,-1,24,25,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,262,263,264,-1,-1,-1,-1,-1
|
||||
10,28,-1,-1,-1,-1,-1,-1,10,22,24,25,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,10,267,268,-1,-1,-1,-1
|
||||
10,36,28,-1,-1,-1,-1,-1,10,10,10,22,24,25,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,10,10,267,25,-1,-1,-1
|
||||
10,10,36,28,-1,-1,-1,-1,10,10,10,10,10,22,24,25,-1,-1,-1,-1,-1,-1,-1,-1,10,10,10,10,83,84,85,86
|
||||
10,10,10,36,28,-1,-1,-1,10,10,10,10,10,10,10,10,24,25,-1,-1,-1,-1,-1,-1,10,10,10,10,10,10,10,10
|
||||
10,10,10,10,36,28,-1,-1,10,10,10,10,10,10,10,10,10,22,24,25,-1,-1,-1,-1,10,10,10,10,10,10,10,10
|
||||
10,10,10,10,10,36,28,-1,10,10,10,10,10,10,10,10,10,10,10,22,24,25,-1,-1,10,10,10,10,10,10,10,10
|
||||
10,10,10,10,10,10,36,28,10,10,10,10,10,10,10,10,10,10,10,10,10,22,24,25,10,10,10,10,10,10,10,10
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,259,260,261,-1,-1,-1,-1,-1,-1,-1,-1,2,2,2,2,2,2,2,2
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,265,266,10,10,-1,-1,-1,-1,-1,-1,-1,-1,10,10,10,10,10,10,10,10
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,26,266,10,10,10,-1,-1,-1,-1,-1,-1,-1,-1,10,10,10,10,10,10,10,10
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,89,90,91,92,10,10,10,10,-1,-1,-1,-1,-1,-1,-1,-1,10,10,10,10,10,10,10,10
|
||||
2,2,2,2,2,2,2,2,10,10,10,10,10,10,10,10,32,-1,-1,-1,-1,-1,-1,-1,10,10,10,10,10,10,10,10
|
||||
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,34,-1,-1,-1,-1,-1,-1,-1,10,10,10,10,10,10,10,10
|
||||
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,36,32,-1,-1,-1,-1,-1,-1,10,10,10,10,10,10,10,10
|
||||
10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,34,-1,-1,-1,-1,-1,-1,10,10,10,10,10,10,10,10
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,10,10,10,10,10,10,10
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,10,10,10,10,10,10,10
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,10,10,10,10,10,10,10
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,18,18,18,18,18,18,18,18
|
||||
-1,-1,-1,-1,-1,259,260,261,-1,-1,-1,-1,-1,-1,-1,33,262,263,264,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
|
||||
-1,-1,-1,-1,265,266,10,10,-1,-1,-1,-1,-1,-1,-1,35,10,10,267,268,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
|
||||
-1,-1,-1,26,266,10,10,10,-1,-1,-1,-1,-1,-1,33,10,10,10,10,267,25,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
|
||||
89,90,91,92,10,10,10,10,-1,-1,-1,-1,-1,-1,35,10,10,10,10,10,83,84,85,86,-1,-1,-1,-1,-1,-1,-1,-1
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
|
||||
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||||
2,2,2,2,2,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,2,2,2,2,10,10,10,10,10,10,10,10
|
||||
18,18,18,18,18,18,-1,-1,-1,-1,2,2,2,2,2,2,-1,-1,-1,-1,18,18,18,18,10,10,10,10,10,10,10,10
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,18,18,18,18,18,18,-1,-1,-1,-1,-1,-1,-1,-1,10,10,10,10,10,10,10,10
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,10,10,10,10,10,10,10,10
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,12,10,10,13
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,12,10,10,13
|
||||
2,2,2,2,2,2,2,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,12,10,10,13
|
||||
18,18,18,18,18,18,18,18,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,12,10,10,13
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,2,2,2,2,2,2,2,2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,12,10,10,13
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,18,18,18,18,18,18,18,18,2,2,2,2,2,2,2,2,-1,-1,-1,-1,12,10,10,13
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,18,18,18,18,18,18,18,18,-1,-1,-1,-1,12,10,10,13
|
||||
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,12,10,10,13
|
||||
12,10,10,13,-1,-1,-1,-1,-1,-1,-1,-1,12,10,10,13,12,10,10,13,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
|
||||
12,10,10,13,-1,-1,-1,-1,-1,-1,-1,-1,12,10,10,13,12,10,10,13,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
|
||||
12,10,10,13,-1,-1,-1,-1,-1,-1,-1,-1,12,10,10,13,12,10,10,13,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
|
||||
12,10,10,13,-1,-1,-1,-1,-1,-1,-1,-1,20,21,21,21,20,21,21,21,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
|
||||
12,10,10,13,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
|
||||
12,10,10,13,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
|
||||
12,10,10,13,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
|
||||
12,10,10,13,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
|
|
Before Width: | Height: | Size: 16 KiB |
34
cook.sh
Executable file
|
@ -0,0 +1,34 @@
|
|||
#!/bin/bash
|
||||
|
||||
# TODO: Install Tiled exporter as well
|
||||
|
||||
echo "Cooking 16x16 mappings..."
|
||||
for f in assets/levels/**/map16.json; do
|
||||
echo "Generating 16x16 mappings for ${f}..."
|
||||
./tools/framepacker.py --tilemap "${f}" "`dirname ${f}`/MAP16.MAP"
|
||||
done
|
||||
|
||||
echo "Cooking 16x16 collision..."
|
||||
for f in assets/levels/**/tiles16.tsx; do
|
||||
echo "Generating collision for ${f}..."
|
||||
tiled --export-tileset "${f}" "`dirname ${f}`/collision16.json"
|
||||
./tools/cookcollision.py "`dirname ${f}`/collision16.json" "`dirname ${f}`/MAP16.COL"
|
||||
rm "`dirname ${f}`/collision16.json"
|
||||
done
|
||||
|
||||
echo "Cooking 128x128 mappings..."
|
||||
for f in assets/levels/**/tilemap128.tmx; do
|
||||
echo "Generating 128x128 mappings for ${f}..."
|
||||
tiled --export-map "${f}" "${f%%.tmx}.csv"
|
||||
tmxrasterizer "${f}" "`dirname ${f}`/128.png"
|
||||
./tools/chunkgen.py "${f%%.tmx}.csv" "`dirname ${f}`/MAP128.MAP"
|
||||
rm "${f%%.tmx}.csv"
|
||||
done
|
||||
|
||||
echo "Cooking level maps..."
|
||||
for f in assets/levels/**/Z*.tmx; do
|
||||
echo "Generating PSX LVL for ${f}..."
|
||||
tiled --export-map "${f}" "${f%%.tmx}.psxlvl"
|
||||
./tools/cooklvl.py "${f%%.tmx}.psxlvl" "${f%%.tmx}.LVL"
|
||||
rm "${f%%.tmx}.psxlvl"
|
||||
done
|
|
@ -69,7 +69,7 @@ def export_binary(f, df):
|
|||
for cx in range(0, grid[0]):
|
||||
chunk = get_chunk(df, cx, cy)
|
||||
chunk_id = (cy * grid[0]) + cx
|
||||
print(f"Exporting tile {chunk_id}...")
|
||||
# print(f"Exporting tile {chunk_id}...")
|
||||
# Loop for each piece within chunk
|
||||
for py in range(0, 8):
|
||||
for px in range(0, 8):
|
||||
|
|
|
@ -206,7 +206,7 @@ def parse_json(j):
|
|||
"points": points,
|
||||
}
|
||||
)
|
||||
print(f"Number of collidable tiles: {len(res)}")
|
||||
# print(f"Number of collidable tiles: {len(res)}")
|
||||
return res
|
||||
|
||||
|
||||
|
|
|
@ -56,8 +56,8 @@ def main():
|
|||
f.write(c_ubyte(j.get("_unused")))
|
||||
layer_data = j.get("layer_data")
|
||||
for layer in layer_data:
|
||||
print(layer.get("width"))
|
||||
print(layer.get("height"))
|
||||
# print(layer.get("width"))
|
||||
# print(layer.get("height"))
|
||||
f.write(c_ubyte(layer.get("width")))
|
||||
f.write(c_ubyte(layer.get("height")))
|
||||
for tile in layer.get("tiles"):
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
# texture with 4bpp.
|
||||
import json
|
||||
import sys
|
||||
from pprint import pp as pprint
|
||||
from ctypes import c_ushort, c_ubyte
|
||||
|
||||
# Set endianness of some types to big endian
|
||||
|
|
|
@ -76,9 +76,9 @@ Extra files such as 'tiles16.tsx' will also be generated.
|
|||
* Generating 128x128 tiles and mappings
|
||||
|
||||
The following steps will allow you to generate a 'MAP128.MAP' file from a
|
||||
'map128.tmx'.
|
||||
This 'map128.tmx' tile is supposed to be a map comprised of 16x16 tiles, created
|
||||
from the same '16x16.png' file we addressed earlier.
|
||||
'tilemap128.tmx'.
|
||||
This 'tilemap128.tmx' tile is supposed to be a map comprised of 16x16 tiles,
|
||||
created from the same '16x16.png' file we addressed earlier.
|
||||
Each 128x128 tile is supposed to be equivalent to every eight rows and columns
|
||||
on the .tmx map.
|
||||
|
||||
|
@ -86,8 +86,8 @@ Please make sure that the first tile is COMPLETELY BLANK and mind the tile
|
|||
sequence (tiles are counted first from left to right, then up to down).
|
||||
|
||||
1. Create a 'tileset16.tsx' map from '16x16.png', if you haven't already.
|
||||
2. Create a 'map128.tmx' map and use 'tileset16.tsx' as tileset. This map must
|
||||
have infinite dimensions.
|
||||
2. Create a 'tilemap128.tmx' map and use 'tileset16.tsx' as tileset. This map
|
||||
must have infinite dimensions.
|
||||
3. Create your tiles from left to right, and if you must, up to down. Be mindful
|
||||
of tile order, and make sure that the first tile (first eight rows and
|
||||
columns) are completely blank.
|
||||
|
|