Skip to content

Polishing the code base - #6

Draft
aqpanaciy wants to merge 11 commits into
developfrom
aqpanaciy
Draft

aqpanaciy wants to merge 11 commits into
developfrom
aqpanaciy

Conversation

@aqpanaciy

@aqpanaciy aqpanaciy commented Mar 30, 2026

Copy link
Copy Markdown
Collaborator

The pull request contains:

  • release blind layer data after calculating terraforming barriers;
  • removed unused code for Open.Nat;
  • updated the versions of the workflow actions;
  • no longer a memory consumption spike when saving layers (which happens every 2 hours);
  • disable console logging when a process is started as a service;
  • added the ability to enable NPC roaming only when players are present. This is enabled by the admin command and/or configuration value;
On local server
  • optimization of layer loading to reduce memory pressure during server startup (this modification is still being tested);
  • introduce a background pathfinding subsystem (this modification is still being tested).

- the blending layer is used only for calculating terraforming barriers. There is no need to store it. Reduces server memory consumption by 260 MB in the current zone configuration.
- cleaning up unused code.
- Warning: Node.js 20 actions are deprecated.
aqpanaciy and others added 4 commits September 10, 2026 09:22
- сalculate the hash of a layer data file without loading it into memory;
- write the array with layer data directly, while simultaneously calculating its hash.

Co-Authored-By: Google Gemini <gemini@google.com>
- add to log build configuration and last commit hash.
- disable console logging when a process is started as a service.
- added the ability to enable NPC roaming only when players are present. This is enabled by the admin command/configuration value.
aqpanaciy and others added 2 commits September 17, 2026 14:05
- in the DEBUG mode, when attempting to place a debug beam outside the zone, the service crashes with an exception;
- added a direction change for roaming if the path's endpoint is outside the zone.
ReadLayer now opens the file and streams bytes directly into a T[] for blittable structs to avoid an extra intermediate byte[] allocation. It uses MemoryMarshal.AsBytes and RuntimeHelpers.IsReferenceOrContainsReferences to choose the fast path, handles zero-length files, and falls back to the original ReadAllBytes->ToArray<T>() logic when the file size isn't a sizeof(T) multiple, the type contains references, or a partial read occurs. Added necessary using directives. Keeps behavior compatible while reducing allocations for raw binary layer files.

Co-Authored-By: Copilot <198982749+Copilot@users.noreply.github.com>
Introduce a background pathfinding subsystem and integrate it with zones.

- Added IPathFindService, IPathFindInfo, PathFindInfo/HomePathFindInfo and PathFindService (channel-based queue, multiple worker tasks, logging and stats).
- Added AStarFinderReusable: optimized, reusable A* implementation with stamp-based(by @claude) closed list and debug validations.
- Register PathFindService in ZonesModule and inject into Zone; IZone and Zone expose IPathFindService.
- HomingAI updated to enqueue HomePathFindInfo instead of calling A* directly.
- GlobalConfiguration.ConcurrentPathFinds added to control worker count (defaults to CPU-based heuristic).

Note: API changes to IZone/Zone and DI registration may require recompilation of dependents.
Co-Authored-By: Copilot <198982749+Copilot@users.noreply.github.com>
Co-Authored-By: Claude <claude@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.

1 participant