[Pogamut-list] Experiments / workaround

marcel.golunski pogamut-forum at diana.ms.mff.cuni.cz
Wed Jan 18 21:59:36 CET 2012


Experiments / workaround

Author: marcel.golunski

Hello.

I've used Pogamut 2 for my MSc thesis some time ago (Pogamut project is really great BTW) and there was an "Experiment" functionality.

I can't find something similar in pogamut 3. I'm mostly involved with bot teams which means that i need to easily start new "experiment" with arbitrary number of different pogamut bots.

I found this:
[http://diana.ms.mff.cuni.cz/main/tiki-view_forum_thread.php?topics_offset=1&forumId=4&comments_parentId=188]
Which says that there is no such functionality (but its quite an old post)

I also found that:
[http://diana.ms.mff.cuni.cz/pogamut_files/latest/doc/tutorials/ch09s03.html]
Which could be usefull if i could automatically add some pogamut bots.

What i need to achieve is to automatically start a new match with a number of different pogamut bots. Is there any simple way?

In pogamut 2 i used experiments like that below:


    public static byte TCB_BOT_COUNT = 4;
    public static byte NB_BOT_COUNT = 4;
    public static byte IVCB_BOT_COUNT = 0;
    public static int TEAM_SKILL_LEVEL = 2;
    public static int ENEMY_SKILL_LEVEL = 2;
    public static int FREETIME = 10000;
    public static int TC_FREE_TIME = 0;

    public static byte DUMMY_BOT_COUNT = 0;
    public static byte SHOOT_ANY_BOT_COUNT = 0;
    
    public Main(ExperimentDescriptor descriptor, UTServer server) {
        super(descriptor, server);
    }

    @Override
    protected void stageOneInit() throws Exception {
        getLogger().info("Experiment initialized.");
    }

    @Override
    protected void stageTwoStart() throws Exception {
        getLogger().info("Experiment started.");
        Agent teamAgent = new teamcombatbot.TeamController();
        ((teamcombatbot.TeamController)teamAgent).setSkillLevel(TEAM_SKILL_LEVEL);
        ((teamcombatbot.TeamController)teamAgent).setExperimentLog(getLogger());
        getServer().connectBot(teamAgent, "TC");
        Thread.currentThread().sleep(TC_FREE_TIME);
        int i = 0;
        Agent [] agents = new Agent[TCB_BOT_COUNT-1];
        for (Agent a: agents){
            //Thread.sleep(1500);
            getLogger().info("Adding bot: TeamCombatBot" + i);
            a = new teamcombatbot.TeamBot();
            ((teamcombatbot.TeamBot)a).setSkillLevel(TEAM_SKILL_LEVEL);
            ((teamcombatbot.TeamBot)a).setCommuniactionName("TeamCombatBot"+i++);
            getServer().connectBot(a, "TeamCombatBot");
        }
        Thread.currentThread().sleep(FREETIME);
        for (i = 0; i < NB_BOT_COUNT; i++){
            getServer().connectOriginalBot("UTBot " +i , Triple.add(SimpleMapInfo.getMapCenter(),new Triple(1000,1000,0)), ENEMY_SKILL_LEVEL, 2);
        }
        for (i = 0; i < DUMMY_BOT_COUNT; i++){
            getServer().connectBot(new teamcombatbot.DummyBot(),"DummyBot");
        }
        i = 0;
        agents = new Agent[IVCB_BOT_COUNT];
        for (Agent a: agents){
            //Thread.sleep(1500);
            getLogger().info("Adding bot: InfluenceVectorsCombatBot" + i);
            a = new influencevectorscombatbot.TeamBot();
            ((influencevectorscombatbot.TeamBot)a).setSkillLevel(ENEMY_SKILL_LEVEL);
            ((influencevectorscombatbot.TeamBot)a).setTeam(2);
            getServer().connectBot(a, "InfluenceVectorsCombatBot");
        }
        agents = new Agent[SHOOT_ANY_BOT_COUNT];
        for (Agent a: agents){
            //Thread.sleep(1500);
            getLogger().info("Adding bot: ShootAnyBot" + i);
            a = new influencevectorscombatbot.ShootAnyBot();
            ((influencevectorscombatbot.ShootAnyBot)a).setSkillLevel(ENEMY_SKILL_LEVEL);
            ((influencevectorscombatbot.ShootAnyBot)a).setTeam(2);
            getServer().connectBot(a, "ShootAnyBot");
        }
        //if (TCB_BOT_COUNT > 0)
        //    ((simplecirclebot.Main)agents[0]).setExperimentLeader(true);
        while (true)
        {
            //Thread.currentThread().sleep(1000);
            //if (agents[0] != null){
                if (((teamcombatbot.TeamController)teamAgent).isExperimentFinish()){
                    getServer().disconnectAllBots();
                    for (Player p : getServer().getPlayers()){
                        getServer().kickBot(p.UnrealID);
                    }
                    break;
                }
            //}
        }
        // Quit the experiment
        setResultAndTerminate(new ExperimentResult());
    }



Thanks!

Marcel

-- 
Reply Link: <http://diana.ms.mff.cuni.cz/main/tiki-view_forum_thread.php?forumId=4&comments_parentId=883#form>





More information about the Pogamut-list mailing list