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

Projects
None yet
6 participants
@PeterN
Copy link
Member

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.

Show resolved Hide resolved 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

@PeterN PeterN force-pushed the PeterN:window-tick-refactor branch from b86f719 to 93bae41 Jul 22, 2018

@TrueBrain

This comment has been minimized.

Copy link
Member

TrueBrain commented Aug 11, 2018

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

@ZehMatt

This comment has been minimized.

Copy link
Contributor

ZehMatt commented Nov 12, 2018

Any status on this?

@LordAro LordAro referenced this pull request Jan 2, 2019

Open

Hardware mouse cursor #7006

@PeterN PeterN force-pushed the PeterN:window-tick-refactor branch from 93bae41 to f044c30 Jan 5, 2019

Show resolved Hide resolved src/guitimer_func.h Outdated
Show resolved Hide resolved src/guitimer_func.h Outdated
Show resolved Hide resolved src/main_gui.cpp Outdated

@PeterN PeterN force-pushed the PeterN:window-tick-refactor branch from f044c30 to 4cbd88d Jan 7, 2019

@LordAro
Copy link
Member

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

This comment has been minimized.

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

This comment has been minimized.

Copy link
Member

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

@PeterN PeterN deleted the PeterN:window-tick-refactor branch Jan 11, 2019

PeterN added a commit to PeterN/OpenTTD that referenced this pull request Jan 12, 2019

PeterN added a commit to PeterN/OpenTTD that referenced this pull request Jan 12, 2019

PeterN added a commit to PeterN/OpenTTD that referenced this pull request Jan 12, 2019

LordAro added a commit that referenced this pull request Jan 12, 2019

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