Skip to content

Conversation

@cmorman89
Copy link
Owner

@cmorman89 cmorman89 commented Jan 4, 2025

Release v0.1.1-alpha: (01/03/2025)

Further Optimizations

This update further optimizes the terminal printing performance by refactoring the HemeraTermFx class. The NyxEngine class has been updated to enforce game state consistency across the project, holding all instances of the major subclasses. Additionally, the requirements.txt file now includes line_profiler for performance testing to fix missing dependencies.

I will probably begin transitioning parts of the project to C because the Python interpreter is not fast enough for the performance I want to achieve. Once the transition is complete, I will be able to focus on implementing more complex features and optimizations that are currently out of reach due to Python's limitations. I am excited about the possibilities that this transition will open up and look forward to sharing the progress with you all.

Benefits using C include:

  • Allocatae memory for the various frame buffers and arrays and manage them directly.
  • Drastically improve the performance of the printing pipeline by speeding up the string buffer loop.
  • Improve printing performance by directly printing bytes to the terminal.
  • Completely avoid string generation for the terminal output by generating the ANSI escape sequences directly as bytes stored in a dedicated buffer.

What this means:

  • Implement full color support for 24-bit RGB colors (!!!)
  • Allow real-time conversion of video files to terminal output.

Changelog:

[0.1.1-alpha] - 2025-01-03

Added

  • Import npz files for multiple frames or sprites.

Changed

  • Refactor HemeraTermFx to further optimize terminal printing performance.
  • Update NyxEngine as the main enforcer of game state consistency across the project. It now holds all instances of the major subclasses.
  • Update requirements.txt to include line_profiler for performance testing.

…, AetherRenderer, HemeraTermFx, etc.

This commit merges foundational work across multiple versions (0.0.1-alpha to 0.0.3-alpha) for the NyxEngine project. The changes include the establishment of core systems, optimizations for rendering, and comprehensive refactoring of the underlying codebase.

Key Highlights:
- Initial Setup (0.0.1-alpha):
  - Establish core ECS framework with abstract classes (`NyxEntity`, `BaseSystem`, `BaseComponent`).
  - Create basic terminal utilities and implement initial background rendering.
- Tilemap and Subpixel Rendering (0.0.2-alpha):
  - Add tilemap rendering to the terminal with subpixel resolution and color handling.
  - Integrate caching and storage mechanisms to optimize performance.
  - Introduce the `PositionComponent` and `SceneComponent` for more flexible (future) map management.
- Core System Refinement & Performance Optimizations (0.0.3-alpha):
  - Implement Delta Framebuffer Rendering, tracking only changed pixels for improved performance.
  - Enable Subpixel Rendering with a doubled height approach, allowing for higher fidelity rendering.
  - Introduce asset import system with `.nyx` files for efficient asset handling.
  - Refactor and document core modules, including the `AetherRenderer`, `MorosEntityManager`, and `HermeraTermFx`, improving clarity and modularity.
  - Enhance documentation with module explanations, changelog, and updated examples.
feat: change entity_id to an int from UUID
test: add basic entity tests
closes #15
… registry (#20)

feat: remove friendly name checks and add a full-reset for the entity registry.
…#21)

feat: the ComponentManager holds a class-level dictionary of dictionaries, organized by component type. The sub-dictionaries are then keyed by the entity ID to register a component to that entity.
ref #17
- feat: Add sprites to rendering using:
  - `PositionComponent`
  - `VelocityComponent`
  - `MovementSystem`
- feat: Update tilemap rendering to:
  - Render outside the ECS system.
  - Cull, tile, and roll the tilemap based on frame size and tilemap position.
- feat: Begin `NyxEngine` implementation to be the central orchestrator of the game loop and systems.
- tests: Add some more tests; more to come. I want to continue cleaning up the architecture first.
- feat: Update demo to use `NyxEngine` and began cleaning up demo code.
- docs: Significant documentation updates (docstrings, README).
)

- Avoid tuple creation by storing foreground and background color sums in the delta frame's background channel.
- Introduce row summation to skip rows with no changes.
- Skip individual pixel processing for unchanged pixels.
- Compute background color inline to reduce expensive memory lookups.
- Move variable initialization and comparison values outside of loops for reuse.
- Replace string concatenations with list operations and io.StringIO for better string management.
- Remove unnecessary row booleans by relying on implicit checks for row updates.
- Reduce redundant caching for "null" pixels to avoid unnecessary processing.
feat: Create dict maps for fg and bg colors, generated at runtime to further limit string manipulation within the loop
refactor: Improve sum check and bg retrieval by splitting the array and ensuring uint16 datatype for the summed array.
refactor: Moved line profiling into its own wrapper method with logic to activate or bypass.
feat: Added a method to import npz (multiple ndarrays) from file quickly (used during testing)
docs: Updated docstrings across the project.
…main subclasses (#39)

* feat: add singleton pattern to NyxEngine class to maintain a global state

* refactor: replace class-level vars with instance vars in NyxEngine
- remove `ComponentManager` class references
- replace class-level vars in `MoraiEntityManager`
- replace `AetherRenderer` and `AetherDimensions` class-level calls

* fix: catch`OSError` when trying to use in a non-term environment (such as testing or output to file, etc)
- Specifically fixes the `MoiraiEntityManager` testing failures from the class attribute refactor rounds

* fix: update dependencies (numpy, line_profiler) and python (3.10.8) version in github action
@cmorman89 cmorman89 added bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request nyx-engine hemera-term-fx Terminal printing labels Jan 4, 2025
@cmorman89 cmorman89 added this to the [RELEASE] v0.1.1-alpha milestone Jan 4, 2025
@cmorman89 cmorman89 self-assigned this Jan 4, 2025
@cmorman89 cmorman89 marked this pull request as ready for review January 4, 2025 05:34
@cmorman89 cmorman89 merged commit 080951f into main Jan 4, 2025
2 checks passed
@cmorman89 cmorman89 changed the title [release] v0.1.1-alpha [RELEASE] v0.1.1-alpha Jan 7, 2025
@cmorman89 cmorman89 deleted the release/v0.1.1-alpha branch January 8, 2025 00:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working documentation Improvements or additions to documentation enhancement New feature or request hemera-term-fx Terminal printing nyx-engine

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants