Topic: Game engine ignores AI Hint "prohibited_till"

MarkMcWire
Avatar
Topic Opener
Joined: 2017-02-08, 21:06 UTC+1.0
Posts: 390
Ranking
Tribe Member
Location: Eisenach, Germany
Posted at: Today 17:33 UTC+2.0

Hello, I'm currently building a new tribe that contains all the wares and economies of the five canonical tribes. Basically a europeans_ultra tribe.

I've noticed that some buildings are being built far too early, even though I used the "prohibited_till" hint. This affects all buildings that produce animals like oxen, donkeys, horses, and reindeer. I don't even use these animals as carriers; they will later be sold for coins in a market.

They will all build after 20 min gameplay, no matter what happens.

Edited: Today 18:01 UTC+2.0

My widelands addons: https://drive.google.com/file/d/1jopANlODo41T2reHJ0zaCOMYxq_rxXP-/view?usp=sharing

Top Quote
hessenfarmer
Avatar
Joined: 2014-12-11, 23:16 UTC+1.0
Posts: 2825
Ranking
One Elder of Players
Location: Bavaria
Posted at: Today 18:25 UTC+2.0

well from the code this should not happen.
Could you provide a detailed log of the game (using --verbose as start paramter) and a copy of the init:lua of such a building.


Top Quote
MarkMcWire
Avatar
Topic Opener
Joined: 2017-02-08, 21:06 UTC+1.0
Posts: 390
Ranking
Tribe Member
Location: Eisenach, Germany
Posted at: Today 18:30 UTC+2.0
push_textdomain("tribes")

-- dirname = path.dirname(__file__)
dirname = "tribes/buildings/productionsites/amazons/tapir_farm/"

wl.Descriptions():new_productionsite_type {
   name = "europeans_amazons_tapir_farm",
   -- TRANSLATORS: This is a building name used in lists of buildings
   descname = pgettext ("amazons_building", "Tapir Farm"),
   icon = dirname .. "menu.png",
   size = "big",

   buildcost = {
      log = 5,
      rope = 2,
   },
   return_on_dismantle = {
      log = 3,
      rope = 1,
   },

   animation_directory = dirname,
   animations = { unoccupied = {hotspot = {71, 49}}},
   spritesheets = {
      idle = {
         hotspot = {71, 49},
         fps = 10,
         frames = 10,
         columns = 5,
         rows = 2
      },
      working = {
         hotspot = {71, 49},
         fps = 15,
         frames = 30,
         columns = 6,
         rows = 5
      },
   },

   aihints = {
      prohibited_till = 1800,
      very_weak_ai_limit = 1,
      weak_ai_limit = 1
   },

   working_positions = {
      amazons_tapir_breeder = 1
   },

   inputs = {
      { name = "cassavaroot", amount = 8 },
      { name = "water", amount = 8 }
   },

   programs = {
      main = {
         -- TRANSLATORS: Completed/Skipped/Did not start working because ...
         descname = _("working"),
         actions = {
            "call=recruit_tapir",
         }
      },
      recruit_tapir = {
         -- TRANSLATORS: Completed/Skipped/Did not start breeding tapir because ...
         descname = pgettext("amazons_building", "breeding tapir"),
         actions = {
            -- time total: 15 + 15 = 30 sec
            "return=skipped unless economy needs amazons_tapir",
            "consume=cassavaroot water",
            "sleep=duration:15s",
            "animate=working duration:15s",
            "recruit=amazons_tapir"
         }
      },
   },
}

pop_textdomain()

Edited: Today 18:33 UTC+2.0

My widelands addons: https://drive.google.com/file/d/1jopANlODo41T2reHJ0zaCOMYxq_rxXP-/view?usp=sharing

Top Quote
MarkMcWire
Avatar
Topic Opener
Joined: 2017-02-08, 21:06 UTC+1.0
Posts: 390
Ranking
Tribe Member
Location: Eisenach, Germany
Posted at: Today 18:50 UTC+2.0

Here the log.


Attachment: application/zip
log.txt.zip (1.9 MB)

My widelands addons: https://drive.google.com/file/d/1jopANlODo41T2reHJ0zaCOMYxq_rxXP-/view?usp=sharing

Top Quote
hessenfarmer
Avatar
Joined: 2014-12-11, 23:16 UTC+1.0
Posts: 2825
Ranking
One Elder of Players
Location: Bavaria
Posted at: Today 20:32 UTC+2.0

ok with this information I can confirm that our Ai code is definitly ignoring the prohibited_till parameter for this building. This is due to it being recognized as the tribes recruitment building for second carriers, where only 1 of each type is allowed and enforced in relation to the number of roads.

Although I am not reluctant in changing this, this might need deeper research to avoid issues.
So as I am a bit short of time recently I can't tell when (if at all) I will be able to come up with a solution.


Top Quote