Author Topic: Cities and rivers placement with heightmaps  (Read 10832 times)

0 Members and 1 Guest are viewing this topic.

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4224
  • Total likes: 168
  • Helpful: 148
  • Languages: EN, DE, AT
Re: Cities and rivers placement with heightmaps
« Reply #35 on: November 07, 2012, 08:17:58 AM »
I do not see any advantage of XML over script. It is just another representation of data.

I dream rather of a different approach: Add a map-editor mode to simutrans, which records all the actions a player does (founding cities etc). If the player is satisfied with the result, then save these actions as script and the map as ppm-file.

Parsley, sage, rosemary, and maggikraut.

Offline kierongreen

Re: Cities and rivers placement with heightmaps
« Reply #36 on: November 07, 2012, 08:32:38 AM »
Indeed, XML for the sake of XML seems pointless. The scripting language approach looks a lot easier to read to me.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 8749
  • Total likes: 305
  • Helpful: 229
  • Languages: De,EN,JP
Re: Cities and rivers placement with heightmaps
« Reply #37 on: November 07, 2012, 10:22:33 AM »
With the current tool calling structure in place, such a generation of scripts during map mode does seem quite straight ahead (but will still require some typing on the code side).

Maybe we need a certain requirements for tools. I.e. when adding/extending a toll, this should be avalable for scripting as well as returning a function name for it (the parameters are anyway sent as a string).

Offline An_dz

  • Web Admin
  • Administrator
  • *
  • Posts: 2593
  • Total likes: 289
  • Helpful: 89
  • D'oh
    • by An_dz
  • Languages: PT, EN, (it, de)
Re: Cities and rivers placement with heightmaps
« Reply #38 on: November 07, 2012, 12:53:14 PM »
I do not see any advantage of XML over script. It is just another representation of data.

I dream rather of a different approach: Add a map-editor mode to simutrans, which records all the actions a player does (founding cities etc). If the player is satisfied with the result, then save these actions as script and the map as ppm-file.
Perfect. XML gets so big that no one will be stupid enough to mess with.

Offline Fabio

  • Devotee
  • Administrator
  • *
  • Posts: 2898
  • Total likes: 6
  • Helpful: 91
  • The Pak128 Guy
    • Visit me on Facebook
  • Languages: EN, IT, RO, FR
Re: Cities and rivers placement with heightmaps
« Reply #39 on: November 07, 2012, 12:57:10 PM »
Image+Script is good enough IMHO.
It would be nice if they could be bundled together (e.g. releases in .zip which you drop in your maps folder without extracting).
IIRC, the Open Document formats (.odt, .ods etc...) follow similar system, as they are nothing but a zip of several (xml) files.
This system could apply to scenarios as well.

Offline sdog

Re: Cities and rivers placement with heightmaps
« Reply #40 on: November 07, 2012, 09:04:28 PM »
Image+Script is good enough IMHO.
It would be nice if they could be bundled together (e.g. releases in .zip which you drop in your maps folder without extracting).
IIRC, the Open Document formats (.odt, .ods etc...) follow similar system, as they are nothing but a zip of several (xml) files.
This system could apply to scenarios as well.

A  container is a good idea. If the need arises it is also easily extendable with further scripts or data, without changing the map file in the users perception.

edit:
We ought to put a tag file into it too, saving meta information about the map. This might be especially useful if we'd provide dowload pages etc.

edit:
Allowing a simuconf.tab in it, which could override pak-set settings might or might not be a good idea (perhaps with a check for pak-set and compatible version of it)

Since bz2 is already linked, it would be a natural choice, since it wouldn't be required to pack the large terrain data files for map sites anymore.

« Last Edit: November 07, 2012, 09:12:00 PM by sdog »

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 8749
  • Total likes: 305
  • Helpful: 229
  • Languages: De,EN,JP
Re: Cities and rivers placement with heightmaps
« Reply #41 on: November 07, 2012, 10:33:59 PM »
bz2 is not a container format. PNG is, it is actually a subset of HDF.

Offline sdog

Re: Cities and rivers placement with heightmaps
« Reply #42 on: November 07, 2012, 10:42:58 PM »
thanks prissi, been implicitly thinking tar.  tbz2

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 8749
  • Total likes: 305
  • Helpful: 229
  • Languages: De,EN,JP
Re: Cities and rivers placement with heightmaps
« Reply #43 on: November 08, 2012, 04:25:57 PM »
If the map is generated by simutrans, the script could save the random seed and the map number and coudl generate the same map without the need to supply even a heightmap. This would also greatly reduce the sizes of scenarios.

Offline asaphxiix

Re: Cities and rivers placement with heightmaps
« Reply #44 on: September 24, 2013, 03:10:39 PM »
Just bringing this thread up once more in hopes it be implemented.

And reminding of prissi's statement before:

Simutrans can read tab files, and the maps can be save as (which are quite small, RLE compressed). Just somebody is needed to add a routine that tries to open a tab-file with same name as the map, and if found just call a parser for such files. Most of the routines are there, they just need to be parse and called.

Offline yorkeiser

Re: Cities and rivers placement with heightmaps
« Reply #45 on: June 01, 2016, 01:50:25 PM »
Hi all, I still re-up, hoping some willing developer will give this a look, sooner or later ☺

Offline Leartin

Re: Cities and rivers placement with heightmaps
« Reply #46 on: June 01, 2016, 02:40:38 PM »
I think all the usual willing developers already looked and commented on this 4 years ago.
But it's still valid, and something severely missing from Simutrans.

Offline yorkeiser

Re: Cities and rivers placement with heightmaps
« Reply #47 on: June 02, 2016, 12:34:09 AM »
Sorry I'd give an help but I have no time to re-configure all development environment... Did that some years ago, it really takes a lot of time

Offline BlackMagic09

Re: Cities and rivers placement with heightmaps
« Reply #48 on: June 11, 2016, 09:12:21 PM »
Hi there,
I'm a newbie but I like the idea as much as you guys and wil try to code a solution.
I think for a start we need 2 typs of positioning:
a) from some graphics file (I will stick to .ppm because that's what is allready implemented)
b) from some list (formated readible textfile)

So the creating process looks like this:
1.draw heightmap from .ppm
2. - n. draw objects from further .ppm files or place them directly from some list (it shouldn't matter wether it's a river or something else)

Right now I'm trying to find the locations where the mapcreator is creating the heightmap from the graphic file.
Thats how far I've got up to now:
welt.cc, l564-570 -> start MapCreator      komp==&start_game
welt.cc l565 load_heightfield(default_settings)
onwards everything in simworld.cc
-> l6359 load_heightfield(settings_t* const sets)
   -> l6366 init(default, z)
-> l1457 init(settings_t* const sets, sint8 const* const h_field)
   -> l1532 init_felder()
-> l899 init_felder()   -> l913 get_karte()->init()   just update relief?
   -> l1534 enlarge_map(default, z)   extending map?
   -> l1547 fabrikbauer_t::neue_karte()   placing factories
   -> l1570 fabrikbauer_t::verteile_tourist(...)   placing attractions

So where is the command for creating all points from the .ppm file?
Thanks to any help on this.

Greetings Alex

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 8749
  • Total likes: 305
  • Helpful: 229
  • Languages: De,EN,JP
Re: Cities and rivers placement with heightmaps
« Reply #49 on: June 11, 2016, 10:56:09 PM »
search for heightmap (Which will be soon have full PNG support too).

The placing of industries and cities could be done in a scenario (as discussed before).

Essentially you would call the same routines the factory building tool or the city building too does. (Look in simtools).