Skip to content

Commit f8341b7

Browse files
committed
feat(playroom): launch realtime 3D Renju
1 parent 37e79c0 commit f8341b7

23 files changed

Lines changed: 3576 additions & 24 deletions

‎.env.development.example‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
PUBLIC_COMMENTS_API_URL=http://127.0.0.1:8788
2+
PUBLIC_RENJU_API_URL=http://127.0.0.1:8787

‎.github/workflows/deploy.yml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ jobs:
8181
env:
8282
PUBLIC_GA_MEASUREMENT_ID: ${{ vars.PUBLIC_GA_MEASUREMENT_ID }}
8383
PUBLIC_COMMENTS_API_URL: ${{ vars.PUBLIC_COMMENTS_API_URL }}
84+
PUBLIC_RENJU_API_URL: ${{ vars.PUBLIC_RENJU_API_URL }}
8485
PUBLIC_ADMIN_URL: ${{ vars.PUBLIC_ADMIN_URL }}
8586
- name: Upload artifact
8687
uses: actions/upload-pages-artifact@v3

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ playwright-report/
99
.vscode/
1010
.env.development.local
1111
admin/.dev.vars
12+
renju/.wrangler/
1213

1314
# Local AI agent instructions and working notes
1415
AGENTS.md

‎README.md‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ npm ci
4747
npm run dev
4848
```
4949

50+
`npm run dev`는 Astro와 Playroom 실시간 Worker를 함께 실행합니다. Playroom은 로컬 8787 포트를 사용합니다. Astro만 실행하려면 `npm run dev:site`를 사용하세요.
51+
5052
프로덕션 빌드는 Astro 정적 사이트, RSS, sitemap, Pagefind 검색 색인을 모두 `dist/`에 생성합니다.
5153

5254
```bash
@@ -60,14 +62,15 @@ npm test -- --run
6062
npm run test:e2e
6163
```
6264

63-
## 댓글과 GA4 설정
65+
## 공개 서비스와 GA4 설정
6466

6567
다음 값은 브라우저에 공개되는 배포 설정이므로 GitHub repository variables에 등록합니다. 소스 코드나 GitHub Secrets에 넣지 않습니다.
6668

6769
| Variable | 용도 |
6870
| --- | --- |
6971
| `PUBLIC_GA_MEASUREMENT_ID` | GA4 Measurement ID. 비워 두면 분석 스크립트를 로드하지 않습니다. |
7072
| `PUBLIC_COMMENTS_API_URL` | 댓글 Worker의 origin. 기본값은 기존 관리자 Worker 주소입니다. |
73+
| `PUBLIC_RENJU_API_URL` | 실시간 렌주 Worker의 origin. 비워 두면 대국 생성 대신 설정 안내가 표시됩니다. |
7174
| `PUBLIC_ADMIN_URL` | 별도 관리자 Worker의 HTTPS 주소입니다. 비워 두면 `/admin/` 설정 안내가 표시됩니다. |
7275

7376
## 관리자 기반

‎package-lock.json‎

Lines changed: 65 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"private": true,
55
"type": "module",
66
"scripts": {
7-
"dev": "astro dev",
7+
"dev": "node scripts/dev.mjs",
8+
"dev:site": "astro dev",
89
"build": "astro build && pagefind --site dist",
910
"preview": "astro preview",
1011
"typecheck": "astro check",
@@ -32,13 +33,15 @@
3233
"remark-rehype": "^11.1.2",
3334
"remark-smartypants": "^3.0.3",
3435
"shiki": "^3.23.0",
36+
"three": "^0.186.1",
3537
"unified": "^11.0.5"
3638
},
3739
"devDependencies": {
3840
"@astrojs/check": "^0.9.10",
3941
"@pagefind/default-ui": "^1.5.2",
4042
"@playwright/test": "^1.55.0",
4143
"@types/node": "^24.3.0",
44+
"@types/three": "^0.186.0",
4245
"pagefind": "^1.5.2",
4346
"parse5": "^7.3.0",
4447
"prettier": "^3.9.8",

‎renju/README.md‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Playroom Renju Worker
2+
3+
정적 Astro 사이트의 `/playroom/`과 별도로 배포하는 실시간 대국 서버입니다. Cloudflare Durable Object 하나가 방 하나를 맡으며, 착수와 승패를 서버에서 판정하고 WebSocket으로 동기화합니다. 방과 기보는 Durable Object 저장소에 남습니다.
4+
5+
## 로컬 실행
6+
7+
프로젝트 루트에서 다음 명령 하나로 Astro와 Playroom Worker가 함께 실행됩니다. 최초 실행 시 Worker 의존성이 없으면 자동으로 설치합니다.
8+
9+
```bash
10+
npm run dev
11+
```
12+
13+
사이트만 실행하려면 다음 명령을 사용합니다. 이 경우 실시간 대국 생성은 동작하지 않습니다.
14+
15+
```bash
16+
npm run dev:site
17+
```
18+
19+
## 배포
20+
21+
```bash
22+
cd renju
23+
npm ci
24+
npm run typecheck
25+
npm run deploy
26+
```
27+
28+
배포된 Worker의 HTTPS origin을 GitHub repository variable `PUBLIC_RENJU_API_URL`에 설정한 다음 공개 사이트를 다시 빌드합니다. Worker 배포와 Pages 배포는 별개입니다. 공유 링크에는 방 ID만 들어가며 플레이어 토큰은 각 브라우저의 localStorage에 보관합니다. 두 번째 접속자는 참여 버튼을 눌러 백 자리를 확정합니다.
29+
30+
이 대국은 중앙 첫 수와 흑 금수 판정을 사용하는 친선 대국형 렌주입니다. 공식 대회 오프닝 절차인 주형 선택과 색 교환은 제공하지 않습니다. 시간 제한도 현재 적용하지 않습니다.

0 commit comments

Comments
 (0)