Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change: Refactor window ticks into game ticks and realtime events. #6780

Merged
merged 6 commits into from Jan 11, 2019

Conversation

PeterN
Copy link
Member

@PeterN PeterN commented May 11, 2018

These changes uncouple GUI timing (used for e.g. animations, debouncing, refresh intervals) from game timing. This change is most visible when using fast-forward, although it is also noticeable on very slow savegames as well.

Timing intervals have been multiplied by 30 to convert from game ticks to milliseconds. Note that although MILLISECONDS_PER_TICK is 30, in reality I often see 30, 31 or 32ms per game tick, so some animations may differ very slightly.

These changes may need additional refactoring due to feature creep.

src/window_func.h Outdated Show resolved Hide resolved
src/window.cpp Outdated Show resolved Hide resolved
src/window.cpp Outdated Show resolved Hide resolved
src/window.cpp Show resolved Hide resolved
src/guitimer_func.h Show resolved Hide resolved
src/guitimer_func.h Outdated Show resolved Hide resolved
@TrueBrain
Copy link
Member

TrueBrain commented Aug 11, 2018

Friendly poke. Is this PR ready for review, or are you still working on it?

@ZehMatt
Copy link
Contributor

ZehMatt commented Nov 12, 2018

Any status on this?

src/guitimer_func.h Outdated Show resolved Hide resolved
src/guitimer_func.h Outdated Show resolved Hide resolved
src/main_gui.cpp Outdated Show resolved Hide resolved
@PeterN PeterN force-pushed the window-tick-refactor branch from f044c30 to 4cbd88d Compare Jan 7, 2019
Copy link
Member

@LordAro LordAro left a comment

It's a shame that it can't have any effect at normal speed - the GUI movement speed is very noticeable after some time on fast forward! I imagine the "solution" to that would be to effectively run the GUI on fast forward all the time, which probably isn't all that viable...

@ZehMatt
Copy link
Contributor

ZehMatt commented Jan 11, 2019

This is something I wanted to tackle with my previous PR so that the UI elements would render/update each frame keeping the game logic at fixed update rate which this PR does I believe.

@PeterN
Copy link
Member Author

PeterN commented Jan 11, 2019

@LordAro Can be changed, but I think that's a separate PR. Part of the issue of running the GUI always at full speed is you then end up delaying the game loop because of that.

@PeterN PeterN merged commit c693463 into OpenTTD:master Jan 11, 2019
1 check passed
@PeterN PeterN deleted the window-tick-refactor branch Jan 11, 2019
PeterN added a commit to PeterN/OpenTTD that referenced this issue Jan 12, 2019
PeterN added a commit to PeterN/OpenTTD that referenced this issue Jan 12, 2019
PeterN added a commit to PeterN/OpenTTD that referenced this issue Jan 12, 2019
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.

None yet

6 participants