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



--- Comment #167 from Nicola Taibi <[email protected]> ---
Hi,

Subject: Technical Summary of Faction Persistence and NPC Beam Coordinate Fixes

  This update addresses two critical issues identified in the "Space GL" engine
related to player session
  management and NPC combat visuals.

  1. Player Faction Persistence Bug
  Issue: Returning commanders were having their faction and ship class reset to
default values (Stellar Alliance /
  Explorer) upon re-joining the server.
  Root Cause: The server-side login logic in src/spacegl_server.c was
unconditionally overwriting existing player
  profile data with the default initialization values sent by the client's
login packet.
  Fix: Implemented a state check (is_new) during the PKT_LOGIN handshake. The
server now only initializes faction
  and class data if the player name is not already present in the persistent
registry, ensuring that returning
  captains retain their previously selected allegiances and ship
configurations.

  2. NPC Ionic Beam Coordinate Discrepancies
  Issue: NPC beams exhibited a 1-frame rendering lag and appeared visually
detached from the firing ships during
  high-speed maneuvers.
  Root Cause A (Logic Order): In the main server loop (update_game_logic), NPC
AI was processed before player
  physics. This caused NPCs to target coordinates from the previous tick,
leading to a visible lag in beam
  orientation.
  Root Cause B (Rendering Anchors): The Vulkan visualizer lacked
source-tracking for aggregated beams. While
  targets were anchored, beam sources were fixed to static coordinates received
at the moment of firing, failing to
  follow the ship’s smoothed interpolation.

  Solutions:
   * Loop Reordering: Refactored src/server/logic.c to update all player
physics and rebuild the spatial index
     before executing NPC AI. This ensures all targeting vectors are calculated
using current-tick positional data.
   * Protocol Extension: Updated the NetBeam structure in include/game_state.h
to include owner_id and target_id.
   * Dynamic Source Anchoring: Modified the Vulkan renderer
(src/spacegl_vulkan.c) to use these IDs to "snap" both
     ends of the beam to the current smoothed positions of the source and
target ships. This eliminates "trailing"
     artifacts and ensures perfect beam alignment regardless of ship velocity
or network jitter.

  Verification:
   * Confirmed faction data remains consistent across multiple login sessions.
   * Verified NPC beam stability during high-speed combat; beams now remain
perfectly centered on both the firing
     ship's emitters and the target's hull.

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

SRPM URL: 
https://download.copr.fedorainfracloud.org/results/ntaibi/space-gl/fedora-43-x86_64/10341907-spacegl/spacegl-2026.04.17.01-1.fc43.src.rpm

  Best regards,
  Nick


-- 
You are receiving this mail because:
You are always notified about changes to this product and component
You are on the CC list for the bug.
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%23c167

-- 
_______________________________________________
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