Skip to content

VSync and Max Framerate options implementation.#1124

Closed
HARMSTONE wants to merge 6 commits intosmartcmd:mainfrom
HARMSTONE:main
Closed

VSync and Max Framerate options implementation.#1124
HARMSTONE wants to merge 6 commits intosmartcmd:mainfrom
HARMSTONE:main

Conversation

@HARMSTONE
Copy link

Description

Adds Max Framerate (FPS Cap) and VSync options to the graphics settings menu. Also personally encountered an issue where running in fullscreen with VSync forced on caused FPS to drop from ~1000 to 20-30, making the game unplayable, which motivated adding the VSync toggle.

(Also this is a reupload of the original fork because my account got suspended for unknown reason.)

Changes

Previous Behavior

There wasn't a Max Framerate or VSync option.

Root Cause

The graphics menu was lacking performance options.

Also I personally have an issue where running in fullscreen with VSync on caused FPS to drop from ~1000 to 20-30, making the game unplayable, which motivated adding the VSync toggle.

New Behavior

Now there are Max Framerate and VSync options in the graphics menu. VSync is a checkbox and Max Framerate is a slider (options are 30, 60, 120, Unlimited).

Showcase.mp4

Fix Implementation

Windows64_Minecraft.cpp now tracks frame time with QueryPerformanceCounter. It sleeps until the next frame is due, based on the selected FPS cap. The sync interval given to g_pSwapChain->Present is now controlled by the VSync setting.

AI Use Disclosure

Used for debugging.

Related Issues

Copy link
Collaborator

@codeHusky codeHusky left a comment

Choose a reason for hiding this comment

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

There are a lot of unrelated changes to the topic of this PR. This is not mergable as-is.

renderLevel(a, lastNsTime + 1000000000 / maxFps);
}

renderLevel(a, 0);
Copy link
Collaborator

Choose a reason for hiding this comment

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

How is the frame cap functional now? It looks like it's completely cut out of the code here

Copy link
Author

Choose a reason for hiding this comment

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

I moved frame limiting to Windows64_Minecraft.cpp (line 1963-1980).

if (!player)
return false;
int active = 0;
int indexMap[NUM_LIGHT_TEXTURES] = {-1, -1, -1, -1};
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is regarding all of the changes to this function -- why are you changing this? This seems completely irrelevant to your PR

Copy link
Author

Choose a reason for hiding this comment

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

A lot of those changes were because i used GameRenderer and Windows64_Minecraft before the Modernize project codebase commit, but it should be fixed now.

for (int j = 0; j < XUSER_MAX_COUNT && j < NUM_LIGHT_TEXTURES; ++j)
m_cachedGammaPerPlayer[j] = gamma;
{
std::shared_ptr<MultiplayerLocalPlayer> player = Minecraft::GetInstance()->localplayers[j];
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this being changed

void UIScene_SettingsGraphicsMenu::updateComponents()
{
const bool bNotInGame=(Minecraft::GetInstance()->level==nullptr);
bool bNotInGame = (Minecraft::GetInstance()->level == NULL);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why are you reverting to different types of null here?


doHorizontalResizeCheck();

bool bInGame = (Minecraft::GetInstance()->level != NULL);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this changed?

int ClampFov(int value)
const int fpsCaps[] = {30, 60, 120, 0};

int clampFov(int value)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why is this suddenly lowerCamelCase?


[[maybe_unused]]
int FovToSliderValue(float fov)
int fovToSliderValue(float fov)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same here, why is this also lowerCamelCase now?

Choose a reason for hiding this comment

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

it's pretty obvious it's ai generated. lol.

@codeHusky codeHusky marked this pull request as draft March 11, 2026 03:41
@HARMSTONE HARMSTONE marked this pull request as ready for review March 11, 2026 11:20
@HARMSTONE HARMSTONE marked this pull request as draft March 11, 2026 15:15
@HARMSTONE HARMSTONE marked this pull request as ready for review March 11, 2026 19:09
@HARMSTONE HARMSTONE requested a review from codeHusky March 11, 2026 19:10
@codeHusky
Copy link
Collaborator

This implementation is too sloppy and there's numerous debug prints that are just using standard prints instead. We won't be merging this one.

@codeHusky codeHusky closed this Mar 11, 2026
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.

3 participants