News:

Simutrans Tools
Know our tools that can help you to create add-ons, install and customize Simutrans.

tunnel terraforming

Started by kierongreen, July 21, 2014, 01:45:38 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

kierongreen

Attached patch tries to alter terrain at tunnel exit to permit construction. Tested with pak64 and pak128.Britain nightlies.

TODO:
Calculate costs of terraforming accurately (this is a bodge at the moment).
Consider terraforming tunnel entrances too?

Consider terraforming bridge ends too?
Consider double height tunnel exits for double height paks e.g. pak64 (not relevant for half height paks) to reduce required terraforming.

Ters

The lack of variation in tunnel construction error messages is getting even more confusing.

It does a decent job at terraforming, and there isn't much code to it either. Obstacles near the exit isn't handled as well as they could be, but since this change seems to utilize existing terraforming algorithms, that's more of a possible improvement in them.

As for terraforming the entrances, it does raise the question of at which level the player actually want the entrance. At the lower of the two seems like an understandable assumption, but it is much easier for the player to manually terraform correctly at the entrance than at the exit, which might be far away. I think entrances can be done separately later, so as not to stall this.

Bridge ends sound like a good idea as well. Even though bridge ends are more double height capable than tunnel openings, that only works when the levels are aligned. The logic for terraforming should be pretty much the same as far as I can imagine in the heat.

kierongreen

The only way to make the terraforming algorithms more capable of dealing with obstacles would be to allow them to create cliffs. The question then is when to use cliffs and when to use slopes.

Ters

My idea is that the game should try to create a slope, and if that fails, try cliffs. This would be on a tile by tile basis. For bridges and tunnels in particular, preferring cliffs might make sense, but that would mean more dedicated code. No need to worry about that right now. Some automatic terraforming for tunnels has been a long awaited feature, so best to get the basics in place and committed. I think the two things that should be done before this is committed is getting precise error messages, and perhaps the economics and bridges. After that, double height tunnel openings seems the next logical step. Bridge ends that go up one level while the terrain slopes down one level might also be nice, although some simple terraforming will do the job in most cases.

kierongreen

Added tunnel exit terraforming in 7270 with a bit of tidying (and annoyingly having to add in some code I'd just taken out earlier this evening!).

Dwachs

Regarding your question:
Quote
+// TODO: this is rather hackish as 4 seems to come from nowhere but works most of the time
+// feel free to change if you have a better idea!
The functions raise_all / lower_all returns the number of tile corners that changed height. It is divided by four for historically reasons: The cost do raise one corner of the grid is set in the settings. Raising one grid corner is equivalent to raise one corner of all affected tiles - in total four corners -> divide by four. Hope this make sense.
Parsley, sage, rosemary, and maggikraut.