Reproducible map generation

OpenTTD is a fully open-sourced reimplementation of TTD, written in C++, boasting improved gameplay and many new features.

Moderator: OpenTTD Developers

User avatar
aDe
Engineer
Engineer
Posts: 66
Joined: 07 Jan 2003 15:59
Skype: ade.se
Location: SE
Contact:

Re: Reproducible map generation

Post by aDe »

McZapkie wrote:aDe, your converter works now pretty well.
It helped me much witch generating of new version of Poland 2048x2048 for MHL patch:

149.156.194.203/~mczapkie/Train/tmp/tt/ss/pl-experimental/Poland-TatraMHL.png
Awesome!! Glad to hear it :)
User avatar
kyosuke1989
Transport Coordinator
Transport Coordinator
Posts: 273
Joined: 24 Mar 2008 13:04
Location: Finland

Re: Reproducible map generation

Post by kyosuke1989 »

Thumbs up! Maybe this will help in generating a proper Finnish scenario :)
Wahazar
Tycoon
Tycoon
Posts: 1451
Joined: 18 Jan 2014 18:10

Re: Reproducible map generation

Post by Wahazar »

I can build standard object (antenna, lighthouse) via

Code: Select all

DoCommandP(tile, x, 0, CMD_BUILD_OBJECT, NULL, buf);
where x is 0 or 1 respectively.
But how to build newgrf object?
minexew
Engineer
Engineer
Posts: 11
Joined: 28 Jul 2014 11:17
Location: CZ

Re: Reproducible map generation

Post by minexew »

I wish we could get this in master :(

I've been playing with OpenStreetMap and Osmosis and maanged to pull some data (see attachment), but it will be probably faster to just figure out how to build the SCN from Java than trying to get OpenTTD to compile with this patch.
Thanks for the inspiration anyway.
Attachments
Prague.png
(348.99 KiB) Downloaded 8 times
minexew
Engineer
Engineer
Posts: 11
Joined: 28 Jul 2014 11:17
Location: CZ

Re: Reproducible map generation

Post by minexew »

Oh boy, was I wrong...

http://i.imgur.com/jInAqbn.png
Last edited by planetmaker on 07 Mar 2015 10:34, edited 1 time in total.
Reason: please don't inline images larger than 800x600
User avatar
aDe
Engineer
Engineer
Posts: 66
Joined: 07 Jan 2003 15:59
Skype: ade.se
Location: SE
Contact:

Re: Reproducible map generation

Post by aDe »

minexew wrote:Oh boy, was I wrong...
Cool. Did you add support for roads...?
minexew
Engineer
Engineer
Posts: 11
Joined: 28 Jul 2014 11:17
Location: CZ

Re: Reproducible map generation

Post by minexew »

aDe wrote:Cool. Did you add support for roads...?
Roads and rivers (specified as a series of line segments) and lakes/ponds (as polygons) for now.

The way I generate this data is far from ideal - see the attachment; unlike most people playing around with heightmaps, I'm not trying to create a map for the entire country, but rather just the capital in as big of a scale as possible, so that you can replicate realistic metro systems etc. while still being financially viable (as you all know, in OTTD bigger distance equals larger income)

Of course I can publish the updated patch if anybody cares.
Attachments
Screenshot 2015-03-07 09.29.21.png
(482.82 KiB) Downloaded 6 times
Wahazar
Tycoon
Tycoon
Posts: 1451
Joined: 18 Jan 2014 18:10

Re: Reproducible map generation

Post by Wahazar »

Could you attach this road patched console_cmds?

I have a crazy idea of revitalizing old maps.
There is already "minimap" patch for console command dumping non-isometric minimap to the bitmap (this feature is also implemented in Spring Patch Pack).
You can save, tile to pixel, all roads, bridge and tunnel heads, forests, rivers, industries and objects:
example
example
minimap-openttd.png (11.21 KiB) Viewed 4869 times
minimap example
minimap example
minimap.png (1.08 KiB) Viewed 4869 times

If aDe can kindly improve his water converter, we would be able to import such minimap bitmap to txt file, manually correct industry and object Id's and finally create brand new map based on the old buggy one.
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.
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: Reproducible map generation

Post by Alberth »

Looks like you're implementing the new scenario file format :)
Being a retired OpenTTD developer does not mean I know what I am doing.
Wahazar
Tycoon
Tycoon
Posts: 1451
Joined: 18 Jan 2014 18:10

Re: Reproducible map generation

Post by Wahazar »

It is not a strictly scenario file format, because reproduced map does not exactly looks like an original one - cities looks different, industries have random chosen layouts, etc. It is not for making identical scenario, but a very similar one.
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Reproducible map generation

Post by planetmaker »

McZapkie wrote:It is not a strictly scenario file format, because reproduced map does not exactly looks like an original one - cities looks different, industries have random chosen layouts, etc. It is not for making identical scenario, but a very similar one.
Did you look at the wiki page for the suggested scenario file format? If not, I strongly suggest to :)
Given the plethora of NewGRs etc, it is rather generic and sounds very much similar to what you suggest here: city placement, maybe size, industry type (independent of NewGRF), ... it is only on hiatus due to developer time. Thus if you want to pick that up... very much: please do!
The approach to treat the single things in layers or separate images is simple: easier editable. Differeing things only by colour allows for much more ambiguity and is difficult when things cross (like rail and road or road and water). Also layers or separate images for the different things make for greater modularity :) Thus a height map is not overprinted by what's built on top etc :)

https://wiki.openttd.org/Terkhen/Scenario_format
Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4763
Joined: 09 Sep 2007 05:03
Location: home

Re: Reproducible map generation

Post by Alberth »

That would fit too, I think.

The extreme form of a scenario is literal storage of everything you built, ie almost a save game. At the other end, we have completely random games. I think there is a lot of room for something in-between. Heightmaps are a one form of it, but I can see it would be useful to have other things defined to some degree as well.
Being a retired OpenTTD developer does not mean I know what I am doing.
minexew
Engineer
Engineer
Posts: 11
Joined: 28 Jul 2014 11:17
Location: CZ

Re: Reproducible map generation

Post by minexew »

My patch is far from complete, there is no documentation yet and it's actually missing some features from McZapkie's version right now.
Originally I intended to add GUI ala Load Heightmap, but quickly gave up after I realized how insanely convoluted OpenTTD's GUI code is.

Nevertheless, you can find the current version here.
Rather than trying to explain what's changed and what's new, check out the attached example CSV (and its accompanying height map).

I'm going to try with another city now; any suggestions?

http://i.imgur.com/fZRcWwy.png
Attachments
Prague.png
(212.76 KiB) Downloaded 5 times
Prague.csv.gz
(135.45 KiB) Downloaded 152 times
Wahazar
Tycoon
Tycoon
Posts: 1451
Joined: 18 Jan 2014 18:10

Re: Reproducible map generation

Post by Wahazar »

minexew, interesting approach, especially for roads, which cannot be presented properly using plain bitmap, but rather as vector object.
However, I will rather stick with previous data, because on the other hand, some objects can be more easily acquired from bitmaps.
The best solution would be of course hybrid one.

planetmaker, my basic programming skills, especially lack of knowledge of object programming, are not sufficient to cope with project like Therken scenario interpreter.


Meanwhile, I updated console_cmds.cpp with two additional commands: industry_list and object_list,
which enlist industry and objects IDs.
If additionall 'all' parameter is added, more detailed information is printed, including newgrf file name and GrfID.
console_cmds.cpp
updated console_cmd
(74.21 KiB) Downloaded 224 times
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.
Lord_Pizza
Engineer
Engineer
Posts: 2
Joined: 18 Oct 2014 21:45

Re: Reproducible map generation

Post by Lord_Pizza »

Is there any chance that this patch would work with the latest release?
Wahazar
Tycoon
Tycoon
Posts: 1451
Joined: 18 Jan 2014 18:10

Re: Reproducible map generation

Post by Wahazar »

Yes, you can just replace console_cmds.cpp by attached one and compile - it works with 1.5.1.
By the way, I added new command:
expand_towns <minimalsize>
which attempt to expand any town which size is below <minimalsize> value.
For example
expand_towns 20
would expand all towns smaller than 20 inhabitants.
Attachments
console_cmds.cpp
console commands 7.6.2015
(78.13 KiB) Downloaded 463 times
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.
Wahazar
Tycoon
Tycoon
Posts: 1451
Joined: 18 Jan 2014 18:10

Re: Reproducible map generation

Post by Wahazar »

McZapkie wrote:I added new command:
expand_towns <minimalsize>
which attempt to expand any town which size is below <minimalsize> value.
Compiled version for win32 is located here:
http://149.156.194.203/~mczapkie/Train/ ... load/rmgp/

I edited first post, deleted some outdated info about rivers and added summary and above link.
Unfortunately I cannot edit second post.
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.
User avatar
Ben1338
Traffic Manager
Traffic Manager
Posts: 171
Joined: 17 Nov 2007 17:23
Skype: ben313371

Re: Reproducible map generation

Post by Ben1338 »

Hey, this is a great feature, but there's a problem.

Is there a way to alter the orientation of how the towns are generated? The reaosn I say this is because they're currently htey're being generated anticlockwise, but it would be nice to generate them anticlockwise.

Is there a way to achive this?

P.S. sorry for the bump.
User avatar
aDe
Engineer
Engineer
Posts: 66
Joined: 07 Jan 2003 15:59
Skype: ade.se
Location: SE
Contact:

Re: Reproducible map generation

Post by aDe »

Ben1338 wrote:Hey, this is a great feature, but there's a problem.

Is there a way to alter the orientation of how the towns are generated? The reaosn I say this is because they're currently htey're being generated anticlockwise, but it would be nice to generate them anticlockwise.

Is there a way to achive this?

P.S. sorry for the bump.
What do you mean? Not sure I understand what the problem is
User avatar
Ben1338
Traffic Manager
Traffic Manager
Posts: 171
Joined: 17 Nov 2007 17:23
Skype: ben313371

Re: Reproducible map generation

Post by Ben1338 »

The problem lies in the heightmap orientation, for example: I'm used to generating heightmaps clockwise http://i.imgur.com/xS0AIYU.png

But this generates maps quite strangely, for example: http://i.imgur.com/LepnmYu.png this is the rotation that I prefer to generate heightmaps in OTTD.

But strangely enough http://i.imgur.com/bOmVkDf.png The cities don't really generate right.

I notice some of the towns are in the wrong place too, so I try to generate it the other way http://i.imgur.com/o6SPghA.png http://i.imgur.com/tYDpBRe.png And it generates better.

http://i.imgur.com/No5Eghh.png but not perfectly (At the time, I wasn't exactly sure how to do the coordinate settings, I just got them off google earth by overlapping the height maps over the actual UK map https://i.imgur.com/QC1TB5K.png and checked the properties to get the coordinates).

Would there be a way of setting which way the map is rotated in?
Post Reply

Return to “General OpenTTD”

Who is online

Users browsing this forum: No registered users and 10 guests