Loading...
 

PogamutUT2004


Experiments / workaround

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 AgentTCB_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 AgentIVCB_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 AgentSHOOT_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)agents0).setExperimentLeader(true);
while (true)
{
//Thread.currentThread().sleep(1000);
//if (agents0 != 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
Hi!

It depends on what type of experiments you want to run, i.e., how
complex you want your experiment to be.

There already exists UT2004Tournament project that can automatically
run series of DeathMatches and CTF matches:
svn://artemis.ms.mff.cuni.cz/pogamut/trunk/project/Addons/UT2004Tournament
UT2004Match and UT2004DeathMatch classes are great places to learn how
to run UT2004 game automatically.

See UT2004Tournament project test classes that contains examples on
how to run the UT2004Tournament.

If you're referring to JPPF implementation we've got, that is not
available currently I'm afraid :-(

You would probably be interested in class UCCWrapper that can
automatically start up ucc.exe
and also check out examle projects 10, 11 that shows you how to setup
UT2004Server class and use it for
adding bots to UT2004.

See archetypes in our artifactory:
cz.cuni.amis.pogamut.ut2004.examples
10-add-native-bot-archetype
3.2.4

cz.cuni.amis.pogamut.ut2004.examples
11-kick-all-bots
3.2.4

See manual: http://pogamut.cuni.cz/pogamut_files/doc/Setup-Pogamut3-with-Maven.pdf
How to import our example archetype into NetBeans.

Basicly, what you need to do (if you up to manual setup) is:

1) instantiate UCCWrapper and fire up ucc.exe

2) startup your own bots

3) setup UT2004Server class and populate environment with native bots

4) restart match with ut2004Server.getAct().act(new
GameConfiguration().setRestart(true));

5) wait till some your game-end condition is triggered

6) kill UCCWrapper (along with all your bots)

Note that every UT2004Bot contains AgentStats instance (inside
UT2004BotModuleController) that can be used
to collect huge amount of statistics about the bot, it can be
configured to output the stats into .csv file.

Hope it helps,
Jakub

P.S.: there already is a Maven plugin that can be configure to run matches + producing various graps automatically!
See: http://diana.ms.mff.cuni.cz:8080/view/Addons/job/UT2004MavenTestPlugin%20%28site%20deploy%29/site/?
Thanks!

That is exactly what i was looking for.

I will experiment with that ;) .

Best regards,
Marcel
Ok, in case anyone is interested, here is my crude workaround. :-)
What I did for my diploma thesis was a .bat file.. The bat file I automatically creates Unreal server, then it runs whatever jar file containing my bot or bots, then it waits for several minutes - depends how long I expect the experiment to run, then it kills everything and runs it again. :-)

This code is for Windows 7.
:: Automatically runs the emotion experiment
::
@ECHO ON

SET LOOP=0

::run another experiment
ECHO RUNNING EXPERIMENT %LOOP%

:: f:
:: turns ucc server with gamebots on - ucc.exe
START C:\Games\UT2004\launch_UT_SERVER.bat
:: wait for the server to come online
TIMEOUT 30
:: turns on my bots
START c:\Pogamut\PogamutPrivate\amis-private\projects\EmohawkScenarioMaven\EmohawkScenario-3.2.3.one-jar.jar
:: waits 2800 seconds
TIMEOUT 2800

:LOOP
::KILL previous process
TASKKILL /F /IM "javaw.exe"
TASKKILL /F /IM "UCC.exe"
::wait a bit
TIMEOUT 10

::run another experiment
ECHO RUNNING EXPERIMENT %LOOP%
:: turns ucc server with gamebots on
START C:\Games\UT2004\launch_UT_SERVER.bat
:: wait for the server to come online
TIMEOUT 30
:: turns on bots
START c:\Pogamut\PogamutPrivate\amis-private\projects\EmohawkScenarioMaven\EmohawkScenario-3.2.3.one-jar.jar
:: sleep 2800 seconds
TIMEOUT 2800

SET /A LOOP+=1
:: do it 50 times
IF NOT "%LOOP%" == "50" GOTO LOOP


:: clear variable loop at the end - batch variables are global
SET LOOP=

:END

 

News

News RSS RSS feed for News link



Pogamut

Quarterly RSS RSS feed for quarterly reports

Acknowledgement

This work is supported by GA UK 1053/2007/A-INF/MFF (2007-8), GA UK 351/2006/A-INF/MFF (2006-8), the Ministry of Education of the Czech Republic (grant MSM0021620838) (2008-9), by the Program "Information Society" under project 1ET100300517 (2006-9), and the project Integration of IT Tools into Education of Humanities (2006-8) and by the project CZ.2.17/3.1.00/31162, which are financed by the European Social Fund, the state budget of the Czech Republic, and by the budget of Municipal House Prague.