마인크래프트의 Dynmap 플러그인으로 생성된 웹 지도 서버에서 타일을 다운로드하고 인쇄에 적합한 매우 높은 해상도의 단일 이미지를 제작할 수 있는 Python 2.7, 3.3+ 및 PyPy 명령줄 스크립트이다.
모든 매개 변수 보기:
$ dynmap-timemachine.py -h usage: dynmap-timemachine.py [-h] [--list-worlds] [--list-maps] [-t [THRESHOLD]] [-q] [-v] base_url [world] [map] [center] [boundary_size] [zoom] [dest] positional arguments: base_url Dynamp server URL world world name, use --list-worlds to list available worlds map map name, use --list-maps to list available maps center minecraft cooridnates, use format: [x,y,z] boundary_size size in tiles, use format: [h,v] zoom zoom level, 0 = maximum zoom dest output file name or directory optional arguments: -h, --help show this help message and exit --list-worlds list available worlds from this Dynmap server and exit --list-maps list available maps for this world and exit -t [THRESHOLD], --threshold [THRESHOLD] threshold for timelapse images -q, --quiet -v, --verbose
설치
pip
를 사용하면 쉽고 간편합니다.
$ pip install dynmap_timemachine
$ pip3 install dynmap_timemachine
- python3
사용
다음은 플레이시티 블록에서 사용하는 설정입니다. 이를 참고하여 사용해주세요. 제작 방식의 문제로 이미지 제작에 시간이 다소 소요될 수 있습니다.
1:1 지도란, dynmap-timemachine.py 스크립트를 사용했을 때 1px = 1블록에 대응되는 이미지를 의미합니다.
주간 업데이트 그룹
- 자유섬 1:1 추적 지도
dynmap-timemachine.py http://map.throgo.com block16 flat [-17320,64,4572] [22,22] 2 block16-freee-230520.png
- 자유섬 1:1 추적 지도 입체
dynmap-timemachine.py http://localhost:8120 block16 surface [-17320,64,4572] [29,15] 2 block16-freee3d-240313.png
- 서버 전체 지도
dynmap-timemachine.py http://map.throgo.com block16 flat [0,64,480] [64,64] 4 block16-all2-240313.png
도시 별 1:1 지도 및 기준 좌표
아래 명령어는 5월 기준으로 최신 명령어와 다소 일치하지 않을 수 있습니다.
- 좌표 변환 방법론
- 극점 좌표
최북단 (최대 y 값): y 좌표 중 가장 큰 값 최서단 (최소 x 값): x 좌표 중 가장 작은 값 최동단 (최대 x 값): x 좌표 중 가장 큰 값 최남단 (최소 y 값): y 좌표 중 가장 작은 값
- 중앙값 계산 및 128의 배수로 조정
중앙값을 계산하고 이를 128의 배수로 가장 가까운 값으로 조정합니다.
x 중앙값: (최서단 + 최동단) / 2 → 가장 가까운 128의 배수로 반올림 y 중앙값: (최북단 + 최남단) / 2 → 가장 가까운 128의 배수로 반올림
- 거리 정보 계산
동서 및 남북 길이를 128으로 나누고, 소수점은 올림하여 거리 정보를 구합니다.
동서 길이 (a): ceil((최동단 - 최서단) / 128) 남북 길이 (b): ceil((최북단 - 최남단) / 128)
- 최종 좌표 및 거리 정보 포맷팅
좌표 형식: [x,64,y] x: 중앙값으로 조정된 x 좌표 y: 중앙값으로 조정된 y 좌표 거리 정보 형식: [a,b] a: 동서 길이 정보 b: 남북 길이 정보
컴퓨터 성능은 조금이라도 절약할 수록 이득이니까, 효율적인 좌표를 자동으로 계산해주는 python 스크립트
import math
def round_to_128n_minus1(x_target):
# x_target ≈ 128n -1 → (x_target+1)/128 ≈ n
n_float = (x_target + 1) / 128.0
n_int = round(n_float)
return 128*n_int - 1
def round_to_128n(x_target):
n_float = x_target / 128.0
n_int = round(n_float)
return 128*n_int
def round_to_128n_minus32(y_target):
n_float = (y_target + 32) / 128.0
n_int = round(n_float)
return 128*n_int - 32
def round_to_128n_minus33(y_target):
n_float = (y_target + 33) / 128.0
n_int = round(n_float)
return 128*n_int - 33
def compute_min_radius(cx, cy, xs, ys):
x_min, x_max = min(xs), max(xs)
y_min, y_max = min(ys), max(ys)
a_min_1 = ((cx - 64) - x_min)/128.0
a_min_2 = (x_max - (cx + 63))/128.0
a_candidate = max(0, a_min_1, a_min_2)
a = math.ceil(a_candidate)
b_min_1 = ((cy - 64) - y_min)/128.0
b_min_2 = (y_max - (cy + 63))/128.0
b_candidate = max(0, b_min_1, b_min_2)
b = math.ceil(b_candidate)
return a, b
def find_tiles_to_render(coords):
xs = [p[0] for p in coords]
ys = [p[1] for p in coords]
x_min, x_max = min(xs), max(xs)
y_min, y_max = min(ys), max(ys)
x_guess = 0.5*(x_min + x_max)
if x_min >= 1:
cx_1step = round_to_128n_minus1(x_guess)
elif x_max <= 0:
cx_1step = round_to_128n(x_guess)
else:
if x_guess >= 1:
cx_1step = round_to_128n_minus1(x_guess)
else:
cx_1step = round_to_128n(x_guess)
y_guess = 0.5*(y_min + y_max)
if y_min >= 1:
cy_1step = round_to_128n_minus33(y_guess)
elif y_max <= 0:
cy_1step = round_to_128n_minus32(y_guess)
else:
if y_guess >= 1:
cy_1step = round_to_128n_minus33(y_guess)
else:
cy_1step = round_to_128n_minus32(y_guess)
a, b = compute_min_radius(cx_1step, cy_1step, xs, ys)
cx_final = cx_1step
if x_max <= 0:
cx_final = cx_1step - 1
cy_final = cy_1step
if y_max <= 0:
cy_final = cy_1step - 1
return f"dynmap-timemachine.py http://localhost:8120 block16 flat [{cx_final},64,{cy_final}] [{a},{b}] 2 dynmap-timemachine/flat-land-pro/block16-cityname-flat-land-20250101.png"
- 테스트 코드
if __name__ == "__main__":
# 예제 1) x>0, y<0
coords1 = [(-14016, 16542), (-22496, 21452), (576, 25915), (-896, 30778)]
result1 = find_tiles_to_render(coords1)
print("Example 1:", result1)
# 올바른 값: [895,64,-1441] [3,3]
# 예제 2) x<0, y>0
coords2 = [(15072, 16438), (8416, 20853), (20304, 17398), (15888, 28915)]
result2 = find_tiles_to_render(coords2)
print("Example 2:", result2)
# 올바른 값: [-129,64,351] [1,1]
청라특별시, 평천군, 북청군
dynmap-timemachine.py http://mc.throgo.com:8120 block16 flat [-1000,64,2000] [20,39] 2 block16-cheongna-240501.png
dynmap-timemachine.py http://localhost:8120 block16 flat [5555,64,432] [29,21] 2 block16-pyeongcheon-240501.png
dynmap-timemachine.py http://localhost:8120 block16 flat [-4256,64,-3120] [20,18] 2 block16-bukcheong-240501.png
남해도
dynmap-timemachine.py http://mc.throgo.com:8120 block16 flat [15872,64,22656] [60,51] 2 block16-geumil-231001.png
dynmap-timemachine.py http://mc.throgo.com:8120 block16 flat [-512,64,19072] [42,54] 2 block16-sinnae-231001.png
dynmap-timemachine.py http://mc.throgo.com:8120 block16 flat [-8060,64,10024] [70,62] 2 block16-jisan-231001.png
dynmap-timemachine.py http://mc.throgo.com:8120 block16 flat [-4096,64,19456] [24,20] 2 block16-naeso-231001.png
청산도
dynmap-timemachine.py http://mc.throgo.com:8120 block16 flat [890,64,-1564] [4,4] 2 block16-dudo-231001.png
dynmap-timemachine.py http://mc.throgo.com:8120 block16 flat [4760,64,-3145] [27,10] 2 block16-seomyeon-231001.png
dynmap-timemachine.py http://mc.throgo.com:8120 block16 flat [19584,64,7808] [39,27] 2 block16-gamcheon-231001.png
dynmap-timemachine.py http://mc.throgo.com:8120 block16 flat [10690,64,630] [24,32] 2 block16-dongnim-231001.png
dynmap-timemachine.py http://mc.throgo.com:8120 block16 flat [3060,64,-7000] [26,24] 2 block16-deuran-231001.png
dynmap-timemachine.py http://mc.throgo.com:8120 block16 flat [14848,64,-6912] [40,24] 2 block16-mirinae-231001.png
dynmap-timemachine.py http://localhost:8120 block16 flat [29952,64,3200] [48,61] 2 block16-sanju-240501.png
dynmap-timemachine.py http://mc.throgo.com:8120 block16 flat [20992,64,-19072] [52,53] 2 block16-seongan-231001.png
dynmap-timemachine.py http://mc.throgo.com:8120 block16 flat [23936,64,-3456] [63,47] 2 block16-sinhyeon-231001.png
dynmap-timemachine.py http://mc.throgo.com:8120 block16 flat [14325,64,-2580] [34,25] 2 block16-simyang-231001.png
dynmap-timemachine.py http://mc.throgo.com:8120 block16 flat [17920,64,12288] [24,22] 2 block16-yangjeong-231001.png
dynmap-timemachine.py http://mc.throgo.com:8120 block16 flat [12285,64,7208] [34,35] 2 block16-yeomyeong-231001.png
dynmap-timemachine.py http://mc.throgo.com:8120 block16 flat [8275,64,-5714] [30,40] 2 block16-ocheon-231001.png
dynmap-timemachine.py http://mc.throgo.com:8120 block16 flat [20992,64,-9344] [48,31] 2 block16-wolsan-231001.png
dynmap-timemachine.py http://mc.throgo.com:8120 block16 flat [6912,64,4096] [25,30] 2 block16-eunsan-231001.png
dynmap-timemachine.py http://mc.throgo.com:8120 block16 flat [19712,64,2176] [62,31] 2 block16-hwamyeong-231001.png
해강도
dynmap-timemachine.py http://mc.throgo.com:8120 block16 flat [-10628,64,-5860] [39,29] 2 block16-gyeongcheon-231001.png
dynmap-timemachine.py http://mc.throgo.com:8120 block16 flat [-1536,64,-19328] [42,47] 2 block16-dasan-231001.png
dynmap-timemachine.py http://mc.throgo.com:8120 block16 flat [-10304,64,-19968] [38,42] 2 block16-daol-231001.png
dynmap-timemachine.py http://mc.throgo.com:8120 block16 flat [-3968,64,-6272] [37,35] 2 block16-mangwon-231001.png
dynmap-timemachine.py http://mc.throgo.com:8120 block16 flat [-18048,64,-20736] [45,54] 2 block16-yeosan-231001.png
dynmap-timemachine.py http://mc.throgo.com:8120 block16 flat [-2304,64,-13440] [32,35] 2 block16-onju-231001.png
dynmap-timemachine.py http://mc.throgo.com:8120 block16 flat [-20224,64,-15104] [26,36] 2 block16-toegyeryeong-231001.png
dynmap-timemachine.py http://mc.throgo.com:8120 block16 flat [-15821,64,-4146] [36,40] 2 block16-hagu-231001.png
dynmap-timemachine.py http://mc.throgo.com:8120 block16 flat [-14788,64,-10332] [67,39] 2 block16-hanbat-231001.png
dynmap-timemachine.py http://mc.throgo.com:8120 block16 flat [7424,64,-17408] [60,68] 2 block16-hamhak-231001.png
dynmap-timemachine.py http://mc.throgo.com:8120 block16 flat [14080,64,-13824] [38,36] 2 block16-hyeonyang-231001.png
dynmap-timemachine.py http://mc.throgo.com:8120 block16 flat [-9344,64,-15104] [41,44] 2 block16-dongmyeong-231001.png
염안도
dynmap-timemachine.py http://mc.throgo.com:8120 block16 flat [4736,64,-27904] [37,32] 2 block16-songju-231001.png
미등록
dynmap-timemachine.py http://mc.throgo.com:8120 block16 flat [11392,64,15616] [23,24] 2 block16-samdo-230801.png
dynmap-timemachine.py http://mc.throgo.com:8120 block16 flat [-24960,64,-27264] [55,37] 2 block16-gangju-230801.png
dynmap-timemachine.py http://mc.throgo.com:8120 block16 flat [-13696,64,-27520] [51,35] 2 block16-gosan-230801.png
dynmap-timemachine.py http://mc.throgo.com:8120 block16 flat [-26752,64,-13440] [31,91] 2 block16-gyopo-230801.png
dynmap-timemachine.py http://mc.throgo.com:8120 block16 flat [-5632,64,-26880] [60,40] 2 block16-jocheon-230801.png