Latest Posts

Topic: New experimental tribe: Europeans

hessenfarmer
Avatar
Joined: 2014-12-11, 23:16
Posts: 1667
Ranking
One Elder of Players
Location: Bavaria
Posted at: 2021-01-24, 20:37

As said i understand the problem as the AI Coide to upgrade buildings is very rudimentary. So this is a problem especuially with tribes with lots of upgrades. So if iot works for you I am fine. However we went away from hardcoding stuff like this for good reason.


Top Quote
MarkMcWire
Avatar
Joined: 2017-02-08, 21:06
Posts: 211
Ranking
Widelands-Forum-Junkie
Location: Eisenach, Germany
Posted at: 2021-01-24, 20:40

hessenfarmer wrote:

As said i understand the problem as the AI Coide to upgrade buildings is very rudimentary. So this is a problem especuially with tribes with lots of upgrades. So if iot works for you I am fine. However we went away from hardcoding stuff like this for good reason.

I'll experiment with starting conditions that don't make any specifications and try out what minimum amount of building material the AI needs in order not to get stuck (on all maps).


My widelands project: https://github.com/MarkMcWire/widelands

Top Quote
MarkMcWire
Avatar
Joined: 2017-02-08, 21:06
Posts: 211
Ranking
Widelands-Forum-Junkie
Location: Eisenach, Germany
Posted at: 2021-01-24, 21:15

I changed my conditions and only deactivate and activate trainingssites and associated smithy_upgrades.

-- =======================================================================
--              Headquarters Starting Conditions for Europeans
-- =======================================================================

include "scripting/infrastructure.lua"
include "scripting/debug.lua"

push_textdomain("tribes")

init = {
   -- TRANSLATORS: This is the name of a starting condition
   descname = _ "Headquarters",
   -- TRANSLATORS: This is the tooltip for the "Headquarters" starting condition
   tooltip = _"Start the game with your headquarters only",
   func =  function(plr, shared_in_start)

   local sf = wl.Game().map.player_slots[plr.number].starting_field
   if shared_in_start then
      sf = shared_in_start
   else
      plr:allow_workers("all")
   end

   plr:forbid_buildings{"europeans_recruitement_center_advanced", "europeans_recruitement_center_normal"}
   plr:forbid_buildings{"europeans_shipyard_advanced", "europeans_shipyard_normal"}
   plr:forbid_buildings{"europeans_ferry_yard_advanced", "europeans_ferry_yard_normal"}
   plr:forbid_buildings{"europeans_scouts_house_advanced", "europeans_scouts_house_normal"}
   plr:forbid_buildings{"europeans_smithy_level_3", "europeans_trainingscamp_basic", "europeans_labyrinth"}
   plr:forbid_buildings{"europeans_smithy_level_4", "europeans_smithy_level_5", "europeans_smithy_level_6", "europeans_guardhall", "europeans_trainingscamp_normal", "europeans_arena"}
   plr:forbid_buildings{"europeans_smithy_level_7", "europeans_smithy_level_8", "europeans_smithy_level_9", "europeans_dungeon", "europeans_trainingscamp_advanced", "europeans_colosseum"}
   
   prefilled_buildings(plr, { "europeans_headquarters", sf.x, sf.y,
        wares = {
            water = 256,
            log = 128,
            planks = 128,
            granite = 64,
            coal = 64,
            reed = 64,
            cloth = 48,
            marble = 48,
            quartz = 48,
            iron = 32,
            corn = 32,
            grout = 32,
            brick = 32,
            spider_silk = 16,
            spidercloth = 16,
            diamond = 16,
        },
        workers = {
            europeans_carrier = 32,
            europeans_farmer_basic = 24,
            europeans_builder = 12,
            europeans_miner_basic = 12,
            europeans_trainer = 6,
            europeans_lumberjack_basic = 6,
            europeans_forester_basic = 4,
            europeans_carpenter_basic = 2,
            europeans_stonecutter_basic = 2,
            europeans_stonemason_basic = 2,
            europeans_charcoal_burner_basic = 2,
            europeans_hunter_basic = 2,
            europeans_fisher_basic = 2,
            europeans_fishbreeder = 2,
            europeans_miller_basic = 2,
            europeans_baker_basic = 2,
            europeans_smoker_basic = 2,
            europeans_brewer_basic = 2,
            europeans_breeder_normal = 2,
            europeans_weaver_basic = 2,
            europeans_smelter_basic = 2,
            europeans_smith_basic = 2,
            europeans_shipwright = 2,
            europeans_beekeeper = 1,
            europeans_gamekeeper = 1,
            europeans_geologist = 1
      },
        soldiers = {
            [{0,0,0,0}] = 32,
      }
   })
    for i = 1, 48 do
        -- Delay of 15 min between actions
        sleep(900000)
        
        -- Ware-dependent activation
        if plr:get_wares("iron") > 15 and plr:get_wares("coal") > 15 and plr:get_wares("planks") > 15 then
           plr:allow_buildings{"europeans_smithy_level_3"}
        end
        if plr:get_wares("iron") > 15 and plr:get_wares("coal") > 15 and plr:get_wares("planks") > 15 and plr:get_wares("armor") > 7 then
           plr:allow_buildings{"europeans_smithy_level_4", "europeans_smithy_level_5", "europeans_smithy_level_6"}
        end
        if plr:get_wares("iron") > 15 and plr:get_wares("coal") > 15 and plr:get_wares("planks") > 15 and plr:get_wares("gold") > 7 then
           plr:allow_buildings{"europeans_smithy_level_7", "europeans_smithy_level_8", "europeans_smithy_level_9"}
        end
        if plr:get_wares("ration") > 15 and plr:get_wares("beer") > 15 and plr:get_wares("mead") > 7 then
           plr:allow_buildings{"europeans_labyrinth"}
        end
        if plr:get_wares("snack") > 15 and plr:get_wares("beer_strong") > 15 and plr:get_wares("shield_steel") > 0 then
           plr:allow_buildings{"europeans_arena"}
        end
        if plr:get_wares("meal") > 15 and plr:get_wares("wine") > 15 and plr:get_wares("shield_advanced") > 0 then
           plr:allow_buildings{"europeans_colosseum"}
        end
        if plr:get_wares("ration") > 15 and plr:get_wares("armor_chain") > 0 then
           plr:allow_buildings{"europeans_guardhall"}
        end
        if plr:get_wares("snack") > 15 and plr:get_wares("armor_gilded") > 0 then
           plr:allow_buildings{"europeans_dungeon"}
        end
        if plr:get_wares("ration") > 15 and plr:get_wares("spear_advanced") > 0 then
           plr:allow_buildings{"europeans_trainingscamp_basic"}
        end
        if plr:get_wares("snack") > 15 and plr:get_wares("sword_broad") > 0 then
           plr:allow_buildings{"europeans_trainingscamp_normal"}
        end
        if plr:get_wares("meal") > 15 and plr:get_wares("ax_warriors") > 0 then
           plr:allow_buildings{"europeans_trainingscamp_advanced"}
        end
        if i > 45 then
           plr:allow_buildings("all")
        end 
    end
end
}
pop_textdomain()
return init

My widelands project: https://github.com/MarkMcWire/widelands

Top Quote
hessenfarmer
Avatar
Joined: 2014-12-11, 23:16
Posts: 1667
Ranking
One Elder of Players
Location: Bavaria
Posted at: 2021-01-24, 22:31

well, I would have kept with 5 minutes or less of evaluation time.
Furthermore the part with the decisioons based on times could and should probably be implemented with prohibited _till. Although this could be overriden in special occasions it normally prevents to early upgrades. As upgrade code still needs improvement this could ease the problems a bit. especially if the upgraded buildings are not producing anything different then the basic one (sorry hadn't the time to check your tribe in detail)


Top Quote