Skip to content

Conversation

@Akif-jpg
Copy link

@Akif-jpg Akif-jpg commented Jan 9, 2026

  • Add new package engine/systems/events with:
    • Manager, Channel, Subscription, EventData types
    • Async (Emit) and sync (EmitSync) delivery methods
    • Thread-safe subscription management using RWMutex
    • Utilities: CreateChannel, GetChannel, RemoveChannel, Clear
  • Add unit tests covering basic behavior, concurrency, types and benchmarks (src/engine/systems/events/event_manager_test.go)
  • Add examples demonstrating entity communication, host integration and channel management (src/engine/systems/events/event_manager_example_test.go). Examples use EmitSync where deterministic output is required.
  • Integrate event manager into Host:
    • add eventManager *events.Manager field
    • initialize in NewHost and expose via EventManager() getter
    • clear manager during Teardown
  • All new comments are in English and follow project style.

This commit implements a publish-subscribe event system intended for lightweight, in-process signaling between entities and systems.

- Add new package engine/systems/events with:
  - Manager, Channel, Subscription, EventData types
  - Async (Emit) and sync (EmitSync) delivery methods
  - Thread-safe subscription management using RWMutex
  - Utilities: CreateChannel, GetChannel, RemoveChannel, Clear
- Add unit tests covering basic behavior, concurrency, types and benchmarks
  (src/engine/systems/events/event_manager_test.go)
- Add examples demonstrating entity communication, host integration and channel
  management (src/engine/systems/events/event_manager_example_test.go). Examples
  use EmitSync where deterministic output is required.
- Integrate event manager into Host:
  - add eventManager *events.Manager field
  - initialize in NewHost and expose via EventManager() getter
  - clear manager during Teardown
- All new comments are in English and follow project style.

This commit implements a publish-subscribe event system intended for
lightweight, in-process signaling between entities and systems.
Copy link
Contributor

@BrentFarris BrentFarris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry about the delayed response here, I've not ignored or forgotten about this pull request. I've just been a bit tied up in some other features I've been working on. Thank you for the PR!

Adding in a pub/sub is a bit of an architecture change for things like entity destruction, but it does simplify a lot of other types of events. I can see it being useful as a framework tool for game developers. I'll try and make some time to think more about something like this being in architecture or as a helper for developers.

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