The International Simutrans Forum

 

Author Topic: Climate restrictions on fields  (Read 992 times)

0 Members and 1 Guest are viewing this topic.

Offline Leartin

  • Heir-Benevolent-Dictator-Apparent
  • Devotee
  • *
  • Posts: 1469
  • PAK-DEV P192C
  • Languages: DE, EN
Climate restrictions on fields
« on: May 11, 2020, 06:46:03 AM »
Fields seem to inherit the climate restriction of the factory they belong to. If a factory spawns in the wrong climate (due to not being able to find a spot otherwise) it's fields won't spawn. This seems particularly bad considering fields are mostly used for agricultural products, which are most likely to be climate specific. As a result, the factory is barely productive and might as well not exist.

I think this is behaviour that appeared when fields where allowed to spawn on different height levels, I don't think I saw it before that and it would make sense, since in the olden days the climate on the same height level would always be the same, so why check it?


Possible solutions I can think of:
- Fields ignore climates entirely
- Fields check what climate(s) their factory is on and may spawn on it/them
- Fields have their own climates (but still inherit from the factory for compatibility if they are not specified)
[Yes, that last one is more of a feature request. It allows the pak designer to choose whether it's better to ignore climates or have the factory without fields on a case-by-case basis, with the bonus of a visual change, eg. sugar cane in the alps being shown in glasshouses with lower productivity]
- Completely rewrite factory spawning so incomplete chains can't be a problem. *caugh caugh*

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 10230
  • Languages: De,EN,JP
Re: Climate restrictions on fields
« Reply #1 on: May 11, 2020, 02:47:08 PM »
The climate can change from each tile, Just the landscape generator is very bad at doing this automatically. One of the eternal construction areas ....

Either change climate by hand, or you have to live with base production, since this factory was only build to avoid broken chains in the first place. Having too much specific factories with fields will make this occurrence much more likely.

Offline Leartin

  • Heir-Benevolent-Dictator-Apparent
  • Devotee
  • *
  • Posts: 1469
  • PAK-DEV P192C
  • Languages: DE, EN
Re: Climate restrictions on fields
« Reply #2 on: May 12, 2020, 12:02:46 PM »
The climate can change from each tile, Just the landscape generator is very bad at doing this automatically. One of the eternal construction areas ....
I just went back and checked in a version from 2017 to make sure - if a strawberry plantation spawned in the desert, the fields would spawn around it in the desert. If you manipulated the climate manually to have one green tile in the desert and placed the strawberry plantation there, where it could naturally spawn, the fields would still spawn on desert tiles. It's only when fields on different levels were introduced that a climate check was added and this problem emerged. It has nothing to do with the landscape generator.

Quote
Having too much specific factories with fields will make this occurrence much more likely
Yes - the bug is more prevalent. So now paksets should remove the climate-bound fielded factories they included before the bug existed, when they worked as intended? I don't think so.

The bug can be removed simply by deleting line 1014 in simfab.cc where the climate is checked. That's not optimal, since it means fields may appear on the wrong climate near the factory, but that's what it did 3 years ago and did not cause complain by itself.
It can be changed to include the climate the factory stands on by extending the line to this:
Code: [Select]
(get_desc()->get_building()->is_allowed_climate(welt->get_climate(pos.get_2d()+koord(xoff,yoff))) || welt->get_climate(pos.get_2d()+koord(xoff,yoff))==welt->get_climate(pos.get_2d()) && Which should cause it to allow fields on all tiles which share the climate with the climate the factory is on (I suppose just the northwest corner of the factory, but that's good enough)

It could also do this:
Code: [Select]
(get_desc()->get_building()->is_allowed_climate(welt->get_climate(pos.get_2d()+koord(xoff,yoff))) || !get_desc()->get_building()->is_allowed_climate(welt->get_climate(pos.get_2d()))) && which should make it so if the factory isn't placed on an eligable climate, the result of the climate check for fields is irrelevant.


Can't test either of these right now, but it doesn't seem so hard that having the bug could be a better option.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 10230
  • Languages: De,EN,JP
Re: Climate restrictions on fields
« Reply #3 on: May 14, 2020, 12:16:56 PM »
A factory is only placed on the wrong locations after Simutrans had many unsuccessful tries for all possible producers of that good. Simutrans does this only as the very last resort. For pakset, consumers should have the same climate as producers (or at least large overlap), so this situation is less likely.

Spawinign fileds at the same height is considered an error and was (correctly) removed due to a bug report.

Offline Leartin

  • Heir-Benevolent-Dictator-Apparent
  • Devotee
  • *
  • Posts: 1469
  • PAK-DEV P192C
  • Languages: DE, EN
Re: Climate restrictions on fields
« Reply #4 on: May 14, 2020, 05:11:17 PM »
Spawinign fileds at the same height is considered an error and was (correctly) removed due to a bug report.
Yes. Spawning factories that require fields without fields is also an error, and this is the bug report. Why wouldn't it be? Even considering it only happens if a failsafe is triggered, you'd still want the failsafe to work properly. Not acknowledging it is a bit like saying it doesn't matter if holes are in safety parachutes, since their only use is if the plane fails.

All you are doing is explaining that it rarely happens. But clearly, it's still important that factories spawn functionally when the conditions aren't met - you reacted to the location issue for forests and rivers immediately. Fields shouldn't be an exception. Even if you don't want to look further into this and waste time on a proper solution, just remove line 1014 where the climate check happens and you restore the previous behavior while leaving the bugfix for other height levels intact.

Or do you explicitely WANT this behaviour for some reason?

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 10230
  • Languages: De,EN,JP
Re: Climate restrictions on fields
« Reply #5 on: May 15, 2020, 02:12:52 PM »
Making a pakset where essential factories of a chain are not available in all climates may be also considered as a bigger error. But forget these childish quarrels.

I will not make fields in unmatching climate. Terraform the surrounding tiles is easily available if the player is unhappy, this is even free on many pak sets.

Offline Leartin

  • Heir-Benevolent-Dictator-Apparent
  • Devotee
  • *
  • Posts: 1469
  • PAK-DEV P192C
  • Languages: DE, EN
Re: Climate restrictions on fields
« Reply #6 on: May 16, 2020, 10:42:53 AM »
I will not make fields in unmatching climate.

Okay, at least it's clear that it's your active decision to block solutions to a problem, rather than fixing it.

No, I'm not forgetting these "childish quarrels", 'cause this matters to me. I created fielded factories in the good faith that they would work even if the climate is not on the map, because they did. Someone changed the game, now it doesn't work anymore. It is so clear that it is a bug, and all your excuses are just the same for most other bugs, since almost everything can be fixed by the player.

Anyway, thread can be closed then - but don't you dare move it to "solved bugs"

Offline Flemmbrav

  • Devotee
  • *
  • Posts: 215
  • PAK-DEV P192C
  • Languages: DE, EN
Re: Climate restrictions on fields
« Reply #7 on: May 16, 2020, 11:04:10 AM »
As far as I am concerened, not making every kind of industry available for every climate is a feature.
It kind of gives the climates a more individual touch.

Let me show you on an example:
There really is no reason to grow corn high up in the alps. At least not, if other climates are availabe. Especially if the standard settings of the pakset include the climates used for corn.
The climates used for corn are close to the sea level, and thus represent more flat areas. This makes the industry feel "home" in these climates.
But if the player did decide that they only want to play in the climate used high up in the alps, what is supposed to happen?
The flatter parts of the map will be in this climate too. So the idea behind the whole climate thing doesn't strike at all. Might be a bit boring, but that ain't really my issue, is it?
BUT even these people might as well want to see the fields of their corn too, right?

Offline Yona-TYT

  • Devotee
  • *
  • Posts: 1507
    • Simutrans-BLOG
  • Languages: ES
Re: Climate restrictions on fields
« Reply #8 on: May 16, 2020, 11:07:43 AM »
Spawinign fileds at the same height is considered an error and was (correctly) removed due to a bug report.

Wouldn't it be better to stop for a moment and look for a solution for this that makes us all happy?.  8)
You always have to look for the way of understanding IMHO.  :police:

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 5670
  • Languages: EN, NO
Re: Climate restrictions on fields
« Reply #9 on: May 19, 2020, 05:42:44 AM »
Pak sets should either be allowed to restrict industries to specific climates, and then the game should respect this, or the pak sets should not be able to restrict industries to climates. Anything else would just be odd and confusing.

Offline Leartin

  • Heir-Benevolent-Dictator-Apparent
  • Devotee
  • *
  • Posts: 1469
  • PAK-DEV P192C
  • Languages: DE, EN
Re: Climate restrictions on fields
« Reply #10 on: May 19, 2020, 09:18:55 AM »
Pak sets should either be allowed to restrict industries to specific climates, and then the game should respect this, or the pak sets should not be able to restrict industries to climates. Anything else would just be odd and confusing.

The game should "respect" pak choices on climates. However, I'm not sure we are on the same terms what that means. The choices the pakset make are for WHERE the factory should spawn, not WHETHER it should spawn. If you had a vegan daughter, she chose what to eat. It would not be respectful to cook a meaty dish and tell her she can eat or go hungry, forcing her to choose whether to eat. It would be respectful to accomodate, at least cook veggie sides.

How does that apply to the game? Simply put, try to place the whole chain, and if it's not possible at all, scrap the complete chain and try a different one, until you find one that's complete. Therefore, whenever a chain does spawn, it's both complete and every factory is in the correct climate, which is what we ideally want. Of course, the implementation would not be that straightforward. I do have my thoughts on it, but I won't be able to act on them and can't expect anyone else to start a huge project like that.

Offline Vladki

  • Devotee
  • *
  • Posts: 3442
    • My addons, mostly roadsigns, pak128.cs
  • Languages: EN, CS
Re: Climate restrictions on fields
« Reply #11 on: May 19, 2020, 01:23:07 PM »
Simply put, try to place the whole chain, and if it's not possible at all, scrap the complete chain and try a different one, until you find one that's complete.

That's what I thought. The required supplier cannot be placed in correct climate, scratch the whole chain. If chain is generated by hand - fail too.

But a player (as public hand) may decide to build the factory by hand, with ignore climates checked. In that case, players intention (to grow corn in alps) should be honored, and fields should ignore climate too. So the check for growing fields should be - is the factory base on correct climate? If not ignore climates too.

However it can happen that there is suitable place for just the factory, but no fields. What then? I would leave it without fields (and public player can add suitable climates nearby).


Offline Freahk

  • Devotee
  • *
  • Posts: 1313
  • Languages: DE, EN
Re: Climate restrictions on fields
« Reply #12 on: May 19, 2020, 01:35:11 PM »
However it can happen that there is suitable place for just the factory, but no fields. What then?
That should be a very rare case on most maps. It's fine to leave such without fields imho.

Offline Leartin

  • Heir-Benevolent-Dictator-Apparent
  • Devotee
  • *
  • Posts: 1469
  • PAK-DEV P192C
  • Languages: DE, EN
Re: Climate restrictions on fields
« Reply #13 on: May 19, 2020, 02:09:56 PM »
However it can happen that there is suitable place for just the factory, but no fields. What then? I would leave it without fields (and public player can add suitable climates nearby).

Same you do if it spawns in the middle of a city with no empty spaces around, or if it spawns on a tiny island. I don't think that happens often enough to require fixing.
Of course, IF there is a mechanic that tries to place all factories before committing, it might as well check if a factory would spawn with fields before committing, and if it can't have enough fields (as specified in the dat) it would seek a different location.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 10230
  • Languages: De,EN,JP
Re: Climate restrictions on fields
« Reply #14 on: May 19, 2020, 02:53:57 PM »
The "not spawning a chain if no locations are found" was considered too. But since chains can have difficult conditions, so really a lot of data has to be doubled (like creating new demand on existing factories), which is some work nobody did. There was also only one attempt at renovating the factory spawning algorithm. As far as I know, even experimental did not touch it. (Like creations of more climates on the smae heigh level ...)