Loading...
 

PogamutUT2004


Experimental bot setup

Hi all,

I have one more pressing issue and if anyone can help me on this one I would be very indebted. Is there a way to always reset a given map to original settings. To be more precise, let us say I have always two bots facing each other at their fixed location and after certain conditions have been met I want to kill them both and rerun the scenario exactly as is. This procedure would be rerun countless times so I would like to automate it as much as possible without needing to physically restart the server etc.

Thanks in advance

P.
Do you not want to reset the server because you would have to do it yourself? You can make the Java code do it for you automatically. The best way to do this is probably using the new ControlServer (see the sticky in this forum), but I have my own messy way. I'm pretty sure that a lot of this code is unnecessary, but it works for me:


UCCWrapper.UCCWrapperConf config = new UCCWrapper.UCCWrapperConf();
config.setMapName("DM-Junkyard");
config.setGameBotsPack("GameBots2004");
config.setGameType("BotDeathMatch");
config.setOptions("?mutator=GameBots2004.BotPrizeMutator?timelimit=0?fraglimit=0?GoalScore=0?bAllowPrivateChat=False?bAllowTaunts=False?bEnableVoiceChat=False?bAllowLocalBroadcast=False");
UCCWrapper ucc = new UCCWrapper(config);

UT2004Server server = ucc.getUTServer();
System.out.println("Confirming empty server");
while (server.getAgents().size() > 0) {
try {
System.out.println("NOT EMPTY! RESET!");
server.kill();
ucc.stop();
synchronized (this) {
this.wait(1000);
}
} catch (InterruptedException ex) {
Logger.getLogger(LocalBaseExperimentExecutorImpl.class.getName()).log(Level.SEVERE, null, ex);
} catch (Exception e) {
System.out.println(e);
} finally {
ucc = new MyUCCWrapper(config);
server = ucc.getUTServer();
}
}
//Server was launched?
System.out.println("Launch bots on empty server");

try {
MultipleUT2004BotRunner.BotDescriptor scripted = new MultipleUT2004BotRunner.BotDescriptor(opponents, opponentClass, "Name");

// Run bots
MultipleUT2004BotRunner runner = new MultipleUT2004BotRunner(host, port, evolve, scripted);
runner.setPausing(false).startAgent();
// When done running
System.out.println("KILL ALL AGENTS");
runner.killAgents();
} finally {
server.kill();
try {
System.out.println("Kill Server");
//server.stop();
ucc.stop();
} finally {
try {
synchronized (this) {
this.wait(1000);
}
} catch (InterruptedException ex) {
Logger.getLogger(LocalBaseExperimentExecutorImpl.class.getName()).log(Level.SEVERE, null, ex);
ex.printStackTrace();
}
}
}
Hi Jacob,

Thanks for your quick response, I will definitely use your code snippets. I am almost finished with my evolution engine so that I can hook it up with some gui to control experiments. In ideal world I want to just hit run experiments button and get the same scenario executed let us say 2000 times.

Cheers

P.
Hi!

The way the Jacob described is currently the most correct one as the whole UT2004 server along with UT2004 server is restarted. However it might slow your experiments down if one experiment is short (let's say 4 secs) as restarting takes about 30secs?


If you seek not to restart the server, you need to have commands to set the UT2004 environment (map+bots' states) into some default state.
Pogamut will provide you with commands to do this:
- you may respawn bots
- you may set health/armor to any bot
- you may give any bot any item you want

Unfortunately, you can't:
- remove items from bot inventory
- you can't force items in the map to respawn

I assume that mentioned obstacles will force you to always restart the server. But... I will contact our UnrealScript expert :-)
if it would be possible to extend GB2004 commands so you are able to remove items from bot's inventory / respawn items as well.

Would you need anything else?

Cheers!
Jakub
> Unfortunately, you can't:
> - remove items from bot inventory
> - you can't force items in the map to respawn

If you respawn the bot, you get him to his initial state - no additional weapons or items in the inventory except for the initial ones. So the only thing you CANT do now is to force items in the map to respawn. However, if you wait for 88 seconds, everything in map will be spawned again. (88 secs is I guess time needed for quad damage and superhealth, other items needs probably less. Check: respawn times). Downside is that 88 seconds is quite a long time. Restarting the server is a faster solution.

It would be possible to implement command that will automatically restart all items in the map - but I dont know when I will have some time to do this. I might have some this week or as late as in August. :-/

Best,
Michal
Hi guys,

Thank you for your comments so far, they definitely helped to set few params up.

However, I am desperate for more help after failing to solve the problem myself in few attempts.

I must say that it is very important for me to be able to set the positions of the two bots. MyBot, my custom implementation of a bot, always performs a given sequence of actions of a fixed length and then stops. Plus it is crucial to me to set a native bot in given location and specify its skill level. Because it is CTF game type, I need to reset the scores each time the scenario/experiment is run, and the best solution for that would be to kill the agents and restart the server each time to start afresh.

I have tried the approach with StoryControlServer in the pastie. The problem with this is that though I am able attach the MyBot and native bot to the server, and specify their exact location and rotation, methods such as server.kill() or server.killAgent() do not work at all and I cannot find a way to kick the agents out of the server once they are done. Plus in this approach I cannot see a way of restarting the server.

In the second approach kindly provided by Jacob I am unable to connect MyBot and native bot to the server. I am using the AddBot wrapper

AddBot nativeBot = new AddBot(...);
server.getAct( ).act(nativeBot);

, this call works perfectly fine for the previous approach whereas in this it just does absolutely nothing.

I would be happy to use any of the approaches as long as I can do this sequence of steps (in pseudocode):
server = ucc.start( );
server.getAct( ).act(new AddBot(...));
server.addMyBot( );
server.killAgents( );
server.restart( );

Many thanks,

P.
Hi again,

That's turning into a some sort of a saga:) Anyhow, I seem to have made some progress, I am starting the ucc server fine, connecting the AddBot and mine bot fine, once they are finished the same scenario is executed again in a loop, the AddBot connects fine and mine bot also connects. But wait ....there is something mysterious happening, the bot appears in the world and does completely nothing, though there are commands being issued - bizarre - it just stands and the native bot is running happy all over the place. Part of the output is...

(ThiefBot) WARNING 19:28:52.296 Not running, can't send CMOVE
(ThiefBot) WARNING 19:28:52.296 Not running, can't send ROTATE {Amount 5461}
(ThiefBot) WARNING 19:28:55.125 Not running, can't send CMOVE
(ThiefBot) WARNING 19:28:55.125 Not running, can't send DODGE {Direction 1.0,0.0,0.0}
(ThiefBot) WARNING 19:28:55.593 Not running, can't send CHANGEWEAPON {Id CTF-1on1-Joust.AssaultRifle}

It seems that the pogamut platform is not starting properly, the bot gets no info from the world and vice versa cannot issue any commands. Any ideas what is the cause of this. If I get this figured out I am virtually on my highway to heaven :-) I am using SinglerUT2004Runner to launch my bot and the already mentioned AddBot command.

Thanks,

P.
Ohhh dear, I could nearly kick myself. I have managed to track down this bug. Turned out that I was creating singleton object, which though I was restarting server and controller, never got updated with new info - duhhh.

The only thing that I need to figure out now is how to synchronise the start of my bot and the native bot. I must say that the multipleUT2004Runner is a tempting proposition but I don't think I can use it for this as I really need to be able to set all params for AddBot. Unless I am missing something.
 

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.