How to: Semi-automatic real world scenario generation

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

Moderator: OpenTTD Developers

moki
Traffic Manager
Traffic Manager
Posts: 131
Joined: 06 Jul 2007 08:48
Location: Wismar, Germany

How to: Semi-automatic real world scenario generation

Post by moki » 20 Oct 2013 01:47

Hello and Welcome to my tutorial for making realistic scenarios from geographic heightmaps and gazetteer data with Zydeco's import towns patch.

I'll be updating it over time if something is unclear or I find an easier way to do certain steps. I recommend everybody to follow the tutorial step by step. The method is rather experimental right now and there are still many mistakes to be made. And please always read the whole instructions before doing anything - I'm not the best teacher, so thing's might be a bit confusing otherwise.

Before we start: You'll need to install some additional programs: Google Earth, MicroDEM, OpenOffice (Microsoft Office/Excel will probably do the same, but I can't help you with that), Notepad++ (or another advanced text editor) and GIMP (or just use Photoshop, if you have it).
There's always a different way to do things, but this is what I'll use for the tutorial. Some basic computer literacy as well as knowledge of using text and image editors is required, but if you have any questions, feel free to ask in this thread or drop me a PM.

...Dear class, today we will be recreating Jamaica in 22 more or less easy steps ;)

1. Get the import towns patch. Both the patch file and a pre-made windows build of it are attached. The patch was made by Zydeco and I don't own any of it (just to be safe...)

2. Download your heightmap data (detailed tutorial by MGSteve here). The file for Jamaica can be found here. When subsetting your area (described in the other tutorial), have a look at the status bar at the bottom of the window. It will show the size of your area. You'll want to make it as close as possible to your desired map size - if you want a square map, use a square. I used an area of 280x140km for a 1024x512 map. You need to be precise here or the coordinates won't match up later on.

3. Find your edge coordinates. To do this, select Info->Map window corners from MicroDEM's main menu. A popup will show you coordinates for the 4 corners and the exact center of the subset area like this:

Code: Select all

N18.70° W78.58°      N18.70° W75.95°
           N18.075° W77.265°
N17.45° W78.58°      N17,45° W75.95°
From this, we get the edge coordinates in this order: North, East, South, West. I got 18.7N, 75.95W, 17,45N, 78.58W... but the patch doesn't read the N, E, S and W suffix - instead it uses positive values for N and E and negative values for S and W, so we'll need to change our data to 18.7,-75.95,17.45,-78.58 (note: no spaces!)

4. Open a new text file (this will be your city data file) and insert the edge coordinates from the previous step as the first line. Save the file and get a beer or something - the easy part is finished ;)

5. Go back to microDEM, make all necessary adjustments (see the other tutorial). Update: There's an easy method to get the sea level right without any experimenting. In the z range settings first select map area full range to find the maximum height, then select specified. Now you divide your maximum height by 15 (16 z-levels minus one for sea level) and enter the negative of this value into microDEM as minimum. For example, if your max height is 1100, your min height should bei -74 (73.3333, rounded up). Save your heightmap as a png image. You can exit microDEM now. We won't be needing it anymore.

6. Open the map png in your image editor and scale it (Image -> Scale image... in GIMP) to the required size. OpenTTD will do some scaling if the image is not the right size, but for the best results the heightmap should be 1 pixel = 1 tile, so I'll use 1024x512px. Keep the original file, though, in case you want to make a bigger version later on.

7. Save the heightmap, start OpenTTD, go to the scenario editor and load your heightmap to see if you need to correct anything in GIMP/Photoshop. When everything looks OK, save your heightmap again, close OpenTTD and GIMP and get some coffee. No more beer at this stage.

8. Download the allcities file from my dropbox. It contains data for almost 200000 cities in the whole world, so it's a bit too big to upload directly to the forum.
All the data is from http://www.geonames.org and licensed under a Creative Commons Attribution 3.0 License. I just extracted the data points that are useful for mapmakers from about 9 million rows of data... Such fun :mrgreen:

9. Open the file with OpenOffice Calc and marvel at the load of data you've got. The columns are mostly self-explanatory. The feature code is a distinction between different kinds of towns. A list of the codes can be found here. A list of country codes can be found here. This is just FYI and shouldn't concern you right now.

10. Now we start filtering the data to remove stuff we don't need. To do this, click Data -> Filter -> Standard Filter in the main menu. Add the following filters: latitude > [your area's southern boundary] AND latitude < [your area's northern boundary] AND longitude > [your area's western boundary] AND longitude < [your area's eastern boundary] AND population >= [population of the smallest town you want to include]. If you want to make a map of one complete country (and nothing else), you can also just filter for your country code. This works well for Jamaica or other islands but is generally not a good idea.

11. Now we want to assign a size to our towns. The sizes are L(arge), M(edium) and (S)mall, just like in the scenario editor. First we need to decide which real world population should be which town size in the game. For Jamaica, I chose >20000 for large, >2500 for medium and everything else small. The right formula to do this automatically is already inserted in field B2. It says =IF(G2>200000;"L";IF(G2>35000;"M";"S")) and you only need to change the numbers. The first number is the minimum for large towns and the second one the minimum for medium towns. Everything below that will be small towns. So for Jamaica, the formula should be =IF(G2>20000;"L";IF(G2>2500;"M";"S")). To update the whole column with the changed formula, just double click on the litte dot at the bottom right corner of the selected field. My computer needs a few seconds to process everything, yours may take longer.

12. Next we need to define which of the towns should be cities. A 0 in the 3rd column means regular town, a 1 stands for a city. Again, the right formula is already inserted in field C2. It says =IF (OR(F1="PPL";F1="PPLX");0;1). This looks at the feature code column and looks for PPL (populated place) and PPLX (part of another populated place), which should be regular towns, and inserts 0 for them. Then it inserts 1 (city) for everything else, which are capitals and other important towns. If you don't like this selection and want the towns with the biggest real-world population to become cities instead, you can use the formula =IF (G2>[min population];1;0) instead. Don't forget to update the whole column again if you change the formula. Of course, you can also go through the list manually and just insert some 1s for the towns you like and 0s for the everything else - this should rarely be necessary, though.

13. Now select the columns A, B, C, D and E and press ctrl-c (copy). Close the allcities file without saving any changes. This is just your data source that should be left unchanged.

14. Create a new spreadsheet (ctrl-n) and right click on the field A1. Select Paste Special. Make sure that only Text, Numbers and Formats (and nothing else) are checked. This way, the results of the formulas are copied, but not the formulas themselves. If you just use paste instead of paste special, the formulas will be kept and try to calculate data, but fail horribly, because the cells with the population and feature codes don't exist anymore.

15. Click Data->Sort and sort your cities by size (ascending) first and city status (descending) second. When the biggest towns are at the top of the list, they'll be placed first. This prevents some small town to be founded first and block a more important town due to proximity. This can be very important in densely populated areas.

16. Save the file as Text CSV. Just use Save as... and select the right file type. In the following popup, set the character set to Unicode (UTF-8), field delimiter to , (comma) and text delimiter to " (quotation mark).

17. Open your CSV file with Notepad++. There should be 5 columns (Name, Size, City, Latitude, Longitude), nicely separated by commas and without any spaces or quotation marks. Select and copy all this town data. Paste it into the towns file that you created in step 4, just below the first line with the edge coordinates. If you want to add comments to your towns file, start a line with # and write whatevery you want. These lines will be ignored by OpenTTD.

18. In Notepad++'s main menu select Encoding->Encode in UTF-8 without BOM and save the file. Use a name without any spaces "jamaican towns.txt" would not work, but "towns-jamaica.txt" or "towns_jamaica.txt" is fine. Setting the right character encoding is very important... the patch seems to be a bit picky about that and will simply not work without the right encoding. When everything works, even towns names with special characters (ä, ö, ü, ź, etc...) should work correctly.

19. Now you can start OpenTTD, go to the scenario editor and load your heightmap. Make sure to select the right size, climate and "rotate counter-clockwise".

20. Open the console (press ^) and type "import_towns [yourfilename].txt" (without the quotation marks and with the name of the your towns text file, of course). Press Enter.

21. If you did everything right, there'll be no error messages and you'll have a bunch of towns in your scenario. The console will list all the towns that could not be founded (because of difficult terrain, closeness to map edges or other towns) and a sign will be placed in those locations. You just need to open the sign list (long click on the map icon), find the failed downs and place them manually (or just ignore them, if they aren't that important).

22. Place everything else that's needed for a scenario like additional roads, industries, trees and rivers. Save and have fun!

Making the relatively small and easy scenario of Jamaica took me less then 3 hours, including the time for writing the tutorial. It's still far from automatic, but a lot easier (and faster, too) than doing everything manually.

Thanks again to everyone who helped and inspired me and especially Zydeco for writing the awesome patch that made all of this possible... you're great! :D

If you encounter any problems (error messages during importing), please post your towns file and the exact words of the error message. "It doesn't work" is not a useful bug report and will not allow me to help you.

[21.oct.2013:edited with new, better method]
[28.oct.2013:optimized the method again with allcities file]
[29.oct.2013: replaced the windows build with a patched 1.3.2 stable]= [population of the smallest town you want to include][/b]. If you want to make a map of one complete country (and nothing else), you can also just filter for your country code. This works well for Jamaica or other islands but is generally not a good idea.
Attachments
import_towns_v4.patch
Zydeco's import towns patch.
(5.23 KiB) Downloaded 193 times
openTTD_1.3.2_import_towns_v4.zip
Ready-to-play Windows build of the patch.
(4.67 MiB) Downloaded 177 times
Last edited by moki on 31 Oct 2013 16:14, edited 9 times in total.

moki
Traffic Manager
Traffic Manager
Posts: 131
Joined: 06 Jul 2007 08:48
Location: Wismar, Germany

Re: How to: Semi-automatic real world scenario generation

Post by moki » 20 Oct 2013 01:54

Here's the heightmap, towns file and finished scenario of Jamaica (because of the attachment limit)
Only 17 of the 103 towns will fail to be founded. A very slight error in the coordinates places some cities on the northern coast into the water and some of the inland towns are just too close to eachother. For the scenario, I placed them manually. The trees and industries aren't placed according to any real data but in a way that I find fun to play with. The map is more interesting for passenger transport anyway.
Attachments
HEIGHTMAP_JAMAICA.PNG
(94.14 KiB) Downloaded 7 times
towns-jamaica.txt
(3.63 KiB) Downloaded 219 times
Jamaica.scn
(219.21 KiB) Downloaded 132 times

Zanman777
Engineer
Engineer
Posts: 32
Joined: 02 Feb 2012 00:09

Re: How to: Semi-automatic real world scenario generation

Post by Zanman777 » 20 Oct 2013 10:10

Very nice work, moki! The tutorial is awesome. We already had a topic for this, though. If its okay with you, ill quote your tutorial in our first topic :)
Is the coordinates offset sorted out?

Edit:im on My smartphone now, but for populations maybe this will help. http://www.maxmind.com/en/worldcities
http://www.geodatasource.com/world-cities-database/free
http://databases.about.com/od/sampleacc ... vinces.htm

TinyMusic
Tycoon
Tycoon
Posts: 1423
Joined: 02 Feb 2013 02:03

Re: How to: Semi-automatic real world scenario generation

Post by TinyMusic » 20 Oct 2013 11:26

This deserves a sticky :bow:
Formerly known as UseYourIllusion.
Java Scenario Found Here - Version 2 out
[tweɪ̂ pû tɕʰì wɔ̀ mǐlɤ lû tɕʰìŋ nì pɑ́ŋmɑ̌ŋ]

moki
Traffic Manager
Traffic Manager
Posts: 131
Joined: 06 Jul 2007 08:48
Location: Wismar, Germany

Re: How to: Semi-automatic real world scenario generation

Post by moki » 20 Oct 2013 12:55

@Zanman777:
I just wanted to have an own topic for the tutorial as the other topic had a lot of discussion about general mapmaking, compiling the patch, etc... stuff that has very little to do with acquiring the data and putting it to use. Feel free to link to this topic from the other one, but please don't quote the text. It's not finished yet.

The maxmind file is very useful, but still has too little population data. Only 22 entries for Jamaica (didn't look up anything else yet).
They linked to the GeoNames database, though, which seems to be almost perfect. At first sight, it looks like the holy grail of mapmaking data - like that NGA gazetteer data, but way more useful... I'll report later whether it's really good or just another big bunch of noise.

The other 2 links are no good for this... geodatasource has no population data at all (just names) and that other thing is a rather small database for Microsoft Access only (which I don't have and don't want)

@UseYourIllusion:
Thank you... the mods will have to decide that, though. I'll also make another version for the wiki, when I think that it's polished enough.

User avatar
Tafidis
Traffic Manager
Traffic Manager
Posts: 157
Joined: 19 Oct 2010 19:49

Re: How to: Semi-automatic real world scenario generation

Post by Tafidis » 20 Oct 2013 13:01

:bow: :bow: :bow:

Thanks you very much moki and zydeco !

Some suggestions:

Step 15:

Assuming you don't have a weird rule, but want to turn towns into cities based on a pop limit or PC category, you can use the following function in openoffice:

Code: Select all

=IF(A1>2000;1;0) 
on your third column (use on first cell of the column, and 'fill' the whole column). You can use your S,M,L notation as a condition too (e.g. turn all L into cities)
Thus you no longer need to get the zeros in there using notepad+.

General remark: It is possible to avoid using Openoffice alltogether and instead format the file with some kind of bash/python script. Can certainly do that for removing the quotes from the town names, so the notepad+ step could be completely removed:

Code: Select all

 sed "s/\"//g" < [input_file] > [output_file]
Of course, it would be better if the patched OpenTTD could read in the microdem files directly and show a dialogue where you set all the options, basically:
  • four corners
  • Flag for using PC data (if available)
  • Maximum PC value (1-5)
  • Option group for assignment of S,M,L by PC, population, manual
In case of "manual" above, one could select town-sizes and "city" property from a GUI showing a list of cities?

Wishfull thinking of course. Congrats again on the work so far!
Citizens Celebrate! First train arrives in <insert your favourite town/station name here>!

User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: How to: Semi-automatic real world scenario generation

Post by Zuu » 20 Oct 2013 13:56

moki wrote:his part is really annoying: We need to manually enter the size for every single town - hundreds of them in a big area. For the Jamaica scenario I sorted both the Wikipedia list and my spreadsheet by names. Then I took each town name from Wikipedia, searched for it in the spreadsheet (that contains a lot more towns that we don't need) and entered the size (S,M,L) there. Repeat 102 more times, Yay! Then I sorted the spreadsheet by the size column, moving everything without an entry to the bottom and deleted these entries, leaving me with only the towns for which I entered a size. This is the most bothersome and time consuming step.
In Excel, there is a formula for searching a column for a search string and then pick a value from a column to the right of the matching cell. In the English Excel version I believe this function is called VLOOKUP. I don't use OpenOffice Calc very often, but perhaps there is a similar method there. Using this you don't have to sort the two data sets so that they key value end up on the same rows. Instead just use VLOOKUP to let Excel (or OO) do this work for you.

moki wrote:22. If you did everything right, there'll be no error messages and you'll have a bunch of towns in your scenario. The console will list all the towns that could not be founded (because of difficult terrain, closeness to map edges or other towns) and a sign will be placed in those locations. You just need to look around, find the signs and place those last few towns manually (or just ignore them, if they aren't that important)
Instead of looking around for signs, you can use the sign list (found in the menu that is opened by hold down the mouse on the map button in the toolbar) which shows a list of all signs on the map. You can either work yourself down the list or pick a sign, found town and then remove the sign. If you remove the sign it will disappear from the sign list so that you will not lose track of which signs that you have handled or not. In the game, your own signs can be removed by CTRL+clicking on them. I don't remember if that works in the scenario editor or if you need to use the delete button in the edit sign window.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)

User avatar
romazoon
Tycoon
Tycoon
Posts: 1290
Joined: 20 Jun 2010 23:16

Re: How to: Semi-automatic real world scenario generation

Post by romazoon » 20 Oct 2013 16:34

hi

really sounds like a great feature for scenario makers, thanks a lot for bringing this new feature ;)

unfortunately, i tried quite a few times and i still can t get it to work...I haven t tried something complicated as i just tried with your jamaican heightmap + the towns list file you posted.

so i wonder what i ve done wrong... can you guys maybe point me the right direction ?
Attachments
screenshot#1.png
the error message in game
(60.13 KiB) Downloaded 7 times
Capture.PNG
the town list text file i used (the same as posted by moki.
Capture.PNG (21.34 KiB) Viewed 7036 times

TinyMusic
Tycoon
Tycoon
Posts: 1423
Joined: 02 Feb 2013 02:03

Re: How to: Semi-automatic real world scenario generation

Post by TinyMusic » 21 Oct 2013 11:26

romazoon wrote:hi

really sounds like a great feature for scenario makers, thanks a lot for bringing this new feature ;)

unfortunately, i tried quite a few times and i still can t get it to work...I haven t tried something complicated as i just tried with your jamaican heightmap + the towns list file you posted.

so i wonder what i ve done wrong... can you guys maybe point me the right direction ?
I think you need to state what directory where the .txt file is, so

Code: Select all

import_towns C:/Users...towns-jamaica.txt (or wherever it is)
Formerly known as UseYourIllusion.
Java Scenario Found Here - Version 2 out
[tweɪ̂ pû tɕʰì wɔ̀ mǐlɤ lû tɕʰìŋ nì pɑ́ŋmɑ̌ŋ]

User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: How to: Semi-automatic real world scenario generation

Post by Zuu » 21 Oct 2013 12:25

UseYourIllusion wrote:I think you need to state what directory where the .txt file is, so
Code:
import_towns C:/Users...towns-jamaica.txt (or wherever it is)
If you read the patch, you'll see that the error for "file not found" has a different text than the error message that ramazoon got.

Instead the problem occurs when it tries to read coordinates from the first line in the file.

I don't know if OpenTTD force the locale to something UK/US-ish, so that '.' is used as decimal separator when sscanf looks for floating point values, independent of what the decimal separator that is used on your system. Otherwise the error could occur due to the fact that your locale use ',' or some other character (other than '.') as decimal separator and that is passed on to sscanf which then look for ',' instead of '.' as decimal separator.
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)

moki
Traffic Manager
Traffic Manager
Posts: 131
Joined: 06 Jul 2007 08:48
Location: Wismar, Germany

Re: How to: Semi-automatic real world scenario generation

Post by moki » 21 Oct 2013 12:35

Big update in the first post! Everything just go a lot less complicated.

Thanks again for all your help.


@Tafidis:
I didn't know about the possibilities of IF-functions in OpenOffice. This is very useful and now the new official method, including various "weird rules" ;)

Formatting the whole thing automagically with a script would be awesome, but many users (me included) wouldn't know what to do with that unless it's made into a nice, easy one-click executable. I'm just learning a bit of C++ right now, but I can't write a single line of python, much less a script that sorts and rearranges thousands of more or less incomplete data points. Maybe I'll get around to it some day, but not in the near future.


Reading DEM files looks complicated... It would probably be possible to read ArcASCII files, though. They have a very simple (even human-readable) structure:

Code: Select all

ncols         6000			     //number of columns
nrows         6000			     //number of rows
xllcorner     -80			      //the area's western edge
yllcorner     15			       //the area's southern edge
cellsize      0.0008333333	   //the size of each data point in degrees/the data's resolution
NODATA_value  -9999		       //value for points without data
...followed by an array of the defined size and filled with height data.
Calculating the complete edge coordinates (also of a sub-section of the whole thing) from that is a bit annoying for humans but trivial for a computer. Making one (or even multiple connected) ArcASCII files directly into useable heightmaps with very littly human intervention (except checking the sea level, maybe), should definitely be possible - maybe even loading the ArcASCII files directly into OpenTTD. The more I can automate this process, the happier I am. Some day, we might be able to just click "generate scenario from downloaded data" and OpenTTD would do the rest. Let's keep dreaming ;)


@Zuu:
That first correction isn't necessary anymore with the new data and method. Thanks anyway.
And by "look around" I meant "use the signs list"... I hope, nobody manually searched the whole map for signs. Better change that in the first post :oops:

@romazoon:
That looks just like the errors I got before Zydeco went on an optimizing-spree. Maybe I accidentally uploaded an older version instead of the current one. I updated the file in the first post now. Please download it again and have another try. I'm pretty sure, that's the problem.
The map files are all fine and typing in the complete path for the data file is not necessary when it's saved directly to the OpenTTD main folder. Also the error message would be different, as Zuu stated. It's also not about some decimal-thingy. With my german locale, everything works, even though comma is the official decimal separator and the text has points. The patch needs the US/UK version and nothing else, no matter where you are.
Just download/install again and please report back... we'll get this to work somehow.

User avatar
Tafidis
Traffic Manager
Traffic Manager
Posts: 157
Joined: 19 Oct 2010 19:49

Re: How to: Semi-automatic real world scenario generation

Post by Tafidis » 21 Oct 2013 17:25

What I meant was to make the patch parse the csv file with the population data. It seems to me that steps 9-19 could be replaced with an automatic csv parsing program, which is given the parameters I mentioned in the previous post.

Python is MUCH easier than C/C++. But since you are learning the latter, google "csv parsing with c++" and you should find a nice exercise right there, with the added bonus that you can do all the operations in your list and eventually add it to zydeco's patch :wink:

Again, thank you for the effort and the fantastic tutorial. You cover every little detail of the procedure :bow:
Citizens Celebrate! First train arrives in <insert your favourite town/station name here>!

moki
Traffic Manager
Traffic Manager
Posts: 131
Joined: 06 Jul 2007 08:48
Location: Wismar, Germany

Re: How to: Semi-automatic real world scenario generation

Post by moki » 21 Oct 2013 20:35

True, Python doesn't look that complicated, but at the moment I find C++ more interesting. Scripts can be really useful, but writing my own patches or building patch packs in the near future seems way cooler right now. I just started learning, so it may take a while to finish, but I'll take a working CSV parser as my first big exercise. Complete integration with Zydeco's patch seems like a good final goal. Sadly, there's still the tiny bit of real life that needs to be attended from time to time, though I think I might import that into OpenTTD as well :lol:

Without all the manual restructuring and rearranging of coordinate data, a whole map with cities could be finished in a matter of minutes, not hours. The thought boggles my mind, especially because I can still remember spending days or weeks on a single (256x256) map in good old TTD.

Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4738
Joined: 09 Sep 2007 05:03
Location: home

Re: How to: Semi-automatic real world scenario generation

Post by Alberth » 21 Oct 2013 20:41

:o more coders! :)

you may be interested in http://wiki.openttd.org/Terkhen/Scenario_format which is a proposal to make an open scenario file format that does not have the newgrf limitations of todays file format. In my view, that would be a good direction to open up OpenTTD for the kind of data you extract from geo-information sites.

User avatar
romazoon
Tycoon
Tycoon
Posts: 1290
Joined: 20 Jun 2010 23:16

Re: How to: Semi-automatic real world scenario generation

Post by romazoon » 21 Oct 2013 21:45

Thank you all for taking your time to answer, i really appreciate that !

i tried with the new windows binary you posted, and i still get the exact same result.

now about Zuu suggestion, i wonder if this could maybe be related to my problem since i seems to be the only one having the problem (or am i really? ), i use a german native computer, with win 7 family edition, wich was originally setted up in german (for my girlfriend), but i m french and i m now the principal user of this computer, i used "vistalizator" to turn most of it in french... could it bring some kind of problem with the coma and dot as Zuu suggested ??
moki wrote:The patch needs the US/UK version and nothing else
I used the windows binary so am i right thinking this doesn t concern me ?

moki
Traffic Manager
Traffic Manager
Posts: 131
Joined: 06 Jul 2007 08:48
Location: Wismar, Germany

Re: How to: Semi-automatic real world scenario generation

Post by moki » 23 Oct 2013 14:50

Little update in the first post... found a way to optimize the heighmap generation (step 5) a little more.


@romazoon:
That's really strange. My computer is german native as well, with Windows 7 64bit - no changes to the locale or number formats and I can't replicate the problem. By the thing I wrote about US/UK version, I meant the number format. The game needs the numbers like 24.567 (point as decimal separator), not 24,567 (as used in almost all other countries). Having a german or french version of Windows or setting different languages in OpenTTD does not have any influence on that.
I'm sorry, but I don't know where the problem could be yet. I'll have to try a few other things before I can help you. I'll contact you when I find a new solution. It's probably something really obvious, as always ;)


@Alberth:
More coders, indeed. I'm still struggling with the very basics, but everyone starts small, right? :P
I read about that new scenario format a while back, but completely forgot about it. The data I'm using right now could definitely be converted and used with this. Scenarios not being universally usable always irked me. As I said, I'm probably not ready to contribute anything meaningful, but I'll have a look and share any ideas I may have.



Meanwhile, I encountered another little problem:
Sometimes there's just too much population and too much data about it. I tried to make a map of the UK and got the result in the attached screenshot. This already has all towns below 10000 population removed and more than half the towns failed to be founded... England still looks too crowded while Scotland is almost completely empty. I could go to a minimum of 50000, but then Scotland would be a barren wasteland (which I don't believe it actually is) while England and Wales look relatively normal.
The only way I could think of to make this work without too much manual intervention is randomly thinning the data for medium and small towns by a factor of 5 or even 10. Removing random towns (even ones with 10000+ population) doesn't fit the concept of real world scenario generation anymore, though... any other suggestions?
Attachments
map_uk_1.jpg
Way too much town data...
(132.55 KiB) Downloaded 5 times

TinyMusic
Tycoon
Tycoon
Posts: 1423
Joined: 02 Feb 2013 02:03

Re: How to: Semi-automatic real world scenario generation

Post by TinyMusic » 23 Oct 2013 18:15

That isn't too bad, in fact I like it that way (more towns, more railway), but I agree that Scotland looks empty
Formerly known as UseYourIllusion.
Java Scenario Found Here - Version 2 out
[tweɪ̂ pû tɕʰì wɔ̀ mǐlɤ lû tɕʰìŋ nì pɑ́ŋmɑ̌ŋ]

User avatar
SwissFan91
Tycoon
Tycoon
Posts: 2384
Joined: 08 Feb 2009 18:36
Location: Alberta, Canada

Re: How to: Semi-automatic real world scenario generation

Post by SwissFan91 » 23 Oct 2013 18:39

UseYourIllusion wrote:That isn't too bad, in fact I like it that way (more towns, more railway), but I agree that Scotland looks empty
Indeed, as long as that map is large enough, many towns are fun. Scotland is an issue although it wouldn't take much for the player to place a few towns there manually considering the amount of time saved by the automatic placement of all of those towns in England.
Image
Total Alpine Replacement Set: Industry, Town, Objects
**ATTENTION**: If anyone would like me to help draw snow stages in any of their GRFs let me know. I genuinely enjoy drawing them.

zytok
Engineer
Engineer
Posts: 15
Joined: 28 Nov 2008 15:47

Re: How to: Semi-automatic real world scenario generation

Post by zytok » 25 Oct 2013 21:20

Moki, any chance you could post your UK map as a scenario to have a little play with?

moki
Traffic Manager
Traffic Manager
Posts: 131
Joined: 06 Jul 2007 08:48
Location: Wismar, Germany

Re: How to: Semi-automatic real world scenario generation

Post by moki » 27 Oct 2013 21:37

Oh well, I guess it's all about personal taste... I prefer when there's some distance between the towns, so they can grow during the game without the whole map getting covered in houses. Right now, the Manchester/Leeds area is extremely cluttered and the area around London is a bit chaotic as well (especially if you add some of the towns that can't be founded automatically)
I attached the scenario file (without trees and industries) and map generation data for anyone to play around with. The recommended size is 2048x2048, but making it smaller is possible. The text file contains all towns above 15000 population and is sorted in a way that places big towns and cities first, to make it easier to generate smaller versions without too much manual intervention. I really don't recommend anything below 1024x1024, though.
Feel free to do with the files whatever you want. If you find some way to optimize the scenario generation even more, please let me know.

There'll be another update to the tutorial tomorrow.
I compiled a single spreadsheet with all the cities in the world (about 200000 of them) that will make the whole task even easier, because you don't need to collect data for multiple countries if you make a scenario that spans a big area. I quickly generated a map of Europe with 526 towns and there were no serious problems. Steps 8 to 11 will basically be unnecessary and some others become less complicated. Stay tuned ;)

And I think I may have found out, why romazoon (and others too, probably) can't get the patch to run and also how to get town names with special characters to work.
As I suspected, it's about ANSI/ASCII vs UTF-8 character encoding. I don't have the definite solution yet, but could reproduce the bug on my system. I'll probably be able to solve the problem tomorrow.
Attachments
UK-IE-v2_cities.scn
Scenario made with r25868
(418.95 KiB) Downloaded 107 times
HEIGHTMAP_UK-IRE.PNG
UK and Ireland heightmap
(926.07 KiB) Downloaded 4 times
towns-uk-ire.txt
Towns file for UK and Ireland (and a bit of France)
(23.99 KiB) Downloaded 121 times

Post Reply

Return to “General OpenTTD”

Who is online

Users browsing this forum: Google [Bot] and 8 guests