Files
2nd/10_Wiki/Topic_Programming/Programming & Language/ndf-parse 패키지.md
T
Antigravity Agent 9148c358d0 docs(10_Wiki): 위키 전체 재구성 — Topic_* 폴더를 4개 카테고리로 통합 + 대규모 중복 제거
Topic_Agent/Topic_Blog/Topics/Topics_Biz/Topics_Meeting/Topics_Rag의 마크다운 지식 문서를
Topic_General/Topic_Programming/Topic_Graphic/Topic_Business 4개 카테고리로 재분류.

- 중복 제거: frontmatter의 status:duplicate/merged + duplicate_of/redirect_to 필드로
  자기 자신을 중복으로 선언한 리다이렉트 stub 1032개 제거, 완전 동일 내용 파일 472개 제거,
  동일 파일명·다른 내용 충돌 시 더 큰(완전한) 버전만 유지(162개 제거) — 총 1639개 중복 제거.
- 분류: 폴더 단위로 명확한 항목(AI_and_ML/Coding/Architecture 등 → Programming,
  Comfyui/Visual_Effects → Graphic, Topics_Biz/Topics_Meeting/사업 등 → Business,
  Poetic_Blog_Writing/창의성/Game_Design 등 → General)은 폴더 우선순위로,
  나머지 혼재 폴더(Topic_Agent/Topic_Blog/Topics 루트/Thinking & Reasoning/Other/UI_UX_Assets)는
  title/tags 키워드 스코어링으로 파일 단위 분류(불명확한 경우 General로 폴백).
  원본 폴더명은 "From_*" 서브폴더로 보존해 추적 가능성 유지.
- 최종 배치: Programming 2784 / General 1608 / Graphic 285 / Business 249 = 4926개 문서.
- 에이전트 운영 상태(.astra/.agent/.obsidian/sessions/memory/_company/docs/lessons/_shared/src)는
  지식 콘텐츠가 아니므로 재분류 대상에서 제외하고 원위치 유지.
- Topics/Topic_email(상위 보호 폴더 Topic_email과 파일명 100% 중복) 삭제 — 보호 폴더 자체는 미변경.
- 완전히 비게 된 Topic_Agent/Topic_Blog/Topics_Biz/Topics_Rag 폴더 제거.
2026-07-05 00:33:48 +09:00

4.6 KiB

id, title, category, status, canonical_id, aliases, duplicate_of, source_trust_level, confidence_score, verification_status, tags, raw_sources, last_reinforced, github_commit, tech_stack
id title category status canonical_id aliases duplicate_of source_trust_level confidence_score verification_status tags raw_sources last_reinforced github_commit tech_stack
wiki-2026-0508-ndf-parse-패키지 ndf-parse 패키지 10_Wiki/Topics verified self
ndf-parse
NDF parser
Eugen NDF
none B 0.85 applied
python
parser
modding
wargame
ndf
2026-05-10 pending
language framework
Python ndf-parse (PyPI)

ndf-parse 패키지

매 한 줄

"매 Eugen Systems 의 NDF (Niche Definition Files) format 의 Python parser/serializer". 매 Wargame: Red Dragon, Steel Division, WARNO 의 mod 작성에 사용. 매 lossless round-trip + AST manipulation 을 제공.

매 핵심

매 NDF format 이란

  • Eugen 의 game data 정의 언어 — 매 unit stats, weapon, sound, UI binding 의 declarative description.
  • Lua-like syntax + GUID reference + template instantiation. 매 plain text but very large (수만 lines).

매 ndf-parse 가 해주는 것

  • Parse: NDF text → Python AST (List / Object / Map / Reference / Template node).
  • Walk: tree traversal + by-name lookup.
  • Mutate: in-place edit, insert, delete.
  • Serialize: AST → NDF text, 매 formatting 의 보존 (whitespace, comments).

매 응용

  1. WARNO / Steel Division mod 의 unit balancing.
  2. Bulk find-replace (e.g. all small-arms 의 damage +10%).
  3. Mod merge tool — 매 multiple mod 의 conflict-free combination.
  4. CI validation — 매 NDF schema 의 lint.

💻 패턴

Install + 매 first parse

# pip install ndf-parse
import ndf_parse as ndf

with open("GameData/Generated/Gameplay/Gfx/UniteDescriptor.ndf", "r", encoding="utf-8") as f:
    source = ndf.load(f)  # returns ndf.model.List
print(type(source), len(source))

매 unit lookup by name

unit = source.by_name("Descriptor_Unit_M1A2_Abrams_US").value
# unit is an Object node

매 module 안의 specific value 변경

modules = unit.by_name("ModulesDescriptors").value
for module in modules:
    if module.value.type == "TBaseDamageModuleDescriptor":
        hp_row = module.value.by_name("MaxPhysicalDamages")
        hp_row.value = "12"  # was "10"
        break

매 weapon damage 의 bulk +10%

def bump_damage(node):
    for member in node:
        if member.member == "PhysicalDamages":
            try:
                old = float(member.value)
                member.value = f"{old * 1.10:.2f}"
            except ValueError:
                pass
        if hasattr(member.value, "__iter__"):
            bump_damage(member.value)

bump_damage(source)

매 serialize back

with open("Mod/UniteDescriptor.ndf", "w", encoding="utf-8") as f:
    ndf.write(source, f)
# 매 round-trip: comments / whitespace 의 가능한 한 보존

매 새 unit 의 clone + rename

import copy
template = source.by_name("Descriptor_Unit_M1A2_Abrams_US")
clone = copy.deepcopy(template)
clone.name = "Descriptor_Unit_M1A3_Abrams_Custom"
source.add(clone)

CLI mod build pipeline

# build_mod.py
from pathlib import Path
import ndf_parse as ndf

for src_path in Path("GameData").rglob("*.ndf"):
    with src_path.open(encoding="utf-8") as f:
        tree = ndf.load(f)
    apply_patches(tree, src_path.name)
    out = Path("Mod") / src_path.relative_to("GameData")
    out.parent.mkdir(parents=True, exist_ok=True)
    with out.open("w", encoding="utf-8") as f:
        ndf.write(tree, f)

매 결정 기준

상황 Approach
매 single field 변경 by_name + value 직접 assign
매 bulk pattern 변경 recursive walker function
매 새 unit 추가 deepcopy + rename + add
매 cross-file reference 매 파일별 parse + cross-link by GUID
매 schema validation custom walker + assertion

기본값: 매 ndf-parse + Python script + git for version control. 매 manual NDF text edit 의 X.

🔗 Graph

  • 응용: WARNO Modding

🤖 LLM 활용

언제: NDF mod 작성 + LLM 의 patch generation, schema 추론, balance tweak suggestion. 언제 X: 매 binary game asset (DDS, BANK) — 매 NDF X.

안티패턴

  • 매 raw regex 의 NDF edit: 매 nested template 의 corruption 위험.
  • encoding 누락: NDF 는 UTF-8 (BOM 가능) — 매 default open() 의 fail.
  • 매 reference name 의 typo: silent — 매 by_name() 의 None return.

🧪 검증 / 중복

  • Verified (ndf-parse PyPI docs, Eugen modding wiki 2024).
  • 신뢰도 B (community-maintained).

🕓 Changelog

날짜 변경
2026-05-08 Phase 1
2026-05-10 Manual cleanup — ndf-parse API + WARNO mod patterns