Skip to content

fix: demo rendering slowdown bug. - #389

Open
SirObby wants to merge 1 commit into
p2sr:masterfrom
SirObby:master
Open

SirObby wants to merge 1 commit into
p2sr:masterfrom
SirObby:master

Conversation

@SirObby

@SirObby SirObby commented Nov 17, 2026

Copy link
Copy Markdown

I had encountered an issue where the video itself is inconsistently timed, i.e. is slow in some parts.

This patch directly fixed a rendering issue I had, where I would suppose frames were encoded to the video per CEngine::Frame instead of when a frame is rendered, resulting in an incosistently timed slow video.

AI disclosure is that I used Codex GPT 6.1-Sol to find this issue, I wrote this PR entirely myself.
I also had Codex make this side by side comparison to show what this PR fixes.

render-timing-comparison.mp4

The reason that I encountered this problem rather than our beloved SAR developer homies, is that the resolution in this is is 256x192 and the render itself takes like 2 seconds to render ingame, that is probably what lead to the bug to appear so prominently.

This patch directly fixed a rendering issue I had, where I would suppose frames were encoded to the video per CEngine::Frame instead of when a frame is rendered, resulting in an incosistently timed slow video.

@pektezol pektezol left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Change PR title to start with "fix: ...".

I'm curious, why now? Probably after GPU rendering support? It doesn't make sense that a small resolution would trigger this imo.

@SirObby do you have an NVIDIA GPU?

EDIT: saw the thread, I got nothing lol.

@SirObby SirObby changed the title Fix a demo rendering slowdown bug. fix: demo rendering slowdown bug. Nov 17, 2026
@SirObby

SirObby commented Nov 17, 2026

Copy link
Copy Markdown
Author

@pektezol yes I have an NVIDIA GPU.

I submitted this now because now is when I got the fix, this issue has persisted for me many months.

@pektezol

Copy link
Copy Markdown
Member

@SirObby I meant why the slowdown thing happened after all these years but I guess it's not even recent and it happened to Bets (and possibly many more people) too. The fix looks simple, hope it doesn't cause a regression heh.

@SirObby

SirObby commented Nov 17, 2026

Copy link
Copy Markdown
Author

From what I gather, is that the engine's Frame function happens more often than an actual frame is rendered. My guess is that a frame is encoded into the video, in these engine frames, even when a frame has not been rendered to the screen. Causing it to get a lot of duplicate frames.

@pektezol

Copy link
Copy Markdown
Member

Maybe turning vsync on helps this too.

This branch has not been deployed

No deployments
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.

2 participants