Skip to content

Conversation

@githubawn
Copy link

Particle Cannon "Short Beam" Fix Walkthrough
Goal
Fix the visual bug where the Particle Uplink Cannon's laser beam appeared cut off or "floating" mid-air when viewed from a distance or on high-elevation maps, rather than striking from orbit.

Changes
We modified ParticleUplinkCannonUpdate.cpp to increase the orbital origin height of the beam.

ParticleUplinkCannonUpdate.cpp
Increased Height: Changed the vertical offset from 500.0f to 5000.0f in three key locations:
update()
createGroundToOrbitLaser()
createOrbitToTargetLaser()

Introduced Named Constant: Defined ORBITAL_BEAM_Z_OFFSET to replace the magic number.
const Real ORBITAL_BEAM_Z_OFFSET = 5000.0f;

These changes ensure the beam's origin point is high enough even when zoomed out or on high maps, maintaining the illusion of an orbital strike.

@greptile-apps
Copy link

greptile-apps bot commented Jan 29, 2026

Greptile Overview

Greptile Summary

This PR fixes a visual bug where the Particle Uplink Cannon's orbital laser beam appeared cut off when viewed from high camera elevations or on elevated maps. The fix increases the vertical offset for the beam's orbital origin point from 500.0f to 3500.0f (7x increase) across three critical locations: the main update loop, ground-to-orbit laser creation, and orbit-to-target laser creation. Both Generals and Zero Hour versions were updated identically with a named constant ORBITAL_BEAM_Z_OFFSET.

Key observations:

  • The change is straightforward and focused on the visual bug
  • The PR description states "5000.0f" but the actual code uses "3500.0f" - the description should be corrected
  • Previous review comments about moving the constant to the header file and removing author comments are still pending

Confidence Score: 4/5

  • This PR is safe to merge with only minor documentation inconsistencies
  • The code change is simple, well-contained, and addresses a specific visual bug. The logic is straightforward (increasing a Z-offset constant), and the same change is consistently applied across both game versions. The score is 4 instead of 5 due to: (1) discrepancy between PR description (5000.0f) and actual code (3500.0f), and (2) pending style issues from previous review comments that should be addressed
  • No files require special attention - the changes are straightforward visual fixes

Important Files Changed

Filename Overview
Generals/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp Increased orbital beam Z-offset from 500.0f to 3500.0f to fix visual clipping at high camera elevations
GeneralsMD/Code/GameEngine/Source/GameLogic/Object/Update/ParticleUplinkCannonUpdate.cpp Increased orbital beam Z-offset from 500.0f to 3500.0f to fix visual clipping at high camera elevations

Sequence Diagram

sequenceDiagram
    participant PCU as ParticleUplinkCannonUpdate
    participant Orbit as Orbital Position
    participant Laser as Laser System
    
    Note over PCU: Particle Uplink Cannon Firing Sequence
    
    PCU->>PCU: update()
    PCU->>Orbit: Calculate orbit position
    Note over Orbit: orbitPosition.z += ORBITAL_BEAM_Z_OFFSET (3500.0f)
    PCU->>Laser: Create damage and effects at target
    
    PCU->>PCU: createGroundToOrbitLaser()
    PCU->>Orbit: Calculate orbit position from ground
    Note over Orbit: laserOriginPosition.z += ORBITAL_BEAM_Z_OFFSET (3500.0f)
    PCU->>Laser: initLaser(ground -> orbit)
    
    PCU->>PCU: createOrbitToTargetLaser()
    PCU->>Orbit: Calculate orbit position above target
    Note over Orbit: initialTargetPosition.z += ORBITAL_BEAM_Z_OFFSET (3500.0f)
    PCU->>Laser: initLaser(orbit -> target)
Loading

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@AlseeAns
Copy link

yes please : D

@githubawn githubawn force-pushed the fix-particle-cannon-visual branch from 06a6632 to 91c7461 Compare January 30, 2026 17:21
@xezon xezon changed the title Fix Particle Cannon beam height visual bug fix(update): Extend the height of the USA Particle Cannon laser beam for tall camera heights Jan 30, 2026
@xezon xezon changed the title fix(update): Extend the height of the USA Particle Cannon laser beam for tall camera heights fix(update): Extend the height of the USA Particle Cannon laser beam for enormous camera heights Jan 30, 2026
Copy link

@xezon xezon left a comment

Choose a reason for hiding this comment

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

Needs to be replicated to Generals

#include "GameLogic/Module/ActiveBody.h"


const Real ORBITAL_BEAM_Z_OFFSET = 5000.0f; // TheSuperHackers @fix Mirelle 30/01/2026: Raised from 500.0f
Copy link

Choose a reason for hiding this comment

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

Remove the colon (:)

But the comment above the line:

// TheSuperHackers @fix Mirelle 30/01/2026 Raised from 500.0f
constexpr const Real ORBITAL_BEAM_Z_OFFSET = 5000.0f;

#include "GameLogic/Module/ActiveBody.h"


const Real ORBITAL_BEAM_Z_OFFSET = 5000.0f; // TheSuperHackers @fix Mirelle 30/01/2026: Raised from 500.0f
Copy link

Choose a reason for hiding this comment

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

What would be smalled sufficient value for this height to still look ok with tall camera?

Copy link
Author

@githubawn githubawn Feb 1, 2026

Choose a reason for hiding this comment

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

3500.0f seems to be enough for all cases, even players who play on Whiteout with "MaxCameraHeight = 4800.0"

@xezon xezon added Minor Severity: Minor < Major < Critical < Blocker USA Affects USA faction Gen Relates to Generals ZH Relates to Zero Hour Fix Is fixing something, but is not user facing Mod Relates to Mods or modding labels Jan 30, 2026
@githubawn githubawn force-pushed the fix-particle-cannon-visual branch from 91c7461 to 053f0d1 Compare February 1, 2026 00:52
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

2 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

@githubawn githubawn force-pushed the fix-particle-cannon-visual branch from 053f0d1 to 5d44115 Compare February 1, 2026 01:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Fix Is fixing something, but is not user facing Gen Relates to Generals Minor Severity: Minor < Major < Critical < Blocker Mod Relates to Mods or modding USA Affects USA faction ZH Relates to Zero Hour

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants