Skip to content

feat(demo): migrate demo to new ECS implementation#435

Merged
stormmuller merged 4 commits intocreate-new-ecs-systemfrom
copilot/sub-pr-432
Jan 11, 2026
Merged

feat(demo): migrate demo to new ECS implementation#435
stormmuller merged 4 commits intocreate-new-ecs-systemfrom
copilot/sub-pr-432

Conversation

Copy link
Contributor

Copilot AI commented Jan 11, 2026

The demo application was using the deprecated class-based ECS architecture. Updated all demo files to use the new interface-based, data-oriented ECS system introduced in this PR.

Migration Changes

  • Components: Converted from classes extending Component to interfaces with symbol-based IDs via createComponentId
  • Systems: Converted from classes extending System to factory functions returning { query, run } objects
  • Entity building: Changed from world.buildAndAddEntity([...components]) to world.createEntity() + world.addComponent(entity, componentId, data)
  • Camera setup: Replaced registerCamera() helper with manual camera entity creation using cameraId component
  • Input setup: Replaced registerInputs() with direct InputManager instantiation and explicit system registration

Example

Before (class-based):

export class MoveSystem extends System {
  constructor(time: Time) {
    super([PositionComponent, MoveComponent], 'MoveSystem');
    this._time = time;
  }
  
  public run(entity: Entity): void {
    const pos = entity.getComponentRequired(PositionComponent);
    const move = entity.getComponentRequired(MoveComponent);
    // ...
  }
}

world.addSystem(new MoveSystem(time));

After (factory function):

export const createMoveEcsSystem = (
  time: Time,
): EcsSystem<[PositionEcsComponent, MoveEcsComponent]> => ({
  query: [positionId, moveId],
  run: (result) => {
    const [pos, move] = result.components;
    // ...
  },
});

world.addSystem(createMoveEcsSystem(time));

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits January 11, 2026 12:48
Co-authored-by: stormmuller <17644200+stormmuller@users.noreply.github.com>
Co-authored-by: stormmuller <17644200+stormmuller@users.noreply.github.com>
Copilot AI changed the title [WIP] Create new ECS architecture with data-oriented approach feat(demo): migrate demo to new ECS implementation Jan 11, 2026
Copilot AI requested a review from stormmuller January 11, 2026 12:52
@stormmuller stormmuller marked this pull request as ready for review January 11, 2026 13:08
@stormmuller stormmuller merged commit 4ab598b into create-new-ecs-system Jan 11, 2026
@stormmuller stormmuller deleted the copilot/sub-pr-432 branch January 11, 2026 13:09
stormmuller added a commit that referenced this pull request Jan 17, 2026
* feat: started adding new ECS system

* feat: migrate animation components and systems to new ECS architecture (#427)

* Initial plan

* feat: migrate animation components and systems to new ECS style

Co-authored-by: stormmuller <17644200+stormmuller@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: stormmuller <17644200+stormmuller@users.noreply.github.com>

* refactor: streamline animation component and system implementations

* feat: refactor audio component and system to ECS architecture

* test: add comprehensive test suite for audio system (#428)

* Initial plan

* test: add comprehensive tests for audio system

Co-authored-by: stormmuller <17644200+stormmuller@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: stormmuller <17644200+stormmuller@users.noreply.github.com>

* feat: added new ecs implementation and removed the old one, migrating all component and systems

* fix: restore test compatibility after ECS migration (#431)

* Initial plan

* fix: update ecs test imports and API usage

Co-authored-by: stormmuller <17644200+stormmuller@users.noreply.github.com>

* fix: skip tests requiring old ECS API rewrite

Co-authored-by: stormmuller <17644200+stormmuller@users.noreply.github.com>

* fix: resolve build errors from old ECS API usage

Co-authored-by: stormmuller <17644200+stormmuller@users.noreply.github.com>

* fix: apply linting fixes

Co-authored-by: stormmuller <17644200+stormmuller@users.noreply.github.com>

* fix: rewrite system tests for new ECS API

Co-authored-by: stormmuller <17644200+stormmuller@users.noreply.github.com>

* fix: address code review feedback - use proper types, remove comments, delete empty test

Co-authored-by: stormmuller <17644200+stormmuller@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: stormmuller <17644200+stormmuller@users.noreply.github.com>

* Update utility functions to use new ECS implementation (#430)

* Initial plan

* feat: update utility functions to use new ECS implementation

Co-authored-by: stormmuller <17644200+stormmuller@users.noreply.github.com>

* fix: replace any types with proper type imports in add-camera

Co-authored-by: stormmuller <17644200+stormmuller@users.noreply.github.com>

* refactor: simplify add-camera by using Partial<CameraEcsComponent>

Co-authored-by: stormmuller <17644200+stormmuller@users.noreply.github.com>

* fix: remove automatic system addition from addCamera to prevent duplicates

Co-authored-by: stormmuller <17644200+stormmuller@users.noreply.github.com>

* fix: implement Stoppable interface and remove unnecessary return from addCamera

Co-authored-by: stormmuller <17644200+stormmuller@users.noreply.github.com>

* refactor: follow codebase conventions and uncomment migrated ECS code

- Remove unnecessary note from addCamera documentation
- Uncomment and migrate rotation, scale, flip, and animation code in create-sprite
- Refactor Game constructor to follow codebase convention (private fields with getters)

Co-authored-by: stormmuller <17644200+stormmuller@users.noreply.github.com>

* fix: remove time and world getters from Game class

Remove the public getters for time and world as they were not requested. Update internal usage to reference private fields directly.

Co-authored-by: stormmuller <17644200+stormmuller@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: stormmuller <17644200+stormmuller@users.noreply.github.com>
Co-authored-by: Storm <stormmuller2@gmail.com>

* fix: refactor physics and particle test files to use proper types and runtime checks (#433)

* Initial plan

* fix: update physics and particle emitter test files to meet requirements

Co-authored-by: stormmuller <17644200+stormmuller@users.noreply.github.com>

* fix: revert unintended linting changes to non-test files

Co-authored-by: stormmuller <17644200+stormmuller@users.noreply.github.com>

* fix: replace Vector2(0,0) with Vector2.zero and remove unnecessary try-catch blocks

Co-authored-by: stormmuller <17644200+stormmuller@users.noreply.github.com>

* fix: replace Vector2(0,0) with Vector2.zero and remove unnecessary comments

Co-authored-by: stormmuller <17644200+stormmuller@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: stormmuller <17644200+stormmuller@users.noreply.github.com>

* feat(demo): migrate demo to new ECS implementation (#435)

* Initial plan

* feat(demo): update demo to use new ECS system

Co-authored-by: stormmuller <17644200+stormmuller@users.noreply.github.com>

* feat(demo): add camera system to demo

Co-authored-by: stormmuller <17644200+stormmuller@users.noreply.github.com>

* refactor: replace ControlAdventurerEcsComponent with tag in control-adventurer system

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: stormmuller <17644200+stormmuller@users.noreply.github.com>
Co-authored-by: Storm <stormmuller2@gmail.com>

* refactor: remove createBatch function from demo

* refactor: reorder imports and improve formatting in various test files and utilities

* refactor: update audio system tests to use Howl for sound playback and improve assertions

* fix: update ECS module paths to new directory structure

* refactor: remove pooling module from package exports

* docs: updated space shooter demo to use new ECS

* refactor: update ECS system interfaces to include tags and improve query handling

* fix: correct bullet and player movement direction in ECS systems

* docs: update ECS documentation for components, entities, systems, and world management

---------

Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: stormmuller <17644200+stormmuller@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants