Skip to content

[Task] Refactor to follow ECS rather than layered OOP subsystem #10

@lextpf

Description

@lextpf

Context

Rift currently follows a layered OOP subsystem architecture around a traditional game loop. Game
owns and coordinates Tilemap, PlayerCharacter, std::vector<NonPlayerCharacter>, ParticleSystem,
TimeManager, SkyRenderer, Editor, and IRenderer.

Plan

  • Introduce an entity registry with stable entity IDs.
  • Define components for shared actor/gameplay data, likely including:
    • TransformComponent
    • VelocityComponent
    • ElevationComponent
    • SpriteAnimationComponent
    • RenderableComponent
    • ColliderComponent
    • PlayerTag
    • NpcTag
    • PatrolRouteComponent
    • DialogueComponent
    • InputIntentComponent
  • Keep global systems/resources such as Tilemap, IRenderer, CameraController, TimeManager,
    GameStateManager, and asset caches outside ECS initially.
  • Extract behavior from PlayerCharacter, NonPlayerCharacter, and Game into systems:
    • input system
    • movement system
    • collision system
    • animation system
    • NPC patrol/AI system
    • dialogue interaction system
    • render extraction / sorting system
  • Replace Game’s direct player/NPC update/render orchestration with system execution over
    entities.
  • Update editor and console paths to address entities/components instead of concrete player/NPC
    containers.
  • Update save/load to serialize ECS entity/component data while keeping map/tile serialization
    intact.
  • Add focused tests around movement, collision, NPC patrol, dialogue, save/load, and render-order
    extraction to confirm behavior remains unchanged.

Kind of work

Refactor / cleanup

Proposed change

Refactor the runtime actor/gameplay layer toward an ECS architecture while preserving existing
behavior.

Risks

This touches core runtime behavior and could regress almost anything.

Pre-submission checklist

  • This is internal engineering work and does not change user-visible behaviour.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions