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

Feature: BFS-based river generator #7213

Closed
wants to merge 23 commits into from
Closed

Conversation

Eddi-z
Copy link
Contributor

@Eddi-z Eddi-z commented Feb 10, 2019

Very crude first iteration of a BFS-based river generator, inspired by https://www.redblobgames.com/x/1723-procedural-river-growing/

@PeterN PeterN added the wip Work in progress. Feature branch that will require feedback during the development process label Feb 10, 2019
@Eddi-z
Copy link
Contributor Author

Eddi-z commented Feb 10, 2019

Loads of things still need improvement (list incomplete):

  • Flow function that allows fine scaling of amount of rivers generated
  • Tweak randomness for meandering
  • Allow rivers flowing out or in the edge of the map
  • Hacky abuse of m2, m7 and m8
  • Rivers occasionally end in "sinkholes" which have no space for a proper lake, could fill those by terraforming.
  • Reduce rivers in desert areas
  • UI for selecting different river generators
  • Feedback for landscape generator progress window

@PeterN
Copy link
Member

PeterN commented Feb 10, 2019

If the river generator is superior then I see no need to allow a choice.

@Eddi-z
Copy link
Contributor Author

Eddi-z commented Feb 10, 2019

I don't think there's such a thing as an ultimate superior river generator, so a choice between different algorithms is IMHO appropriate

@Eddi-z
Copy link
Contributor Author

Eddi-z commented Feb 10, 2019

It certainly has its moments in open areas, but gets kinda lost in very rough terrain. (the existing river generator hides that by skipping short rivers)
unbenannt 1 jan 1965 4
unbenannt 1 jan 1965 5
unbenannt 1 jan 1965 6

@PeterN
Copy link
Member

PeterN commented Feb 10, 2019

Hmm yes, need work :)

@andythenorth
Copy link
Contributor

Rev 97d6066 introduces a hard crash at map gen for me. Bisected and reproduced multiple times. The only output I get is:

"/bin/sh: line 1: 61123 Illegal instruction: 4 ./openttd"

Puzzled, as the commit looks harmless: 97d6066

}
Slope slope = GetTileSlope(tile);
if (slope != SLOPE_FLAT && !IsInclinedSlope(slope)) return;
if (rd->visited == mode) return;
Copy link
Member

Choose a reason for hiding this comment

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

Move this line above the GetTileSlope to avoid needing to calculate the slope and testing it all.

}

struct CompareRD {
bool operator()(const RiverData* rd2, const RiverData* rd){
Copy link
Member

Choose a reason for hiding this comment

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

Spacing

RiverData *rd = &riverdata[tile];
if (rd->visited == mode) return;
rd->visited = mode;
if (!IsValidTile(tile)) {
Copy link
Member

Choose a reason for hiding this comment

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

Is riverdata[INVALID_TILE] valid?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it should only access the border of void-tiles

@PeterN
Copy link
Member

PeterN commented Mar 6, 2019

How does this compare to the rainfall river generator patches?

https://www.tt-forums.net/viewtopic.php?t=71970

@Eddi-z
Copy link
Contributor Author

Eddi-z commented Mar 6, 2019

Honestly, i've never actually looked at that, and ic111 said he wants to get it to github, but doesn't really have time for it

@stale
Copy link

stale bot commented Apr 5, 2019

This pull request has been automatically marked as stale because it has not had any activity in the last month.
Please feel free to give a status update now, ping for review, or re-open when it's ready.
It will be closed if no further activity occurs within 7 days.
Thank you for your contributions.

@stale stale bot added the stale Stale issues label Apr 5, 2019
@TrueBrain TrueBrain removed the stale Stale issues label Apr 7, 2019
@stale
Copy link

stale bot commented May 5, 2019

This pull request has been automatically marked as stale because it has not had any activity in the last month.
Please feel free to give a status update now, ping for review, or re-open when it's ready.
It will be closed if no further activity occurs within 7 days.
Thank you for your contributions.

@stale stale bot added the stale Stale issues label May 5, 2019
@stale stale bot closed this May 12, 2019
@InTheMorning
Copy link

I have crudely merged an older version of the rainfall patches with the 1.10.1 release branch. https://github.com/InTheMorning/OpenTTD/tree/rainfall-1.10.1

I have not tested it extensively, but it seems to work okay so far.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Stale issues wip Work in progress. Feature branch that will require feedback during the development process
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants