Skip to content

🧹 Improve Performance of obj_depth_sorter #88

@mathew-odwyer

Description

@mathew-odwyer

Checklist

  • I have not removed the 🧹 emoji from the title.
  • I have confirmed that this task is not already tracked under another tech debt or refactor issue.
  • This does not represent a user-facing feature request or bug report, but an internal improvement.
  • For maintainers: I have updated the projects and milestones if needed.

Description

We should determine whether performance is an issue having to enqueue all entities into an array before drawing them and if so, likely publish an event when an entity has been added or removed - once this happens, we can store or remove its instance by ID instead of creating an array on the fly in the draw event.

Impact

It will likely be faster to use the event aggregator assuming that we aren't adding and removing entities very often - remember that each frame we are calling array_sort. However, we should also consider that if we do this and an entity moves, we should fire an event to notify the depth sorter to resort the array.

Please note, once again - if an entity moves from one location to another the depth sorter is now out of sync. We need to be certain that entities will be static before making any changes - or account for entities moving and use the profiler to check which method is faster (sorting each frame, or using the Struct.EventAggregator.

Metadata

Metadata

Assignees

Labels

clientThis issue relates to the client.tech debtThis issue relates to extra work being required.

Projects

Status

Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions