Client: unify Player + creatures under one Mobile base (fixes PvP player targeting) #149
Labels
No labels
alpha:wave-0
alpha:wave-1
alpha:wave-2
alpha:wave-3
area:assets
area:combat
area:ecology
area:infra
area:render
area:scripting
area:ui
area:world
enhancement
epic
migration
post-alpha
roadmap
tech-debt
type:bug
type:chore
type:design
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
marco/IsoMmo#149
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Discovered by the PvP-arena design review (#109): the client cannot target another player, so PvP is currently unplayable. Click-to-attack (
GameInputController) scans onlyworld.Mobiles(creatures); players live in a separateworld.Playersdict, so clicking a friend does nothing. The server side is fine (CombatSystemresolves against anyMobile).Root cause
The client diverged from the server's model: server has
Mobile->PlayerMobile+ creatures (uniform); the client has two unrelatedsealed classtypes (Player,Mobile) in twoDictionary<Guid, _>. Interaction code must remember both -> a whole class of bugs (targeting, spell-target, tile-highlight).Fix (mirror the server)
Mobilebase (id, position, facing, movement interpolation, tint) and makePlayer : Mobile(adds name/appearance/equipment, polymorphicDraw).ClientWorld.Mobiles(Dictionary<Guid, Mobile>);Self = Mobiles[SelfId] as Player. Ids already share theGuidspace, so no collision. Corpses/items stay separate (not mobiles).PlayerState -> Player,MobileState -> Mobile) writing into the one dict. No wire change (the shared DTOs are untouched;ProtocolVersionunaffected).MobileAt(GridPosition)/Targetableslookup used by targeting (excl.SelfId) -> players + creatures targetable.WorldKind.PlayervsWorldKind.Mobilesplit into one polymorphic draw (extend-by-type, not switch).Definition of Done
Base DoD applies.
Mobilecollection;Playerderives fromMobile; noPlayers/Mobilesduality remains.WorldKindplayer/creature split is gone.