https://bugzilla.redhat.com/show_bug.cgi?id=2437502



--- Comment #64 from Nicola Taibi <[email protected]> ---
4. Performance & Structural Optimization (Lag Resolution)

To maintain a seamless 30 TPS (Ticks Per Second) logic rate while managing a
massive 64,000-quadrant universe, 
the engine underwent a major structural refactoring focused on three primary
bottlenecks:

A. Dirty Quadrant Indexing (The "Sparse Reset" Technique)
The Problem: Previously, the server performed a memset on the entire 275MB
spatial index and iterated through 
all 64,000 quadrants every single tick to clear old data. This consumed massive
memory bandwidth and CPU time.
The Solution: We implemented a Dirty List tracking system.
Only quadrants containing dynamic objects (NPCs, Players, Comets) are marked as
"dirty".
At the start of each tick, the reset loop only visits the specific quadrants
stored in the dirty list 
(typically ~2,000 cells) rather than all 64,000.
Impact: Reduced spatial indexing overhead by 95%, freeing up significant CPU
resources for AI and combat logic.

B. Asynchronous Non-Blocking I/O (Background Saving)
The Problem: The save_galaxy() function was synchronous. Every 10 seconds, the
entire game engine would "freeze" 
or several milliseconds while writing the galaxy.dat file to disk, causing
noticeable stuttering or "lag blocks".
The Solution: We moved the persistence logic to a detached background thread.
The main logic thread performs a near-instant memcpy of the core state to a
protected buffer.
A secondary thread (save_thread) handles the heavy disk I/O independently.
An atomic_bool flag prevents concurrent save operations if the disk is slow.
Impact: Zero-latency saving. The logic loop continues at a perfect 30Hz
regardless of disk performance.

The game is now feature-complete and stable (~97%). Ready for final technical
review.

Release 14.


With kind regards, Nick

Spec URL:
https://download.copr.fedorainfracloud.org/results/ntaibi/space-gl/fedora-rawhide-x86_64/10142388-spacegl/spacegl.spec

SRPM URL:
https://download.copr.fedorainfracloud.org/results/ntaibi/space-gl/fedora-rawhide-x86_64/10142388-spacegl/spacegl-2026.02.09-14.fc45.src.rpm


-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are always notified about changes to this product and component
https://bugzilla.redhat.com/show_bug.cgi?id=2437502

Report this comment as SPAM: 
https://bugzilla.redhat.com/enter_bug.cgi?product=Bugzilla&format=report-spam&short_desc=Report%20of%20Bug%202437502%23c64

-- 
_______________________________________________
package-review mailing list -- [email protected]
To unsubscribe send an email to [email protected]
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/[email protected]
Do not reply to spam, report it: 
https://forge.fedoraproject.org/infra/tickets/issues/new

Reply via email to