11 KiB
11 KiB
Update: Parked Body Removal From Arcade World
disableFighterBody()now callsscene.physics.world.disable(fighter)for parked or dead fighter sprites, removing the body from Arcade World's active body set instead of only settingbody.enable = false.enableFighterBody()re-adds the sprite body withworld.enable(fighter), resets it to the model position, stops residual velocity, and syncs the model from the reattached sprite.setFighterDetailVisible()uses these adapter helpers for LOD detach/reattach, so render parking also removes offscreen bodies from physics traversal.isLivingFighterModel()now returns false for missing/null models so stale async ids and removed models cannot pass living checks.
Update: Parked Fighter Detail Early Return
setFighterDetailVisible(false)now returns immediately when a fighter is already parked, avoiding repeated body/input/HUD/display-list work during large-battle LOD refreshes.
Update: Detached Fighter Animation Guard
shouldRenderFighterDetail()now requires an actual active fighter object before returning true, preventing model-only large-battle combat from trying to animate anullsprite.playFighterAction()andplayFighterActionIfNeeded()now skip playback if no animation key can be resolved.
Update: Fighter Sprite Render Recovery
createFighter()returns a real Phaser Sprite again, with combat-facing fields bridged tofighter.model.- The lazy
SpriteProxypool was rolled back because the proxy handoff could leave the simulation data alive while no stable Phaser render object was visible. attachSprite: falseis still accepted for large-battle startup, but it now creates the sprite and immediately parks it throughsetFighterDetailVisible(false)instead of skipping Sprite creation.- Rolling-window LOD still removes non-detailed sprites from Phaser's display/update lists and restores the same sprite from model
x/ywhen it becomes detailed again.
Update: Fighter Render Sprite Detach
setFighterDetailVisible(false)now parks a fighter sprite by disabling body/input/HUD, pausing animation, hiding it, and removing it from Phaser's display and update lists.setFighterDetailVisible(true)reattaches the same sprite, resets its body from modelx/y, resumes animation, and restores pointer interaction for living fighters.syncFighterModelFromSprite()ignores detached sprites so offscreen model-only movement cannot be overwritten by a stale parked sprite position.- Adapter helpers treat
_spriteDetachedas non-rendered/non-body state, so animation, body position, and projectile path logic naturally fall back to model data.
Update: FighterModel Shell
fighterModel.jsnow creates the pure JS state record for a fighter. The model owns combat-facing fields including HP, team/skin references,targetModelId/cooldown state, selection, lock/death flags, kill-growth state, frost state, detail visibility, facing, and modelx/y.attachFighterModel()connects a Phaser sprite to its model and preserves the existingfighter.hp,fighter.team,fighter.isDead, etc. surface through getter/setter bridges. This keeps the current code stable while makingfighter.modelthe state home.isLivingFighterModel()andfighterModelDistanceSquared()support model-first combat code without requiring a Sprite wrapper.fighterFactory.jscreates a Phaser Sprite with an attachedfighter.modelbridge. HUD slots, timers, scale, and input hit areas remain render concerns.fighterAdapter.jsupdates modelx/ywhen sprites are synced or when dormant fighters move manually, and now treats detached proxies as model-only for body/render checks.
Update: Fighter Adapter Layer
fighterAdapter.jscentralizes fighter-facing Phaser operations:fighterWorldPoint(),fighterDistanceSquared(),setFighterFacing(),moveFighterToward(),stopFighterMovement(),enableFighterBody(),disableFighterBody(),clampFighterInsideArena(), animation playback, and frost tint helpers.fighterFactory.jsowns sprite creation plus detail visibility; offscreen fighters remain model-backed while their sprite is parked outside Phaser render/update traversal.- Treat the adapter as the boundary for the upcoming model/proxy split. Code outside
src/game/fighter/should avoid new direct fighterbody,setFlipX(),setVelocity(), or animation calls unless it is explicitly dealing with a non-fighter object.
Update: Dormant Fighter Detail State
setFighterDetailVisible(false)now makes a non-detailed fighter dormant and detached from Phaser render/update traversal.setFighterDetailVisible(true)re-enables the body at the model position, resumes animation, and restores pointer interaction for living fighters.- Dormant fighters remain sprite/model records in
this.fightersso existing match arrays, ownership, death stats, split-on-death, and team bookkeeping remain intact.
Update: Fighter Detail Visibility For LOD
fighterFactory.jsexposessetFighterDetailVisible()soArenaScenecan hide or restore the detailed Phaser sprite for large-battle render LOD without removing the fighter from combat simulation.- Hidden fighters release borrowed HUD slots and disable pointer interaction; visible living fighters keep their original hit-area based interaction.
syncFighterHud()now treats invisible fighters as HUD-ineligible, preventing hidden LOD fighters from holding health-bar display objects.- Detached LOD fighters now pause animation safely because combat locks and delayed hits can resolve through the model-only fallback while the sprite is parked.
Update: HUD Pooling
fighterFactory.jsno longer creates permanent HUD objects for every fighter; zoom HUD now shows health bars without fighter name labels.- HUD health-bar display objects are pooled on the scene and assigned only to selected fighters or zoom-visible nearby fighters chosen by
ArenaScene. syncFighterHud()acquires a slot lazily andreleaseFighterHud()returns it to the pool when the fighter leaves the HUD candidate set, dies, or is destroyed.- Tune pool size and visible candidate limits in
PERFORMANCE.FIGHTER_HUD_POOL_SIZEandPERFORMANCE.FIGHTER_HUD_VISIBLE_LIMIT.
Update: Team Shadow Sprite Optimization
- Team identity is no longer rendered with a duplicated
teamMarkersprite.fighterFactory.jsnow creates only the main Phaser sprite for each fighter. fighterAssets.jslazily creates team-colored spritesheets for the actualskin + action + teamColorcombinations used in a match. The derived texture keeps the original character art and replaces only the floor shadow color (#534545) in the lower frame band (y=55..59) with the team color.- Combat animation playback calls
ensureFighterTeamAnimation()before switching actions, so idle, walk, attack, hurt, and death states keep the same team shadow treatment. - This reduces display-list cost from
fighter sprite + teamMarker spriteto a single fighter sprite. The tradeoff is extra texture memory for team-colored derivatives, so derived textures must stay lazy and should not be pre-generated for the whole manifest. - Frost stun still uses the fighter body's
setTint(WORLD_EFFECT.FROST_STUN_TINT). Do not reuse tint for team identity; team color is baked into the shadow pixels instead.
Context: Fighter & Assets
1. 모듈별 상세 역할 (src/game/fighter/)
fighterAssets.js: 캐릭터 스프라이트 로드 및 애니메이션/실루엣 생성을 담당합니다. 원본 이미지로부터 팀 색상 마커용 실루엣을 동적으로 생성합니다.fighterFactory.js: 캐릭터 인스턴스화 및 HUD 체력바 관리를 담당합니다. Phaser Sprite와 DOM UI 사이의 가교 역할을 합니다.fighterManifest.js: 모든 캐릭터 종족 및 스탯 데이터를 정의합니다. 20여 종의 캐릭터 설정이 포함되어 있습니다.fighterStats.js: 공격 방식으로melee,ranged,magic역할을 판별하고 역할별 기본 스탯과 스킨별 오버라이드를 병합합니다.fighterSelection.js: 매치 참여 캐릭터를 무작위로 선택하거나 섞는 로직을 담당합니다.
2. 주요 로직 구현 세부 사항
동적 팀 실루엣 생성
팀 색상 표시는 캐릭터 모양을 정교하게 따라가는 별도 spritesheet입니다.
fighterAssets.js가 로드된 원본 스프라이트의 alpha 데이터를 캔버스에서 읽습니다.- 원본 alpha 픽셀 주변
SELECTED_FIGHTER_OUTLINE_GAP은 비우고, 그 바깥SELECTED_FIGHTER_OUTLINE_WIDTH에만 흰색 outline을 칠합니다. fighterFactory.js에서 생성된 캐릭터 뒤에 배치하고 팀 색상으로 tint 처리합니다.- 캐릭터가 성장하여 커져도 같은 배율로 실루엣이 유지됩니다.
캐릭터 HUD 및 상태 동기화
- 체력바 표시: 줌 또는 선택 상태에서 후보 fighter만 pooled HUD slot을 빌려 체력바를 표시합니다. 이름표는 zoom HUD에 표시하지 않습니다.
- 사망자 처리: 사망 시 HUD와 팀 마커를 숨겨 화면 가독성을 높입니다. 본체 sprite만 낮은 depth와 반투명 상태로 남깁니다.
- 월드 감속 상태: 생성 시
worldEffectSpeedMultiplier를1로 초기화하며, 냉각지대 안에서는worldEffects.js가 해당 배율을 낮춰 공격속도와 이동속도 계산에 반영합니다. - 냉기 동결 상태:
isFrostStunned와 동결 타이머를 캐릭터별로 관리합니다. 냉기 메테오 착탄에 생존하면 캐릭터 본체와 팀 실루엣 마커가 함께 얼음색으로 바뀌고, 동결 종료 시 본체 원본 색상과 저장된 팀 색상으로 복구됩니다.
캐릭터별 특성 (예: Slime)
spawnMultiplier: 배정된 슬롯 1개를 지정된 수만큼 확장하여 스폰합니다.splitOnDeath: 사망 시 확률적으로 지정된 수만큼 분열체를 생성합니다.- 스탯 상한: 처치 보상은 현재 체력을 회복시키지만
maxHp를 넘을 수 없습니다. (예: Slime은 항상 1 HP)
역할별 전투 스탯
combat.type이projectile이면ranged,instant-spell이면magic, 그 외에는melee기본 프로필을 사용합니다.- 새로운 공격 구현이 기본 판별과 다른 역할을 사용해야 할 때는
combat.fighterType에melee,ranged,magic중 하나를 명시합니다. - 개별 스킨의 기존
stats.maxHp,combat.range,combat.cooldown,combat.criticalChance,combat.projectile.speed,combat.attackEffect.hitDelay설정은 역할별 기본값보다 우선합니다.
3. 유지보수 규칙
- 신규 캐릭터: 에셋 배치 후
fighterManifest.js에 정의를 추가합니다. - 종족값: 사망 통계를 위해 지정된 6개 종족 중 하나를 반드시 선택해야 합니다.
- 캐릭터 특성: 전투 중 새 유닛을 생성하는 특성은
ArenaScene.js의 생성 헬퍼를 통해this.fighters와team.size를 함께 갱신해야 합니다.