OneLiteFeatherNET / OneLiteFeatherNET/Voyager

enhancement: Cache active map lookup in RingCollisionSystem — O(n) per tick is too slow

Open
#104 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

alpha enhancement P1
Dominant language
Java
Stars
0
Forks
0
Avg merge
2d 21h
Merged PRs (30d)
12

Description

Description

`RingCollisionSystem.findActiveMap()` iterates over all entities every tick to find the entity holding `ActiveMapComponent`. With 8 players, this is 8 linear scans per tick (160/s). As entity count grows this becomes a performance bottleneck that will manifest in tick overruns.

Acceptance Criteria

  • The active map is cached in a field on `RingCollisionSystem` (or via a dedicated `ActiveMapCache` helper)
  • Cache is invalidated/updated on map transitions (when `ActiveMapComponent` changes)
  • `findActiveMap()` is no longer called inside the per-player tick loop
  • Micro-benchmark or comment documents the before/after complexity

Technical Details

  • Simplest fix: store the game entity reference at system initialization time; access its `ActiveMapComponent` directly
  • Or: introduce an `EntityManager.getSingleton(Class)` convenience method for single-entity components
  • Applies the same pattern fix to any other system doing per-tick entity scans for singleton components

Dependencies

  • Phase wiring must be complete (so the game entity exists when the system initializes)

Estimate

S

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at RingCollisionSystem.findActiveMap() and trace how ActiveMapComponent changes during map transitions and how phase wiring creates the game entity. Check whether caching the entity reference or adding EntityManager.getSingleton(Class) fits the existing lifecycle, then verify that the per-player tick loop no longer scans entities and document or benchmark the complexity change.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
game-dev, performance
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.