News:

Do you need help?
Simutrans Wiki Manual can help you to play and extend Simutrans. In 9 languages.

Factory Locations: Ports, Mills, Mines

Started by wlindley, September 14, 2009, 02:56:12 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

The Hood

This looks great - plenty of industries only get placed on shores or rivers. I'll look to include this into pak128.Britain soon with the new industries that I'm working on. Is this in the nightlies yet?

Dwachs

Not committed yet.

There is one question: if factory builder does not find a suitable spot (climates + position constraint), then what should be done? Ignore all constraints (climate and position) or only climate?
Parsley, sage, rosemary, and maggikraut.

Ters

I think factories will most likely look out of place if location is violated, than when climate is violated.

wlindley

Agree, location is more important than climate.

Building a fishing port anywhere but on a shore would look wrong, but building a sawmill in a forest-and-tree-less network game might not be so bad. 

For the special case of the sawmill, would it be sufficient for a pakset to supply both a "forest-only" sawmill (presumably just the buildings) as well as a "doesn't-care-about-forest" version (presumably with its own 'fields' of trees)...?

If supplying two variations of the industries (one with, one without the location restriction) in a pakset is sufficient, then the solution is surely to ignore climates but not location when failing to find good locations.

jamespetts

I agree with Ters and W. Lindley for the reasons given.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

The Hood


prissi

The recently renovated version of the factory builder first tries to build for every factory (obeying the distribution counter) with all restrictions. Then, if no suitable place was found for any of them, the climate restriction is lifted in the second round. It is easy to add a third round, that would lift the locations restriction too.

jamespetts

It may be better to have fewer industries than the player asked for than to have industries in silly places.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Ters

The builder should rather try to build a different factory chain if location can't be satisfied.

prissi

Well, then you may up with almost no industries in many game, especially when the factory radius is set to 50 or so.

Fabio

And why not to lift the radius instead in this case?


Sent from my iPhone using Tapatalk

jamespetts

If the player is notified about this, the player will understand what is wrong and be able to have another go with different settings.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

prissi

Searching locations is very cpu intensive. Hence if during seeding of a new industry the computer grinds to a halt for several seconds, people may be confused or even suspect a crash. But you can already set the radius to whatever you like.

Even an industry at the waterside will still have its foundations. So the visuals are not 100% convincing. (And there are places like the Aral lake where the lighthouses are now surrounded by miles of desert.

to me, I think this should be rather a setting, if you want incomplete chains or non-matching graphics. (Especially remembering the many error reports about the game building incomplete industry chains when climates were introduced.)

Ters

Quote from: prissi on January 20, 2014, 04:03:36 PM
(And there are places like the Aral lake where the lighthouses are now surrounded by miles of desert.

True, but I don't think they are still operating. If a fish farm ended up in the middle of the desert because the lake dried up, the fish farm would become a monument to the disaster that had taken place and not something that produced fish.

jamespetts

Quote from: prissi on January 20, 2014, 04:03:36 PM
to me, I think this should be rather a setting, if you want incomplete chains or non-matching graphics. (Especially remembering the many error reports about the game building incomplete industry chains when climates were introduced.)

This seems sensible to me.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Dwachs

here is an update.

How should this setting be implemented to force location constraint to always be respected? a global pakset-wide setting? or per factory?
Parsley, sage, rosemary, and maggikraut.

prissi

Probably a pakset setting: force_factory_maxradius, force_factory_cllimate, force_factory_location

The latter might also be used to prevent city industries outside of the city limits.

wlindley

For "city" factories, shouldn't the search zone be the boundaries of the city-limits?  So after picking a random location, determine which city it's in, and use the city-limits rectangle for the search zone.

It would be awfully nice if we could code for "shops" which would select their city as above, then find all shops (factories with no output goods) within those city limits, and build immediately adjacent to an existing shop (if there is one).  In the case of no free tiles next to an existing shop, demolish and replace an existing building less-than-or-equal-to the new shop's passenger level.  That would give us the long-desired "high street" effect especially in pak128.Britain.

Ters

Not all city industries are of the kind that naturally flock around existing stops at the core of the city. In pak64, most of them are of the type usually (at least where I live) built at the edge of cities.

The Hood

I like wlindley's suggestion but as Ters points out it doesn't suit all city factories. Perhaps an additional location parameter - "central" or "highstreet" or similar?

Fabio

I second The Hood's idea. And if it's not too far fetched, also apply this location improvement to attractions.


Sent from my iPhone using Tapatalk

kierongreen

So maybe a city centre industry location as well... (edit other people got there first!)

wlindley

Can we use the clusters= parameter to group factories?  In besch/writer/building_writer.cc:


        if (!STRICMP(type_name, "res")) {
                extra_data = get_cluster_data(obj);
                gtyp = gebaeude_t::wohnung;
        } else if (!STRICMP(type_name, "com")) {
                extra_data = get_cluster_data(obj);
                gtyp = gebaeude_t::gewerbe;
...
        } else if (!STRICMP(type_name, "fac")) {
                utype    = haus_besch_t::fabrik;
                enables |= 4;
        } else { ...


Make a copy of the extra_data = get_cluster_data(obj); line just before enables |= 4 and ... well, then we just need to handle that flag in the factory creation code.  extra_data isn't used by factories currently; this would make it parallel res,com,ind.

Happily, this way, we could force certain shops in Pak128.Britain to cluster with the row-houses that look the same way.

prissi

@Dwachs: Did you incorporated this patch? Or do you have it still somewhere?

Dwachs

I did not incorporate it. Have to look for it.
Parsley, sage, rosemary, and maggikraut.

Dwachs

Here is an updated patch. Feel free to modify etc.
Parsley, sage, rosemary, and maggikraut.

Yona-TYT

I really like this, I hope it will be implemented soon. ;D ;D ;D

Regards.! ;)

jamespetts

Interesting! I am not sure whether this patch enables something that I mentioned back in 2009, which is a constraint forcing attractions to be built on the shore, allowing for specific attractions such as pleasure piers and beaches that were important to the 19th century tourist industry?

This will certainly be useful for water mills, however (although does this force the alignment so that it is possible to make sure that the mill wheel always faces the river?).
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Leartin

Quote from: jamespetts on September 11, 2017, 05:13:44 PM
Interesting! I am not sure whether this patch enables something that I mentioned back in 2009, which is a constraint forcing attractions to be built on the shore, allowing for specific attractions such as pleasure piers and beaches that were important to the 19th century tourist industry?

This will certainly be useful for water mills, however (although does this force the alignment so that it is possible to make sure that the mill wheel always faces the river?).

Sadly, I don't think that works as such:

Quote from: Dwachs on January 06, 2014, 07:39:13 PM
here is a quick patch. it adds the following options to the location parameter:

river: one tile of factory adjacent to river tile
shore: one tile of factory on a sloped shore tile
forest: more than X trees on the tiles covered by the factory, X=area of factory

The full factory would be on land, not in the sea, there is no hint that rotation would apply, and probably worse - since it needs to be a sloped shore tile, the building will not be at water level, but above.
This patch can not be used to tie building graphics to the surroundings, I'd say it's mostly a gameplay thing - eg. you can have a fish farm in water and the fish-canning-factory at a shore, that way you have a high chance that you can connect the two directly via fishing boat (if they are at the same body of water)

Though if you think of it as a step by step process, this patch is the step about location. Rotation towards things other than roads could be a second step. If then there was a way to have things on shore without building a basement, pleasure piers would be doable - even though every part in water would not actually be in water but offset-shenanigans.

jamespetts

Quote from: Leartin on September 12, 2017, 05:08:01 AM
Sadly, I don't think that works as such:

The full factory would be on land, not in the sea, there is no hint that rotation would apply, and probably worse - since it needs to be a sloped shore tile, the building will not be at water level, but above.
This patch can not be used to tie building graphics to the surroundings, I'd say it's mostly a gameplay thing - eg. you can have a fish farm in water and the fish-canning-factory at a shore, that way you have a high chance that you can connect the two directly via fishing boat (if they are at the same body of water)

This is already possible without this patch, and it is done in Pak128.Britain.

QuoteThough if you think of it as a step by step process, this patch is the step about location. Rotation towards things other than roads could be a second step. If then there was a way to have things on shore without building a basement, pleasure piers would be doable - even though every part in water would not actually be in water but offset-shenanigans.

This would certainly be a useful thing.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

prissi

That patch was also sitting too long. It seems to cause no unexpected side effects, so it went into r8571 with a few bugfixes. On maps without rivers or forests, those settings will be ignored to still build those factories.

Vladki

Is there any summary for pak maintainers what are the new options? What was implemented, what was only discussed? How it differs from previous location = water, or climate = water?

Leartin

Quote from: Vladki on September 18, 2018, 08:37:41 PM
Is there any summary for pak maintainers what are the new options? What was implemented, what was only discussed? How it differs from previous location = water, or climate = water?
river: one tile of factory adjacent to river tile
shore: one tile of factory on a sloped shore tile
forest: more than X trees on the tiles covered by the factory, X=area of factory

The previous option (climate=water, location=land) didn't really work for multi-tile buildings, as all tiles would have needed to be on the shore, while the new option only requires one tile. It also allows for the actual ground climate to be set, which probably does not matter too much, but could become important if map generation changes such that climates are not dependent on height anymore, hence all climates would have shore access.

DrSuperGood

Forest based placement might need an exception if a map was created with no trees explicitly turned on. I know one does not really need to turn trees off anymore but some servers still like to do so to keep the save file size small. In such a case any place normally suitable for trees could pass the test even if there are no trees.

Leartin

Prissi already said that if there are no rivers or no trees, the locations won't keep factories from spawning.

I suppose one could save the information where forests are supposed to be in the map, and use that rather than an actual tree count, which would mean that whether trees exist as objects would not influence the factory placement, and they would not be placed randomly in climates that have trees everywhere; With a sideeffect of potentially allowing to have "no trees" as something that can be toggled during a game (destroy all trees / plant new trees in roughly the same locations).
Perhaps something to keep in mind if anyone is going to change how forests are distributed in the first place, but otherwise probably not worth it.