Alternate landscape generator

Got an idea for OpenTTD? Post it here!

Moderator: OpenTTD Developers

Mlynki
Engineer
Engineer
Posts: 40
Joined: 30 Aug 2006 18:15
Contact:

Alternate landscape generator

Post by Mlynki »

Greetings,
The new terragen generator is great, but what I lack about is the ability to generate various terrain types in different areas of the map. I mean, you either have all land low or all land hilly, but not a mix. Maybe someone in development responsible for terragen generator could do something with it??

-------
Since I am lazy to wait I took the official 0.4.8 release and wrote my own generator. It's not as fast as terragen, it works on different principle, but it can generate quite distinct terrain types just by playing with the parameters. And it is also capable of randomly mixing terrain types into one map. I did this work mainly for myself, but then I thought maybe someone might be interested in it (and maybe it could become an alternate terrain generator in the game if it's worth it??).

Source, screenshots and scenarios are available. Please note, I accidentally mixed screenshot numbers and scenario numbers - they don't match as they should. Oh, and btw, the scenario format is the old savegame format (that is, version 0.4.8 savegame format).
The source is not a patch, since I haven't figured out how to make one (in win xp) and anyway, it's just one .C with whole functions replaced.

There is still some work I want to do with it. Depending on interest, I might post it here if I get anything better than this version.

There is no GUI, the generator currently picks random terrain type or a random mix of them when you click 'generate'. Look for "static byte *tcAll[]", it lists all configuration structures which produce different terrain types. Create your structure and play around with params if you want to.
Attachments
landscape.c
Source file (tested with official version 0.4.8).
(36.71 KiB) Downloaded 237 times
screens.zip
Screenshots
(803.23 KiB) Downloaded 347 times
scenario.zip
Scenarios from which screenshots were made.
(897.51 KiB) Downloaded 217 times
DeletedUser21
Tycoon
Tycoon
Posts: 11501
Joined: 20 Sep 2004 22:45

Post by DeletedUser21 »

Nice screenies but they don't seem to work on 0.4.8. :(
Mlynki
Engineer
Engineer
Posts: 40
Joined: 30 Aug 2006 18:15
Contact:

Post by Mlynki »

Mr. X wrote:Nice screenies but they don't seem to work on 0.4.8. :(
Hm... that's rather strange. Have you tried to open them in the editor? I suppose you can't play the scenarios since it's bare land.
DeletedUser21
Tycoon
Tycoon
Posts: 11501
Joined: 20 Sep 2004 22:45

Post by DeletedUser21 »

The editor doesn't like them too. :(
Mlynki
Engineer
Engineer
Posts: 40
Joined: 30 Aug 2006 18:15
Contact:

Post by Mlynki »

Well, I just downloaded the version 0.4.8 (http://www.openttd.org 'download' button at the top) and it loads all scenarios within the editor without problems. :?:
DeletedUser21
Tycoon
Tycoon
Posts: 11501
Joined: 20 Sep 2004 22:45

Post by DeletedUser21 »

Oh :oops: my bad, I did something wrong, it works now. Yay!

Well, is seems they are really nice scenario's! Good work! :D
Mlynki
Engineer
Engineer
Posts: 40
Joined: 30 Aug 2006 18:15
Contact:

Post by Mlynki »

I have worked on this generator some more and made it better in that it contains another logic level. The one posted here has some certain types of terrain "features" (such as 'steep hill', 'small low island', etc.) which it uses to build terrain by repeating one of it all over the place or by randomly mixing all of the features in one landscape.
I recently added a 'configurations' level where each configuration defines which features can be mixed in one landscape and their probability. So now it is more flexible and also the results are somewhat more realistic. Now I'm working on a river generator.
I am playing with the idea of separating the generator into a software which would produce grayscale images for importing, since I guess this generator won't make it into the game... Haven't decided on commandline or one with GUI, since GUI would be better but not portable (and vice versa).
Of course all these plans of mine all depend on how much time I'll have to play with all this.
peter1138
OpenTTD Developer
OpenTTD Developer
Posts: 1796
Joined: 30 Mar 2005 09:43

Post by peter1138 »

Please, develop against svn trunk and provide diffs. 0.4.8 is very far removed from the current development work, and updating could be a problem.

I for one would like to have mixed terrain on a map...
He's like, some kind of OpenTTD developer.
Mlynki
Engineer
Engineer
Posts: 40
Joined: 30 Aug 2006 18:15
Contact:

Post by Mlynki »

Thanks for your interest in this. My simple problem lies within 0.0f experience in "developing against the trunk", "generating diffs" and using CVS. I might try but what I'm very much worried about is making more mess than anything good.
Anyhow, I first want to +/- finish the generator off-line at home and see if I can get those rivers right. Then I have to learn to create windows in OpenTTD so that I can make GUI. Then I have to learn the diff and cvs stuff and than I possibly might success in uploading anything. Well, maybe one day...
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

Mlynki wrote:Thanks for your interest in this. My simple problem lies within 0.0f experience in ... using CVS.
Well, that one is decidedly a non-issue. OpenTTD uses svn, not cvs.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
peter1138
OpenTTD Developer
OpenTTD Developer
Posts: 1796
Joined: 30 Mar 2005 09:43

Post by peter1138 »

Failing svn, you can download a nightly in source form and develop against that.
He's like, some kind of OpenTTD developer.
Mlynki
Engineer
Engineer
Posts: 40
Joined: 30 Aug 2006 18:15
Contact:

Post by Mlynki »

Thanks for hint. I already think I know what nightly is. What is "svn"? I suppose something similar to cvs?

Anyhow, I'll proceed as you say - get the latest cutting-edge version somehow and put the generator into it fast enough (hopefully) to be able to provide some diff files.
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

svn is Subversion.

And if you use an svn client, you don't have to worry about how quickly you can get it fixed; svn will, among other things, merge your changes with the changes that other people have made.
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
MeusH
Tycoon
Tycoon
Posts: 4349
Joined: 25 Oct 2004 15:39
Location: Mississauga

Post by MeusH »

Mlynki, how's the progress?
Mlynki
Engineer
Engineer
Posts: 40
Joined: 30 Aug 2006 18:15
Contact:

Post by Mlynki »

MeusH wrote:Mlynki, how's the progress?
I am quite sorry to say but I am totally out of time to work on this currently.
:? I have not forgotten, it is still on my TODO list, but I must finish one project first (paid, time-limited,...). I'll get this thing done sooner or later (I promise) and let you (and everyone else) know here. If anyone is postponing something because of me, please don't.

The latest news I have on this topic is that the river generator is working. The rivers are not the most realistic ones one could ever see, but I guess they could do for a start.
MeusH
Tycoon
Tycoon
Posts: 4349
Joined: 25 Oct 2004 15:39
Location: Mississauga

Post by MeusH »

That sounds great. Having one more terrain generator seems to be really great :)
Mlynki
Engineer
Engineer
Posts: 40
Joined: 30 Aug 2006 18:15
Contact:

Post by Mlynki »

Well, I returned from my other duties to the generator. Downloaded some nightlies and found out that the DSP and DSW files (MSVC 6.0 project) are no longer present. I reconstructed them somehow from older version and after getting over some problems I finally ended up with compiler error message saying something nested templates. Namely, it refuses to compile some source files for YAPF. Guess this is a problem of old MSVC version.

So as far as my promises go, I must admit that maybe I won't be able to keep them unless I manage to compile the nigthly. Can anyone give me any quick suggestion what's the easiest way to go? Or do I just visit microsoft.com for some downloads and fight with it? Or the wiki? Do I need any cash to get going...?
DaleStan
TTDPatch Developer
TTDPatch Developer
Posts: 10285
Joined: 18 Feb 2004 03:06
Contact:

Post by DaleStan »

google://Microsoft Visual Studio Express Edition
To get a good answer, ask a Smart Question. Similarly, if you want a bug fixed, write a Useful Bug Report. No TTDPatch crashlog? Then follow directions.
Projects: NFORenum (download) | PlaneSet (Website) | grfcodec (download) | grfdebug.log parser
Mlynki
Engineer
Engineer
Posts: 40
Joined: 30 Aug 2006 18:15
Contact:

Post by Mlynki »

Thank you very much.
Mlynki
Engineer
Engineer
Posts: 40
Joined: 30 Aug 2006 18:15
Contact:

Post by Mlynki »

A patch is now available in the development forum (topic with similar title). I'll also try to put it to patch page on source forge.
Post Reply

Return to “OpenTTD Suggestions”

Who is online

Users browsing this forum: No registered users and 31 guests