feat(bunsik): 직접 만든 효과음 4개, 게임 아이콘·썸네일

- tools/sfx.py: 동전·구매·확장·조리음 합성, 오디오 에셋으로 업로드(Sounds.luau)
- 구매·확장 소리는 클라이언트에서 2D로, 동전 소리는 손님 자리에서 재생
- tools/art.py: 게임 아이콘(512)과 썸네일(1920x1080) 그림 추가
- cloud.py: 오디오 업로드·에셋 상태 조회 명령, 통합 테스트에 효과음 소유 확인(526개 통과)
- DECISIONS: 에셋은 없으면 직접 만든다는 원칙과 현황

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
EJClaw
2026-10-12 01:40:00 +09:00
parent ebfe23c509
commit c7af87c646
15 changed files with 349 additions and 16 deletions

View File

@@ -1,11 +1,13 @@
#!/usr/bin/env python3
"""게임패스·개발자 상품 아이콘(512x512 PNG)을 그립니다. 외부 그림을 쓰지 않아 저작권 걱정이 없습니다.
"""게임패스·개발자 상품 아이콘(512x512), 게임 아이콘(512x512), 썸네일(1920x1080)을 그립니다.
외부 그림을 쓰지 않아 저작권 걱정이 없습니다.
python3 tools/art.py # art/*.png 생성
"""
import math
import os
import numpy as np
from PIL import Image, ImageDraw, ImageFilter, ImageFont
OUT = os.path.join(os.path.dirname(__file__), "..", "art")
@@ -76,8 +78,136 @@ def money_boost():
return img
def stall_scene(W, H, scale):
"""포장마차와 떡볶이 판 그림(W x H, 크게 그린 뒤 줄여서 부드럽게)."""
k = scale
img = Image.new("RGBA", (W, H))
d = ImageDraw.Draw(img)
# 저녁 하늘
for y in range(H):
tt = y / H
c = (int(255 * (1 - tt) + 255 * tt), int(170 * (1 - tt) + 120 * tt), int(90 * (1 - tt) + 140 * tt), 255)
d.line([(0, y), (W, y)], fill=c)
rays = Image.new("RGBA", (W, H), (0, 0, 0, 0))
rd = ImageDraw.Draw(rays)
cx, cy = W / 2, H * 0.55
for i in range(24):
a0 = i * math.pi / 12
a1 = a0 + math.pi / 24
rd.polygon([(cx, cy), (cx + 4000 * math.cos(a0), cy + 4000 * math.sin(a0)),
(cx + 4000 * math.cos(a1), cy + 4000 * math.sin(a1))], fill=(255, 255, 255, 28))
img.alpha_composite(rays)
d = ImageDraw.Draw(img)
# 바닥
d.rectangle([0, H * 0.82, W, H], fill=(120, 95, 80))
# 천막 기둥
left, right = W / 2 - 330 * k, W / 2 + 330 * k
top = H * 0.30
for x in (left + 30 * k, right - 30 * k):
d.rectangle([x - 9 * k, top, x + 9 * k, H * 0.84], fill=(180, 180, 190))
# 수레(나무)
d.rounded_rectangle([left + 10 * k, H * 0.58, right - 10 * k, H * 0.84], radius=18 * k, fill=(165, 105, 60),
outline=(110, 65, 35), width=int(8 * k))
for i in range(1, 6):
x = left + 10 * k + i * (right - left - 20 * k) / 6
d.line([(x, H * 0.60), (x, H * 0.82)], fill=(140, 85, 45), width=int(5 * k))
d.rounded_rectangle([left - 10 * k, H * 0.55, right + 10 * k, H * 0.60], radius=10 * k, fill=(215, 220, 225),
outline=(150, 150, 160), width=int(5 * k))
# 줄무늬 천막과 물결 테두리
roof = [(left - 60 * k, top + 110 * k), (W / 2, top - 40 * k), (right + 60 * k, top + 110 * k)]
d.polygon(roof, fill=(245, 110, 40), outline=(170, 60, 20))
n = 8
for i in range(n):
if i % 2 == 0:
x0 = left - 60 * k + i * (right - left + 120 * k) / n
x1 = x0 + (right - left + 120 * k) / n
d.polygon([(W / 2, top - 40 * k), (x0, top + 110 * k), (x1, top + 110 * k)], fill=(255, 235, 205))
d.line(roof + [roof[0]], fill=(170, 60, 20), width=int(8 * k), joint="curve")
sw = (right - left + 120 * k) / n
for i in range(n):
x0 = left - 60 * k + i * sw
col = (245, 110, 40) if i % 2 == 0 else (255, 235, 205)
d.pieslice([x0, top + 70 * k, x0 + sw, top + 150 * k], 0, 180, fill=col, outline=(170, 60, 20), width=int(5 * k))
# 전구
for i in range(9):
x = left - 20 * k + i * (right - left + 40 * k) / 8
d.ellipse([x - 14 * k, top + 150 * k, x + 14 * k, top + 178 * k], fill=(255, 230, 140), outline=(230, 170, 60),
width=int(3 * k))
# 큰 떡볶이 판
px, py, pr = W / 2, H * 0.60, 250 * k
d.ellipse([px - pr, py - pr * 0.42, px + pr, py + pr * 0.42], fill=(45, 45, 50))
d.ellipse([px - pr * 0.9, py - pr * 0.36, px + pr * 0.9, py + pr * 0.36], fill=(215, 45, 25))
r2 = random_state = np.random.default_rng(3) # noqa: F841
for _ in range(26):
a = r2.uniform(0, 2 * math.pi)
rr = r2.uniform(0, 0.78)
x = px + math.cos(a) * pr * 0.85 * rr
y = py + math.sin(a) * pr * 0.32 * rr
ang = r2.uniform(-0.6, 0.6)
tl, tw = 70 * k, 22 * k
pts = [(-tl / 2, -tw / 2), (tl / 2, -tw / 2), (tl / 2, tw / 2), (-tl / 2, tw / 2)]
pts = [(x + px_ * math.cos(ang) - py_ * math.sin(ang), y + px_ * math.sin(ang) + py_ * math.cos(ang))
for px_, py_ in pts]
d.polygon(pts, fill=(250, 120, 80), outline=(170, 40, 20))
d.line([pts[0], pts[1]], fill=(255, 190, 160), width=int(4 * k))
for _ in range(4):
x = px + r2.uniform(-0.6, 0.6) * pr
y = py + r2.uniform(-0.2, 0.15) * pr
d.polygon([(x - 40 * k, y + 15 * k), (x + 40 * k, y + 15 * k), (x, y - 40 * k)], fill=(240, 200, 130),
outline=(170, 120, 60))
# 김
steam = Image.new("RGBA", (W, H), (0, 0, 0, 0))
sd = ImageDraw.Draw(steam)
for j, off in enumerate((-110, 0, 110)):
pts = []
for i in range(30):
yy = py - pr * 0.4 - i * 9 * k
xx = px + off * k + math.sin(i / 4 + j) * 26 * k
pts.append((xx, yy))
sd.line(pts, fill=(255, 255, 255, 170), width=int(22 * k), joint="curve")
steam = steam.filter(ImageFilter.GaussianBlur(8 * k))
img.alpha_composite(steam)
return img
def title(img, cx, cy, size, sub=True):
d = ImageDraw.Draw(img)
outlined(d, (cx, cy), "분식 타이쿤", font(size), (255, 245, 120), (150, 40, 20), max(6, size // 10))
if sub:
outlined(d, (cx, cy + size * 0.95), "BUNSIK TYCOON", font(int(size * 0.45)), (255, 255, 255), (150, 40, 20),
max(4, size // 18))
def game_icon():
big = stall_scene(1024, 1024, 1.25)
title(big, 512, 150, 150)
img = big.resize((S, S), Image.LANCZOS)
mask = Image.new("L", (S, S), 0)
ImageDraw.Draw(mask).rounded_rectangle([0, 0, S - 1, S - 1], radius=90, fill=255)
out = Image.new("RGBA", (S, S), (0, 0, 0, 0))
out.paste(img, (0, 0), mask)
return out
def thumbnail():
big = stall_scene(1920, 1080, 1.35)
d = ImageDraw.Draw(big)
title(big, 960, 120, 130)
# 메뉴 말풍선
for (x, y, label) in [(250, 560, "떡볶이"), (1670, 560, "김밥"), (300, 860, "순대"), (1620, 860, "어묵")]:
d.rounded_rectangle([x - 150, y - 60, x + 150, y + 60], radius=40, fill=(255, 255, 255), outline=(255, 140, 60),
width=8)
d.text((x, y), label, font=font(64), fill=(200, 60, 30), anchor="mm")
outlined(d, (960, 1010), "손님을 받고 가게를 키우세요! Serve customers & grow your shop!", font(48),
(255, 255, 255), (90, 40, 20), 6)
return big.convert("RGB")
def main():
os.makedirs(OUT, exist_ok=True)
game_icon().save(os.path.join(OUT, "game_icon.png"))
thumbnail().save(os.path.join(OUT, "thumbnail_1.png"))
print(os.path.join(OUT, "game_icon.png"), os.path.join(OUT, "thumbnail_1.png"))
for name, fn in [("double_money", double_money), ("money_boost", money_boost)]:
path = os.path.join(OUT, name + ".png")
fn().save(path)

View File

@@ -5,6 +5,7 @@
python3 tools/cloud.py run script.luau [--version N] [--out file] # 기본: 가장 최근 저장 버전
python3 tools/cloud.py products # 게임패스·개발자 상품 만들기(이미 있으면 건너뜀)
python3 tools/cloud.py place # 서버 인원 6명, 설명 설정
python3 tools/cloud.py audio sfx/coin.ogg "이름" # 효과음 업로드, 에셋 ID 출력
API 키는 ~/.config/ejclaw/secrets.json 의 roblox.opencloud/bunsik-tycoon 에서 읽습니다.
"""
@@ -16,6 +17,7 @@ import urllib.error
import urllib.request
UNIVERSE = 10770390863
CREATOR_USER = 4054147118 # tkrmagid
PLACE = 98118751156219
SECRETS = os.path.expanduser("~/.config/ejclaw/secrets.json")
@@ -143,7 +145,43 @@ def place():
return request("PATCH", url, body)
def upload_audio(path, name):
meta = {
"assetType": "Audio",
"displayName": name,
"description": "Bunsik Tycoon sound effect (synthesized, original).",
"creationContext": {"creator": {"userId": str(CREATOR_USER)}},
}
boundary = "----bunsik" + str(int(time.time() * 1000))
with open(path, "rb") as f:
data = f.read()
body = (f"--{boundary}\r\nContent-Disposition: form-data; name=\"request\"\r\n"
f"Content-Type: application/json\r\n\r\n{json.dumps(meta)}\r\n").encode()
body += (f"--{boundary}\r\nContent-Disposition: form-data; name=\"fileContent\"; "
f"filename=\"{os.path.basename(path)}\"\r\nContent-Type: audio/ogg\r\n\r\n").encode()
body += data + f"\r\n--{boundary}--\r\n".encode()
op = request("POST", "https://apis.roblox.com/assets/v1/assets", body, f"multipart/form-data; boundary={boundary}")
for _ in range(60):
if op.get("done"):
break
time.sleep(3)
op = request("GET", f"https://apis.roblox.com/assets/v1/{op['path']}")
if op.get("error"):
raise SystemExit(f"업로드 실패: {op['error']}")
return op.get("response", {}).get("assetId")
def asset_status(asset_id):
return request("GET", f"https://apis.roblox.com/assets/v1/assets/{asset_id}?readMask=moderationResult,state")
def main(argv):
if argv[:1] == ["audio"]:
print(upload_audio(argv[1], argv[2]))
return 0
if argv[:1] == ["asset"]:
print(json.dumps(asset_status(argv[1]), ensure_ascii=False))
return 0
if argv[:1] == ["products"]:
print(json.dumps(products()))
return 0

122
bunsik-tycoon/tools/sfx.py Normal file
View File

@@ -0,0 +1,122 @@
#!/usr/bin/env python3
"""효과음을 직접 합성합니다(외부 음원 없음, 저작권 걱정 없음). sfx/*.ogg 로 저장합니다.
python3 tools/sfx.py
"""
import os
import subprocess
import wave
import numpy as np
SR = 44100
OUT = os.path.join(os.path.dirname(__file__), "..", "sfx")
rng = np.random.default_rng(7)
def t(sec):
return np.arange(int(SR * sec)) / SR
def env(n, attack=0.005, decay=0.3):
x = np.arange(n) / SR
a = np.clip(x / attack, 0, 1)
return a * np.exp(-x / decay)
def bell(freq, sec, decay):
x = t(sec)
# 맑은 종소리: 기본음 + 배음(조금 어긋난 비율)
s = (np.sin(2 * np.pi * freq * x) + 0.45 * np.sin(2 * np.pi * freq * 2.01 * x)
+ 0.2 * np.sin(2 * np.pi * freq * 3.03 * x))
return s * env(len(x), 0.002, decay)
def place(buf, sig, at):
i = int(at * SR)
end = min(len(buf), i + len(sig))
buf[i:end] += sig[: end - i]
def coin():
buf = np.zeros(int(SR * 0.6))
place(buf, bell(1318.5, 0.6, 0.09), 0.0) # E6
place(buf, bell(1975.5, 0.55, 0.18), 0.07) # B6
return buf
def buy():
# 도-미-솔-높은도 빠른 아르페지오 + 반짝임
buf = np.zeros(int(SR * 1.0))
for i, f in enumerate([523.25, 659.25, 783.99, 1046.5]):
place(buf, bell(f, 0.7, 0.22), i * 0.075)
sparkle = rng.standard_normal(int(SR * 0.4))
sparkle = np.convolve(sparkle, np.ones(3) / 3, "same") * env(len(sparkle), 0.01, 0.12) * 0.08
place(buf, sparkle * np.sin(2 * np.pi * 6000 * t(0.4)), 0.3)
return buf
def levelup():
# 확장 축하: 두 박자 팡파레(사각파 느낌을 배음으로)
buf = np.zeros(int(SR * 1.6))
notes = [(523.25, 0.0, 0.15), (659.25, 0.15, 0.15), (783.99, 0.3, 0.15), (1046.5, 0.45, 0.6)]
for f, at, d in notes:
x = t(d + 0.4)
s = sum(np.sin(2 * np.pi * f * k * x) / k for k in (1, 3, 5)) * 0.6
s += 0.5 * np.sin(2 * np.pi * f * 2 * x)
e = env(len(x), 0.01, 0.35 if d > 0.3 else 0.12)
place(buf, s * e, at)
return buf
def sizzle(sec=3.0):
n = int(SR * sec)
noise = rng.standard_normal(n)
# 고역 위주(지글지글): 1차 고역 통과
hp = np.empty(n)
a = 0.92
prev_x = prev_y = 0.0
for i in range(n):
y = a * (prev_y + noise[i] - prev_x)
hp[i] = y
prev_x, prev_y = noise[i], y
# 천천히 출렁이는 세기
x = t(sec)
mod = 0.55 + 0.25 * np.sin(2 * np.pi * 0.7 * x) + 0.2 * np.sin(2 * np.pi * 1.9 * x + 1)
s = hp * mod * 0.25
# 기름 튀는 소리(짧은 딱딱)
for at in rng.uniform(0, sec, 70):
click = rng.standard_normal(int(SR * 0.012)) * env(int(SR * 0.012), 0.0005, 0.003)
place(s, click * rng.uniform(0.3, 0.9), at)
# 이음매 없이 반복되게 앞뒤를 겹칩니다.
fade = int(SR * 0.3)
w = np.linspace(0, 1, fade)
s[:fade] = s[:fade] * w + s[-fade:] * (1 - w)
return s[:-fade]
def save(name, sig):
sig = sig / max(1e-9, np.max(np.abs(sig))) * 0.85
pcm = (sig * 32767).astype(np.int16)
wav = os.path.join(OUT, name + ".wav")
with wave.open(wav, "wb") as f:
f.setnchannels(1)
f.setsampwidth(2)
f.setframerate(SR)
f.writeframes(pcm.tobytes())
ogg = os.path.join(OUT, name + ".ogg")
subprocess.run(["ffmpeg", "-y", "-loglevel", "error", "-i", wav, "-c:a", "libvorbis", "-q:a", "5", ogg], check=True)
os.remove(wav)
print(ogg)
def main():
os.makedirs(OUT, exist_ok=True)
save("coin", coin())
save("buy", buy())
save("levelup", levelup())
save("sizzle", sizzle())
if __name__ == "__main__":
main()