마인크래프트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"

  1. 테스트 코드

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

남해도

청산도

해강도

염안도

미등록