Patch: The Rainfall River Generator

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

ic111
Director
Director
Posts: 608
Joined: 17 Jul 2007 17:56

Re: Patch: The Rainfall River Generator

Post by ic111 »

Just in this case, compatibility with trunk is what would be needed.

After all, I generate a landscape that lives completely within the data structures trunk already provides. I.e., from this point of view, one might even generate the landscape with a patched version (with the river generator), and then proceed with an unpatched version.

The only reason why this is not possible are the config options...


No big problem for me personally, as all of my games are incompatible to trunk just because of the presence of the Timetable Improvement Patch anyway, but obivously it makes dealing with the patch more complicate for other people.
Eddi
Tycoon
Tycoon
Posts: 8279
Joined: 17 Jan 2007 00:14

Re: Patch: The Rainfall River Generator

Post by Eddi »

if the setting only affects game creation, you can set a flag to not store it in the savegame (in settings.ini). then compatibility will not be affected.
User avatar
Dave
Moderator
Moderator
Posts: 17243
Joined: 26 Dec 2005 20:19
Location: North London

Re: Patch: The Rainfall River Generator

Post by Dave »

wallyweb wrote:- I'll be 70 years old in two weeks
You don't look a day over 21 my friend ;)

Nice to see this patch still going...! TRUNK TRUNK TRUNK TRUNK TRUNK TRUNK!
Official TT-Dave Fan Club

Dave's Screenshot Thread! - Albion: A fictional Britain
Flickr


Why be a song when you can be a symphony? r is a...
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: Patch: The Rainfall River Generator

Post by wallyweb »

MarkyParky wrote:I think it would be a perfect idea to have a binary for this patch to download.
Here is a Windows 32bit binary based on OpenTTD Stable 1.5.2:
OpenTTD 1_5_2 Rainfall Win32.7z
(4.37 MiB) Downloaded 85 times
It was compiled using MinGW. For expediency, I edited the name of each patch down to its number component. Hopefully this did not break anything. Here is the source:
source.7z
(4.78 MiB) Downloaded 74 times
An anomaly was observed. Please refer to the attached png:
Anomalies.png
Anomalies.png (67.21 KiB) Viewed 820 times
Dave wrote:You don't look a day over 21 my friend ;)
Your name has been submitted for consideration for Governor of The Bank of England. :bow:
ic111
Director
Director
Posts: 608
Joined: 17 Jul 2007 17:56

Re: Patch: The Rainfall River Generator

Post by ic111 »

Regarding the anomaly: There was some graphical bug that showed up for lake / river tails at height zero. Unfortunately, I don´t remember the details, although I have the feeling that it is fixed in the meantime.

It shows up because the patch sometimes generates lake / river tiles at height zero.

So, this is probably not a bug in the river generator.
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: Patch: The Rainfall River Generator

Post by wallyweb »

ic111 wrote:Regarding the anomaly: There was some graphical bug that showed up for lake / river tails at height zero. Unfortunately, I don´t remember the details, although I have the feeling that it is fixed in the meantime.
I have found some topics related to this issue here, here and here. I am sure that there are others that I have not found yet.
It shows up because the patch sometimes generates lake / river tiles at height zero.
How does the unpatched OpenTTD handle this?
I think planetmaker might be familiar with this issue with respect to the default river generator. Perhaps he has some suggestions.
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Patch: The Rainfall River Generator

Post by planetmaker »

wallyweb wrote: An anomaly was observed. Please refer to the attached png:
Anomalies.png
That anomaly with the river tiles at level 0 is - iirc - a bug in the NewGRF mostly; Showing the tiles should have nothing to do with how they're placed.

Having rivers / lake at height 0 is not an error necessarily (IMHO) - but on map creation it should indeed be sea water which is placed at height 0.
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: Patch: The Rainfall River Generator

Post by wallyweb »

planetmaker wrote:That anomaly with the river tiles at level 0 is - iirc - a bug in the NewGRF mostly; Showing the tiles should have nothing to do with how they're placed.

Having rivers / lake at height 0 is not an error necessarily (IMHO) - but on map creation it should indeed be sea water which is placed at height 0.
The GRFs are, on the right, the default that comes with OpenTTD, and on the left, OpenGFX + Landscape, both of which behave correctly in unpatched OpenTTD 1.5.2
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Patch: The Rainfall River Generator

Post by planetmaker »

wallyweb wrote:
planetmaker wrote:That anomaly with the river tiles at level 0 is - iirc - a bug in the NewGRF mostly; Showing the tiles should have nothing to do with how they're placed.

Having rivers / lake at height 0 is not an error necessarily (IMHO) - but on map creation it should indeed be sea water which is placed at height 0.
The GRFs are, on the right, the default that comes with OpenTTD, and on the left, OpenGFX + Landscape, both of which behave correctly in unpatched OpenTTD 1.5.2
By default there are no river tiles at sea level so those bugs simply don't become apparent - but it doesn't make them non-existant. Did you check how these NewGRF behave if you create such tiles in the scenario editor? I'm pretty sure they'll behave the same way as in your screenshot.
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: Patch: The Rainfall River Generator

Post by wallyweb »

planetmaker wrote:By default there are no river tiles at sea level so those bugs simply don't become apparent - but it doesn't make them non-existant. Did you check how these NewGRF behave if you create such tiles in the scenario editor? I'm pretty sure they'll behave the same way as in your screenshot.
Yes, they do, but in an unpatched OTTD, they do not appear on their own. The work around is to apply a little dynamite to those river tiles and the sea comes flooding in, so this is not a game (patch) stopper, just an annoying little bug.

Here's a thought ... Both the flat tile and the slope tile above it are level 0. The slope tile has to support the waterfall which I assume is a water tile. Is there a way for the code to detect whether a level 0 tile is flat or sloped and to refuse/deny a flat river tile at level 0? The only exception to this that I can think of is a landlocked sea level valley which never floods.
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Patch: The Rainfall River Generator

Post by planetmaker »

wallyweb wrote: The only exception to this that I can think of is a landlocked sea level valley which never floods.
Exactly, river at sea level in general is quite valid. That's why it would introduce yet another bug - instead of fixing the one in this patch which generates such tiles adjacent to sea tiles during map generation.
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: Patch: The Rainfall River Generator

Post by wallyweb »

planetmaker wrote:
wallyweb wrote: The only exception to this that I can think of is a landlocked sea level valley which never floods.
Exactly, river at sea level in general is quite valid. That's why it would introduce yet another bug - instead of fixing the one in this patch which generates such tiles adjacent to sea tiles during map generation.
Is the tile information accessible? If it is, then the logic might be:
if level = 0 and tile is flat then
if tile is sea water then deny
else
if tile is not sea water then allow

:?:
ic111
Director
Director
Posts: 608
Joined: 17 Jul 2007 17:56

Re: Patch: The Rainfall River Generator

Post by ic111 »

Exactly, river at sea level in general is quite valid. That's why it would introduce yet another bug - instead of fixing the one in this patch which generates such tiles adjacent to sea tiles during map generation.
Sorry, here I don´t agree. In reality, you have plenty of rivers that descend to the ocean quite flat.

Of course you can always discuss wether a generator should generate some particular landscape in a different way, but in generally, I don´t regard every situation where a river flows at height zero, and at some place ends up in the ocean as generator bug.

If OpenTTD cannot properly display this, then IMHO we in the first place have a bug in the displayment code.


That said, I myself thought about generating such river ends as ocean yesterday in the evening, although I didn´t yet come to a decision. After all, such a river end, generated as ocean, would look like some sort of a fjord.

But, as I have said, I wouldn´t make a general "such landscape is buggy" rule of that...
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Patch: The Rainfall River Generator

Post by planetmaker »

As said: generally I consider river tiles at height 0 totally valid. Whether they should be placed upon map creation so far is always answered with 'no'. And the main reason for that is that sea floods ground at height 0 - unless it's a different kind of water. There can be good reasons to deviate from that; but it will need consideration of the flooding; and water at height 0 flooding adjacent tiles is an interesting challange in its own which should not be removed or deviated with very good reason at map start.

The display bugs with rivers at height 0 as shown here are only problems with the NewGRF code relating to river sprites and not a problem with OpenTTD's code.
ic111
Director
Director
Posts: 608
Joined: 17 Jul 2007 17:56

Re: Patch: The Rainfall River Generator

Post by ic111 »

Yes, one should indeed discuss such issues based on a concrete example.

I know about the flooding problem. Just a case that sometimes happens is having a river between slopes towards height one. That are cases where nothing to flood exists, but nevertheless the river can head quite a distance "into the landscape" while still being at height zero. So, then we have the question - generate a fjord of ocean tiles, or generate a river?

I will have a look on that aspect.
ic111
Director
Director
Posts: 608
Joined: 17 Jul 2007 17:56

Re: Patch: The Rainfall River Generator

Post by ic111 »

To illustrate this issue a bit: This is an example of a river ending into the ocean, which descends to height zero quite early. I cannot sensefully avoid that rivers are sometimes generated this way, the only thing I could do would be transforming such rivers at height zero (linked to the ocean) into ocean in a postprocessing step. But actually, I don´t see a real problem with this river.
Unbenannt, 3. Feb 1905.png
(672.95 KiB) Not downloaded yet
Eddi
Tycoon
Tycoon
Posts: 8279
Joined: 17 Jan 2007 00:14

Re: Patch: The Rainfall River Generator

Post by Eddi »

to me it looks like it's trying to make the ground tile shine through the shore, assuming that the ground tile is grass, but that grass layer seems to be missing.
User avatar
wallyweb
Tycoon
Tycoon
Posts: 6102
Joined: 27 Nov 2004 15:05
Location: Canada

Re: Patch: The Rainfall River Generator

Post by wallyweb »

ic111 wrote:To illustrate this issue a bit: ..
I agree with your desire to have your algorithm draw level 0 rivers. I think this is an excellent idea.

The problem seems to arise when your algorithm reaches sea water. It seems to build one more tile, possibly to remove the sea coast (beach). Is this correct?

If I remember correctly, when "rivers" were first conceived for TTDPatch, there was a similar problem and the solution was for the developers to devise code for waterfalls on the level 0 slope. I do not know how they did this. Was the fix in the sea water code or was it in the waterfall code? I assume that when the OpenTTD developers implemented "rivers", they used a similar fix.
... the only thing I could do would be transforming such rivers at height zero (linked to the ocean) into ocean in a postprocessing step.
This is probably the best solution, and it is also realistic. Seas and oceans have tides and sea level rivers that flow into the ocean are "tidal" rivers. When the tide is rising there is a "tidal" bore as the river level changes with the incoming tide. At least twice a day the river becomes ocean.
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Patch: The Rainfall River Generator

Post by planetmaker »

ice111, maybe you use an old(er) baseset version. What do you use? My screenshot uses OpenGFX 5578 from April 2015. Rivers at height0 look like attached here. The only small problem is that the river slope down to height 0 contains the swell at the sea base - a phenomenon which - iirc - in principle could be countered by an even more elaborate river code.
Attachments
screenshot.png
screenshot.png (30.49 KiB) Viewed 2168 times
ic111
Director
Director
Posts: 608
Joined: 17 Jul 2007 17:56

Re: Patch: The Rainfall River Generator

Post by ic111 »

The problem seems to be in OpenGfx + Landscape.

Start a game with OpenGfx 0.5.2 and OpenGfx + Landscape 1.1.2 ===> The problem exists as shown in my screenshot.
Start a game with only OpenGfx 0.5.2 ==> No problem.

(no further NewGrfs in both cases).
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 4 guests