Skip to content

Conversation

@Mauller
Copy link

@Mauller Mauller commented Oct 18, 2025

merge by rebase

This PR adjusts the default max camera height to compensate for different screen aspect ratios.

Previous work fixed the vertical field of view to match retail and adjusted the horizontal fields of view.
But this resulted in significant distortion being observed in the periphery of the view and lower corners.
This distortion was also observed at the 16:9 aspect ratio and became significantly worse as the aspect ratio increased.

By maintaining the original 60 degrees horizontal field of view, while allowing the game to narrow the vertical field of view, increasing the camera height results in minimal to no distortion being observed.

This PR does not fix any other known camera issues and focuses on giving a playable default view.

EDIT:

This PR now also fixes the issue with the camera extents, allowing the camera to move closer to the lower edge of the map by half of the original extent limit.

It also increases the terrain render distance for widescreen views.


TODO

  • Implement in generals

@Mauller Mauller self-assigned this Oct 18, 2025
@Mauller Mauller added Bug Something is not working right, typically is user facing GUI For graphical user interface Major Severity: Minor < Major < Critical < Blocker Gen Relates to Generals ZH Relates to Zero Hour labels Oct 18, 2025
@Mauller Mauller added this to the Major bug fixes milestone Oct 18, 2025
@ElTioRata
Copy link

Comparison

@xezon
Copy link

xezon commented Oct 19, 2025

At 4:3 "This Change" gives identical view to "Original Game + GenTool" ✅

At 16:9 "This Change" gives a bit more view than "Original Game + GenTool" ❓

Is this correct? I do not recall if GenTool view is correct.

zoom16x9

@xezon xezon added Enhancement Is new feature or request and removed GUI For graphical user interface labels Oct 19, 2025
@Mauller
Copy link
Author

Mauller commented Oct 19, 2025

At 4:3 "This Change" gives identical view to "Original Game + GenTool" ✅

At 16:9 "This Change" gives a bit more view than "Original Game + GenTool" ❓

Is this correct? I do not recall if GenTool view is correct.

zoom16x9

My goal was to try match the vertical view as close as possible to retail, I think it's slightly less than compared to 4:3 but slightly more than 16:9 gentool + retail.

I think it has a reasonable tradeoff considering the extended horizontal view.

It also gives a reasonable view for aspect ratios between 4:3 and 1:1 as well. Giving a little more vertical view.

Under 1:1 things are still quite broken but a lot needs changing in the view handling to properly support portrait mode.

@xezon
Copy link

xezon commented Oct 19, 2025

Yes GenTool did take some vertical view away to compensate for the wider view, perhaps in an attempt to keep conditions fair. Additional camera height does give a competitive advantage. Are we ok with giving advantages to Wide Screen?

@Mauller
Copy link
Author

Mauller commented Oct 19, 2025

I wouldn't consider it an issue since most screens have been wide aspect For the past decade. If anything widescreen is the standard now.

Ultrawide is where it becomes more of an issue. But we could look at implementing a locked aspect mode for the tactical view in future.
This could give a standardised view to all players in a competition etc.

Or another option could be implementing tactical zoom to let people zoom out to view the entire map etc.

@Mauller Mauller force-pushed the fix-default-camera-height branch from 02a64e0 to 57fe78d Compare October 19, 2025 15:37
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.

Simple implementation, but man the EA code is confusing.

@Mauller Mauller force-pushed the fix-default-camera-height branch from 57fe78d to 271ca5b Compare October 19, 2025 19:09
@Mauller
Copy link
Author

Mauller commented Oct 19, 2025

Tweaked the code so setDefaultView is now setDefaultCameraHeight with a default argument of 1.0f for the heightScale.

Still need to look at the zoom default handling.

@Mauller Mauller force-pushed the fix-default-camera-height branch from 271ca5b to f6c96d8 Compare October 19, 2025 19:36
@Mauller
Copy link
Author

Mauller commented Oct 19, 2025

Updated with tweaked max and default zoom handling code.

@Mauller Mauller force-pushed the fix-default-camera-height branch from f6c96d8 to c3c7b85 Compare October 19, 2025 19:56
@Mauller
Copy link
Author

Mauller commented Oct 19, 2025

Small tweak to comments

@L3-M L3-M added this to the GenTool features replication milestone Oct 20, 2025
updateLoadProgress(LOAD_PROGRESS_POST_PRELOAD_ASSETS);

// TheSuperHackers @info Initialize the default view to update the max height if the resolution was changed
TheTacticalView->setDefaultCameraHeight();
Copy link

Choose a reason for hiding this comment

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

Perhaps name this function setCameraHeightToDefault to be consistent with the other function names.

Also, the name of the function is misleading. What it really does is setHeightAboveGroundLimitsToDefault().

Copy link
Author

Choose a reason for hiding this comment

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

Went with setCameraHeightLimitsToDefault() which might suit better

Copy link

Choose a reason for hiding this comment

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

setCameraHeightLimitsToDefault relates to setHeightAboveGround. It would be good if the name is consistent with its counterpart one way or another.

Copy link
Author

@Mauller Mauller Oct 26, 2025

Choose a reason for hiding this comment

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

Changed it to setCameraHeightAboveGroundLimitsToDefault()

}

m_maxHeightAboveGround = TheGlobalData->m_maxCameraHeight * aspectRatioScale * heightScale;
m_minHeightAboveGround = TheGlobalData->m_minCameraHeight * aspectRatioScale;
Copy link

Choose a reason for hiding this comment

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

On map Defcon6 with 16:9 resolution, I can see black top edges when scrolling quickly. These are the edges of the rendered height map (a rectangle). Can you also look into scaling the terrain draw area? I do not yet know how this code works exactly but you can start looking around m_drawEntireTerrain, class WorldHeightMap. When zooming out more, it becomes more obvious (there is a Debug Command to zoom out).

If you do not want to do it in this change, then a follow up is also ok.

Copy link
Author

Choose a reason for hiding this comment

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

This should be possible, i think i have seen it in the camera code elsewhere.

Copy link
Author

Choose a reason for hiding this comment

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

So i have implemented a 1.5x scaling factor to the world height map draw area when a wide aspect ratio is used.
This works all the way up to 32:9 aspect ratios with the camera height scaling code.

I used a fixed scaling factor since when using an aspect ratio based scale it would often increase the draw area well beyond the size of the map itself.

@Mauller Mauller force-pushed the fix-default-camera-height branch from c3c7b85 to 7acc71b Compare October 23, 2025 18:30
@Mauller
Copy link
Author

Mauller commented Oct 23, 2025

I have updated based on feedback and extended the functionality of this PR to fix some other issues that crop up with the camera.

The camera extent limits have now been reduced by half at the edges of the map, allowing the camera to move closer to the edge of the map. This fixes the view at the bottom of the map experienced by quite a few maps.

It also extends the rendering distance from the camera of the terrain by 50% if a wide aspect ratio is in use. This works all the way up to 32:9 aspects. Originally i was going to scale based on aspect ratio but it always produced values higher than the fixed scale.

@Mauller Mauller changed the title fix(view): Adjust default camera height to compensate for screen aspect ratio fix(view): Adjust default camera height to compensate for screen aspect ratio, reduce camera map limits and increase terrain render distance. Oct 23, 2025
@Mauller Mauller force-pushed the fix-default-camera-height branch from 7acc71b to c5fbb86 Compare October 24, 2025 13:42
@Mauller
Copy link
Author

Mauller commented Oct 24, 2025

Last one was a quick rebase with main

@Mauller Mauller force-pushed the fix-default-camera-height branch from c5fbb86 to 52f7de7 Compare October 26, 2025 09:56
@Mauller
Copy link
Author

Mauller commented Oct 26, 2025

Tweaked naming, should be good now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something is not working right, typically is user facing Enhancement Is new feature or request Gen Relates to Generals Major Severity: Minor < Major < Critical < Blocker ZH Relates to Zero Hour

Projects

None yet

5 participants