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

Fix #9242: Tree tick handler did not scale by map size. #9246

Merged
merged 2 commits into from May 12, 2021

Conversation

PeterN
Copy link
Member

@PeterN PeterN commented May 11, 2021

Motivation / Problem

Tree tick handler did not scale by map size.

This means that random tree generation density is higher on small maps and lower on large maps. This difference is enough to make the Lumber Mill impractical to use on large maps.

Description

This change skips ticks on maps smaller than 256x256 and increases iterations or shortens the interval on maps larger than 256x256.

Although #9242 is primarily about the Lumber Mill, this issue affects all random tree generation after a game is started.

Limitations

For simplicity the counter decrement function now triggers when the counter passes zero, instead of when the counter reaches zero. Slight timing difference but shouldn't affect much.

Checklist for review

Some things are not automated, and forgotten often. This list is a reminder for the reviewers.

  • The bug fix is important enough to be backported? (label: 'backport requested')
  • This PR affects the save game format? (label 'savegame upgrade')
  • This PR affects the GS/AI API? (label 'needs review: Script API')
    • ai_changelog.hpp, gs_changelog.hpp need updating.
    • The compatibility wrappers (compat_*.nut) need updating.
  • This PR affects the NewGRF API? (label 'needs review: NewGRF')

@PeterN
Copy link
Member Author

PeterN commented May 11, 2021

Slightly wonky screenshot of the change. On the right is 1.11.2, on the left is with this change. Map size is 1024x1024 in both cases.
Screenshot 2021-05-11 135815

@PeterN
Copy link
Member Author

PeterN commented May 11, 2021

Well I guess it majorly affects regression. Bum. Only because the commit was broken.

This means that random tree generation density is higher on small maps and lower on large maps. This difference is enough to make the Lumber Mill impractical to use on large maps.

This change skips ticks on maps smaller than 256x256 and increases iterations or shortens the interval on maps larger than 256x256.
@PeterN PeterN merged commit b972ed8 into OpenTTD:master May 12, 2021
@PeterN PeterN deleted the fix-9242 branch May 12, 2021 17:18
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

2 participants