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

Feature: BFS-based river generator #7213

wants to merge 23 commits into from

Conversation

@Eddi-z
Copy link
Contributor

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 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 :)

@Eddi-z Eddi-z force-pushed the Eddi-z:bfsriver branch from 5d8b01a to 2afa68c Feb 19, 2019
@Eddi-z Eddi-z force-pushed the Eddi-z:bfsriver branch from d931c89 to 33e425d Feb 20, 2019
@andythenorth
Copy link
Contributor

andythenorth commented Feb 20, 2019

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;

This comment has been minimized.

Copy link
@PeterN

PeterN Feb 20, 2019

Member

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){

This comment has been minimized.

Copy link
@PeterN

PeterN Feb 20, 2019

Member

Spacing

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

This comment has been minimized.

Copy link
@PeterN

PeterN Feb 20, 2019

Member

Is riverdata[INVALID_TILE] valid?

This comment has been minimized.

Copy link
@Eddi-z

Eddi-z Feb 20, 2019

Author Contributor

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 label Apr 5, 2019
@TrueBrain TrueBrain removed the stale 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 label May 5, 2019
@stale stale bot closed this May 12, 2019
@InTheMorning
Copy link

InTheMorning commented May 31, 2020

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
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants
You can’t perform that action at this time.