Metin2 game client (P0–P11) + mobile asset pipeline
Networked client on the existing Godot 4.7 + libgr2 renderer:
- net: m2dev wire protocol (libsodium KX + XChaCha20), auth/select/game
phases, EntityStore world model, ~all GC/CG headers. char create/delete,
private shop / mall / cube, SHOP_GC_START_EX, guild, party (+ CG_PARTY_SET_STATE),
quests, dragon soul, refine, safebox, exchange.
- UI: in-game windows migrated 1:1 from the reference uiscript/root .py —
char status (/stat), inventory+equipment, select-item ([SELECT_ITEM] quest
token), system-option + game-option + ESC system menu, private-shop 39-grid,
party info board, shop tabs, atlas, minimap, quickbar, chat, …
- EterGrnLib polish: GR2 material blend/two-sided, LOD crossfade, motion-event
dispatch, contact shadow, ray-AABB picking, weapon grip pre-transform.
Portable asset IO (A1) — all extension/libgr2/formats/mtproto reads routed
through godot::FileAccess (res:// PCK works on iOS/Android); standalone-lib
*_path() kept for the non-Godot CTests. AssetResolver + PropertyRegistry
switched to a baked index (bake_asset_index.gd) instead of std::filesystem.
Mobile builds: build-{android,ios}.sh, export-android.sh, pack-assets.sh,
gen-debug-keystore.sh. Assets ship as a zip mounted at runtime by
project/asset_pack.gd (adb push now; HTTP download is a drop-in later).
ctest 10/10, 34 GDScript suites, macOS/iOS/Android all build.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013EJxkHiNKS4kybHS3XKyAJ
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
# mob_view_test —— 怪 / NPC 真模型(MobView)headless 自检。
|
||||
# godot --headless --path project --script mob_view_test.gd
|
||||
# 需要 Metin2Model 扩展 + Metin2 资产(AssetRoot.path());缺就跳过对应检查。
|
||||
extends SceneTree
|
||||
|
||||
const MobView = preload("res://ui/mob_view.gd")
|
||||
|
||||
var _fail := 0
|
||||
func _ck(c: bool, m: String) -> void:
|
||||
if not c:
|
||||
_fail += 1
|
||||
printerr("FAIL: " + m)
|
||||
|
||||
func _init() -> void:
|
||||
_run()
|
||||
if _fail == 0:
|
||||
print("PASS: mob_view_test")
|
||||
quit(0)
|
||||
else:
|
||||
printerr("%d check(s) failed" % _fail)
|
||||
quit(1)
|
||||
|
||||
func _run() -> void:
|
||||
if not ClassDB.class_exists("Metin2Model") or not ClassDB.class_exists("Metin2Proto"):
|
||||
print(" (skip: 扩展未注册)")
|
||||
return
|
||||
var assets := AssetRoot.path()
|
||||
if not DirAccess.dir_exists_absolute(assets.path_join("Monster")):
|
||||
print(" (skip: 无 Monster 资产)")
|
||||
return
|
||||
var proto: Object = ClassDB.instantiate("Metin2Proto")
|
||||
get_root().add_child(proto)
|
||||
var mp := assets.path_join("locale/locale/en/mob_proto")
|
||||
if not FileAccess.file_exists(mp) or not proto.call("load_mob_proto", mp):
|
||||
print(" (skip: 无 mob_proto)")
|
||||
return
|
||||
|
||||
# race 102 = Wolf -> assets/*/ymir work/monster/wolf/
|
||||
var mv: Node3D = MobView.new()
|
||||
get_root().add_child(mv)
|
||||
var ok: bool = mv.build(assets, proto, 102)
|
||||
_ck(ok, "MobView.build(102 = Wolf) 成功")
|
||||
if not ok:
|
||||
return
|
||||
_ck(mv._dir.get_file() == "wolf", "解到 wolf 目录(%s)" % mv._dir)
|
||||
_ck(mv.model != null and mv.model.get_class() == "Metin2Model", "Metin2Model 建好")
|
||||
_ck(mv._motions.size() >= 3, "motlist.txt 解出 %d 个动作" % mv._motions.size())
|
||||
_ck(mv._motions.has("WAIT"), "有 WAIT 动作")
|
||||
# 状态切换:run -> RUN / attack -> NORMAL_ATTACK(存在才断言路径变化)
|
||||
mv.set_anim_state("run")
|
||||
var s1: String = mv._state
|
||||
mv.set_anim_state("attack")
|
||||
_ck(mv._state == "attack" and s1 == "run", "set_anim_state 切换记录")
|
||||
|
||||
# 未知 race -> build 失败(返回 null 用占位)
|
||||
var mv2: Node3D = MobView.new()
|
||||
get_root().add_child(mv2)
|
||||
_ck(not mv2.build(assets, proto, 999999), "未知 race -> build 失败")
|
||||
|
||||
# race 20009 = Old Man(NPC)——若有目录就该建成
|
||||
var mv3: Node3D = MobView.new()
|
||||
get_root().add_child(mv3)
|
||||
var npc_ok: bool = mv3.build(assets, proto, 20009)
|
||||
print(" NPC 20009 (Old Man) build = %s (%s)" % [npc_ok, mv3._dir])
|
||||
Reference in New Issue
Block a user