More height levels (in trunk since r27010)

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

User avatar
ChillCore
Tycoon
Tycoon
Posts: 2822
Joined: 04 Oct 2008 23:05
Location: Lost in spaces

Re: More height levels

Post by ChillCore »

Nice to know that you like the values that are present already.
I know what you mean by the line-like structures, they are rather hard to get rid off, not completely impossible but rather hard still. Picking primes and creating valeys and peaks with plateaus in between helps a bit, but then some seeds will make them appear again so ...

I will give your patch a quick look but I think I am going to call it quits for today after that.
We made some good progress and I am glad we got rid of that nasty crashing, let's hope it does not come back somehow.
-- .- -.-- / - .... . / ..-. --- .-. -.-. . / -... . / .-- .. - .... / -.-- --- ..- .-.-.-
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.

Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
Rubidium
OpenTTD Developer
OpenTTD Developer
Posts: 3815
Joined: 09 Feb 2006 19:15

Re: More height levels

Post by Rubidium »

Regarding v37, 181_Variety.patch: what's the intention of this change?
game_creation.variety is always positive, so that change doesn't make a difference.
game_creation.landscape is always LG_TERRAGENISIS; GenerateTerrainPerlin is the only entry point, and from landscape.cpp it is guarded by a LG_TERRAGENISIS guard.
Although... landscape != land_generator, so this is a landscape == LT_TEMPERATE check, which makes me really wonder... why no variety in temperate?

I guess the only remaining major thing is getting nice sets of amplitudes, or are the current ones already right?

This is roughly the behaviour of the old amplitudes on an underlying sine wave, though I guess it gives one some kind of clue about the roughness. Having said that, the current implementation doesn't use a sine wave, but random at intervals and then interpolating in between. In the big picture that'll behave somewhat like a sine wave.
smooth_old.png
smooth_old.png (66.72 KiB) Viewed 4096 times
This shows the behaviours of the new smoothness. To me they are significantly smoother than they were before, though that is likely due to the longer wavelengths that are taken into account now.
smooth_new.png
smooth_new.png (64.33 KiB) Viewed 4096 times
And I guess those longer wavelengths are a (partial) problem. With higher height differences you want larger mountains and thus there need for longer wavelengths and as a result shallower relative angles since those angles with get a lot steeper when going to heightlevel 100 than when staying at heightlevel 16.

As such I keep thinking that we need different sets of 'smoothness' amplitudes for different ranges of maximum heightlevel. After all, at 16 height levels having a 512x512 area that is between level 8 and 16 for very rough doesn't feel like it. At 170 heightlevels it becomes a significantly larger range. I'm not really sure where the boundaries should be for the different sets of amplitudes.
ic111
Director
Director
Posts: 608
Joined: 17 Jul 2007 17:56

Re: More height levels

Post by ic111 »

Rubidium wrote:Regarding v37, 181_Variety.patch: what's the intention of this change?
game_creation.variety is always positive, so that change doesn't make a difference.
game_creation.landscape is always LG_TERRAGENISIS; GenerateTerrainPerlin is the only entry point, and from landscape.cpp it is guarded by a LG_TERRAGENISIS guard.
Although... landscape != land_generator, so this is a landscape == LT_TEMPERATE check, which makes me really wonder... why no variety in temperate?
Seems like I didn´t look close enough on that one when splitting the old patch 180 up.(I probably mixed up landscape and land_generator in my mind when I dealt with it). I currently don´t see a reason for that change either, so I guess you are right and we can leave it out.
I guess the only remaining major thing is getting nice sets of amplitudes, or are the current ones already right?
Well, I didn´t yet find a map where it is really failing to do something senseful, so I guess they are at least a good state for now. But, I didn´t test each and any combination either.
And I guess those longer wavelengths are a (partial) problem. With higher height differences you want larger mountains and thus there need for longer wavelengths and as a result shallower relative angles since those angles with get a lot steeper when going to heightlevel 100 than when staying at heightlevel 16.
I see your point. When I generate a 1024x1024 / Alpinist / Very Rough / Max heightlevel 200 map, I get very steep mountains (this is IMHO ok, since this is the steepest setting available, if one objects about that then something like Hilly is the way to go), with some not-too-good-looking structures, e.g. some inverted-pyramid-like structures. I assume that they are a symptom of exactly the problem you describe.

My personal opinion is that I regard that particular topic of the story not too important since I made quite good experiences with heightmaps in the past. I have seen and played e.g. quite realistic looking heightmaps of the Austrian and Swiss mountains with the mhl-patch enabled, and they generate landscape of a quality where tgp cannot compete anyway, regardless of any fine-tuning one can do. So, probably building up some repository of heightmaps of mountainious areas that are known to work well with mhl is a good idea for the future.
As such I keep thinking that we need different sets of 'smoothness' amplitudes for different ranges of maximum heightlevel. After all, at 16 height levels having a 512x512 area that is between level 8 and 16 for very rough doesn't feel like it. At 170 heightlevels it becomes a significantly larger range. I'm not really sure where the boundaries should be for the different sets of amplitudes.
IMHO this is a valid argumentation, however I don´t feel like I´m the best person for implementing that (i.e. for actually choosing values for those amplitudes). What do other people think about this, are there volunteers?
Kogut
Tycoon
Tycoon
Posts: 2493
Joined: 26 Aug 2009 06:33
Location: Poland

Re: More height levels

Post by Kogut »

Is it hard for people involved in mhl to produce version that would allow tuning of relevant parameters without compilation and later recompilation (via config file or GUI)? I would happily test it (on Win7 or Lubuntu 14.04), maybe also somebody else.
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
Wahazar
Tycoon
Tycoon
Posts: 1451
Joined: 18 Jan 2014 18:10

Re: More height levels

Post by Wahazar »

I would like to suggest following addition to landscape generation: carving a riverbeds.
Just reuse existing FlowRiver procedure, but instead of placing river, decrease 1 level tile height.
Such riverbed procedure should be run before rivers generation.
As an result, not only we would obtain natural-looking landscape with valleys, but also most of the rivers will choose riverbeds
instead of flat areas - which allow to use eye-candy bridges without annoying bumps (especially for weak engines!).

Here is example, how it works (valleys are carved based on real world hydrographic data, but above mentioned algorithm should work similar):
Image

Of course some rivers would still flow widespread, but most of them would be embanked.
Some riverbeds would be dry, but it looks natural also.
BTW, riverbeds repetition should be equal to amount_of_rivers = 3 parameter, you always have erosion, but in dry climate you have wadi instead of rivers.

There is no need to store riverbed source position. Just run carving procedures and if finished, independently flow river procedures.
Formerly known as: McZapkie
Projects: Reproducible Map Generation patch, NewGRFs: Manpower industries, PolTrams, Polroad, 600mm narrow gauge, wired, ECS industry extension, V4 CEE train set, HotHut.
Another favorite games: freeciv longturn, OHOL/2HOL.
ic111
Director
Director
Posts: 608
Joined: 17 Jul 2007 17:56

Re: More height levels

Post by ic111 »

Kogut wrote:Is it hard for people involved in mhl to produce version that would allow tuning of relevant parameters without compilation and later recompilation (via config file or GUI)? I would happily test it (on Win7 or Lubuntu 14.04), maybe also somebody else.
You won´t be able to change the settings without a recompile. But what you can do is starting games with different settings and have a look wether they produce what you expect. Should be easy now, as ...


.... More Heightlevels are in trunk since r27010.

Thanks to Rubidium for the review and various code fixes and adjustments, to ChillCore and CommanderZ for further implementation work and to all testers. It was a long way, 5 years, 10 months and 7 days since I opened this thread to be exactly :-)
User avatar
romazoon
Tycoon
Tycoon
Posts: 1291
Joined: 20 Jun 2010 23:16

Re: More height levels (in trunk since r27010)

Post by romazoon »

:bow: A big round of applause to all the people involved :bow:

and you deserve all my respect for not giving up over such a long and generous project
User avatar
Pyoro
Tycoon
Tycoon
Posts: 2558
Joined: 17 Oct 2008 12:17
Location: Virgo Supercluster

Re: More height levels (in trunk since r27010)

Post by Pyoro »

Yepp, congratulations and thanks for the hard work :)

On my subjective note this is probably more game-changing than CargoDist, and that was pretty big already ;)
User avatar
Digitalfox
Chief Executive
Chief Executive
Posts: 708
Joined: 28 Oct 2004 04:42
Location: Catch the Fox if you can... Almost 20 years and counting!

Re: More height levels (in trunk since r27010)

Post by Digitalfox »

Great work :)

Would this work also help in the future to have levels below water? :mrgreen:
Gigigonzalez
Engineer
Engineer
Posts: 91
Joined: 12 Jun 2014 14:24

Re: More height levels (in trunk since r27010)

Post by Gigigonzalez »

Great work! Personally I dont see the added value "yet?", also how does this work with heightmaps? I dont hope they are all screwed up now! Also I dont hope this adds another desync saga.

Sorry I dont want to be pessimistic, Im just a bit worried.


/offtopic
I think after this project its time someone starts working on the extended heightmap format!
Eddi
Tycoon
Tycoon
Posts: 8267
Joined: 17 Jan 2007 00:14

Re: More height levels (in trunk since r27010)

Post by Eddi »

Digitalfox wrote:Great work :)

Would this work also help in the future to have levels below water? :mrgreen:
only in the sense that it's now easier to scratch off some height levels from the top to add some at the bottom of the sea. there's loads of other things to consider that were not even touched by this patch.
Gigigonzalez wrote:Great work! Personally I dont see the added value "yet?", also how does this work with heightmaps? I dont hope they are all screwed up now!
heightmaps that are optimized for 16 heightlevels can still be used for 16 heightlevels. other heightmaps can also be scaled up for more heightlevels.
Also I dont hope this adds another desync saga.

Sorry I dont want to be pessimistic, Im just a bit worried.
the chances for desyncs in this part of the code are pretty low.
Nappe1
Traffic Manager
Traffic Manager
Posts: 175
Joined: 19 Jan 2004 17:25
Location: kotka or Savitaipale, Finland
Contact:

Re: More height levels (in trunk since r27010)

Post by Nappe1 »

Truly amazing!
Six years is long time to maintain any patch, not to mention getting it eventually in shape that it gets included in trunk.
Awesome work from the all involved, big thanks.

Can't wait for the 1.5.0 release, which is probably the first official release include this? :)
(I will use nightlies for single player, so I will test the "trunked" version soon enough, but for multiplayer official builds are much easier.)
User avatar
Pingaware
Director
Director
Posts: 625
Joined: 03 May 2007 20:18
Location: England

Re: More height levels (in trunk since r27010)

Post by Pingaware »

Congratulations ic111, ChillCore and CommanderZ! It's always nice to see the big features finally hitting trunk.
Kogut
Tycoon
Tycoon
Posts: 2493
Joined: 26 Aug 2009 06:33
Location: Poland

Re: More height levels (in trunk since r27010)

Post by Kogut »

Thanks! I just introduced OpenTTD as game for my sister and she was sad that it is impossible to create proper mountains.

EDIT: She is really happy about this change :)
Correct me If I am wrong - PM me if my English is bad
AIAI - AI for OpenTTD
Ogre
Engineer
Engineer
Posts: 126
Joined: 04 May 2010 17:59
Location: Germany

Re: More height levels (in trunk since r27010)

Post by Ogre »

All praises and as many thanks as possible to both the patch authors and the developers of OpenTTD for making the much wanted additional height levels possible. Chistmas is quite early this year... but who's complaining about that? *thumbs up*
The pessimist sees the darkness in the tunnel.
The optimist sees the light at the end of the tunnel.
The realist sees the light coming closer...
The engineer sees three fools in front of his train on the track in the tunnel.
User avatar
Tafidis
Traffic Manager
Traffic Manager
Posts: 157
Joined: 19 Oct 2010 19:49

Re: More height levels (in trunk since r27010)

Post by Tafidis »

:bow: :bow: :bow:

Thank you! This is BIG. Great to see OpenTTD being developed so actively for so long. I mean WOW, this changes (enhances) the game SO much! Thanks again!
Citizens Celebrate! First train arrives in <insert your favourite town/station name here>!
Gigigonzalez
Engineer
Engineer
Posts: 91
Joined: 12 Jun 2014 14:24

Re: More height levels (in trunk since r27010)

Post by Gigigonzalez »

So how will this work with heightmaps (ie. how does it read heightmap pngs), can they be seamlessly converted ?

did you simply add more grayscale steps in between ?
peter1138
OpenTTD Developer
OpenTTD Developer
Posts: 1732
Joined: 30 Mar 2005 09:43

Re: More height levels (in trunk since r27010)

Post by peter1138 »

Er, previously heightmaps were simply scaled from 0 to 15. Now they are simply scaled from 0 to whatever you set as the maximum height.
He's like, some kind of OpenTTD developer.
User avatar
kamnet
Moderator
Moderator
Posts: 8582
Joined: 28 Sep 2009 17:15
Location: Eastern KY
Contact:

Re: More height levels (in trunk since r27010)

Post by kamnet »

It should read heightmaps with a greyscale range of 0-255, but typically the ones generated from sources like USGS, NASA, etc. are going to be 0-15. I've created custom heighmaps using the wider scale, though.
User avatar
ChillCore
Tycoon
Tycoon
Posts: 2822
Joined: 04 Oct 2008 23:05
Location: Lost in spaces

Re: More height levels (in trunk since r27010)

Post by ChillCore »

It seems to me that r27008 was the missing piece of the puzzle to finish (*) MHL.

Congratulations ic111 and thank you everyone else for the continued support and feedback over the past years.

Kogut wrote: Is it hard for people involved in mhl to produce version that would allow tuning of relevant parameters without compilation and later recompilation (via config file or GUI)? I would happily test it (on Win7 or Lubuntu 14.04), maybe also somebody else.
I am working on my custom smoothness settings patch, It has a gui to mess about with the parameters without the need for re-compilation.
I could post what I have so far if you're interested in messing about and helping me improve usability.
Note that this may be a crude experience still as there are options missing, you will have 2 guis open at times. Also I noticed that with some combinations of noise parameters the mapgeneration tends to freeze for a bit and I do not want to fry everyone's CPUs ...

Gigigonzalez wrote: So how will this work with heightmaps (ie. how does it read heightmap pngs), can they be seamlessly converted ?

did you simply add more grayscale steps in between ?
As Petern explained things should work pretty good in regards of heightmaps.
Ofcourse when importing the heightmap, just as with re-sizing , you will get less than optimal results if you scale height too much up or down.
Also scaling down will generally work better than scaling up as we do not magically insert colours into the greyscale if they are not there to begin with (read: when you start with a heighmap that has less than 255 colours in it) ...

Attached a few teasers of what you will be able to generate yourself.
The number indicates the max_height setting I had when exporting the heightmap , which happens to be the ideal maxheight you select when loading it back in.



(*)
Finish the end of the beginning that is. ;)
Attachments
NumBers_64.png
NumBers_64.png (59.82 KiB) Viewed 787 times
Up_255.png
Up_255.png (75.81 KiB) Viewed 3367 times
Uperer_255.png
!!! HUGE MAP !!!
Do not try to load this map with less then 2GB of free RAM!!! 1.5 will perhaps work but it may be more then sluggish and/or your pc might even freeze for a bit.
(4.94 MiB) Downloaded 3 times
-- .- -.-- / - .... . / ..-. --- .-. -.-. . / -... . / .-- .. - .... / -.-- --- ..- .-.-.-
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.

Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 29 guests