Loading...
 

PogamutUT2004


Using UCCWrapper

Can I get some tips or a basic tutorial on how to make UCCWrapper launch a server? I tried it on my own, but it I get the following sequence of log messages ending in failure:

(UCC) INFO 14:59:14.025 ID0 Executing Class Engine.ServerCommandlet
(UCC) INFO 14:59:14.830 ID0 Browse: Tournament?Name=HeDeceives?Class=Engine.Pawn?Character=Jakob?team=255?SpectatorOnly=1
(UCC) INFO 14:59:14.843 ID0 Failed to load 'Tournament': Can't find file 'Tournament'
(UCC) INFO 14:59:14.843 ID0 Failed to load 'Level None.MyLevel': Can't find file 'Tournament'
(UCC) INFO 14:59:14.843 ID0 Failed to enter Tournament: Can't find file 'Tournament'
(UCC) INFO 14:59:14.844 ID0 Executing UObject::StaticShutdownAfterError
(UCC) INFO 14:59:14.846 ID0 UGameEngine::Init
(UCC) INFO 14:59:14.846 ID0 UServerCommandlet::Main
(UCC) INFO 14:59:14.847 ID0 Failed to enter Tournament: Can't find file 'Tournament'
(UCC) INFO 14:59:14.847 ID0
(UCC) INFO 14:59:14.847 ID0
(UCC) INFO 14:59:14.847 ID0
(UCC) INFO 14:59:14.848 ID0 History: UGameEngine::Init
Hi,
it seems that you are trying to start ucc.exe on map "Tournament" that isn't found by the ucc process.
Can you post the exac code that you use to start the server (mainly the UCCWrapperConf settings) ?
R
I'm simply setting the map via
config.setMapName("DM-TrainingDay");

The full code is:
UCCWrapper.UCCWrapperConf config = new UCCWrapper.UCCWrapperConf();
config.setMapName("DM-TrainingDay");
UCCWrapper ucc = new UCCWrapper(config);

Though at this point, I'm certain this is not the problem because I tried the same code on another machine. It seems the problem is being caused by an inability to parse spaces in pathnames/filenames at some point in the process. The reason that "Tournament" gets singled out is that my installation path is "F:\Program Files\Unreal Tournament 2004". When I ran the same code on another system, I got the following errors:

(UCC) INFO 23:17:08.917 ID0 Executing Class Engine.ServerCommandlet
(UCC) INFO 23:17:09.235 ID0 Browse: (x86)\Unreal?Name=HeDeceives?Class=Engine.Pawn?Character=Abaddon?team=255?Sex=M?SpectatorOnly=1
(UCC) INFO 23:17:09.239 ID0 Failed to load '(x86)\Unreal': Can't find file '(x86)\Unreal'
(UCC) INFO 23:17:09.239 ID0 Failed to load 'Level None.MyLevel': Can't find file '(x86)\Unreal'
(UCC) INFO 23:17:09.239 ID0 Failed to enter (x86)\Unreal: Can't find file '(x86)\Unreal'
(UCC) INFO 23:17:09.239 ID0 Executing UObject::StaticShutdownAfterError
(UCC) INFO 23:17:09.240 ID0 UGameEngine::Init
(UCC) INFO 23:17:09.240 ID0 UServerCommandlet::Main
(UCC) INFO 23:17:09.240 ID0 Failed to enter (x86)\Unreal: Can't find file '(x86)\Unreal'
(UCC) INFO 23:17:09.240 ID0
(UCC) INFO 23:17:09.240 ID0
(UCC) INFO 23:17:09.240 ID0
(UCC) INFO 23:17:09.240 ID0 History: UGameEngine::Init
For some reason my last message was incomplete. I meant to say at the end that on the other system, the installation path is "D:\Program Files (x86)\Unreal Tournament 2004", which explains the "(x86)\Unreal" in the Browse string. The only question now is how to fix this.
Strange.
1) if I have only one space in path to ucc.exe then everything works fine
2) two and more spaces cause the problem, BUT ucc.exe is executed so I thing that the problem is in a way ucc.exe parses it's command line arguments or in a way that they are passed to it from Java. I have tried various escape sequences but nothing seems to work ... I have spend half hour investigating this without any success, the problem is in UCCWrapper.java around line 320, I will look at this later
R
I went ahead and copied my UT install to a directory with no spaces, so I can get the Wrapper to work. I would still like to see this problem fixed though.

Moving on to other issues, I'm now trying to make sure I'm using the Wrapper right, and shutting the server down properly (This is somewhat related to my other post on bot termination). Here's my code:
-------------
UCCWrapper.UCCWrapperConf config = new UCCWrapper.UCCWrapperConf();
config.setMapName("DM-Junkyard");
config.setGameType("BotDeathMatch");
config.setOptions("?timelimit=0?fraglimit=0?GoalScore=0");
UCCWrapper ucc = new UCCWrapper(config);

... launch the bots and evlauate until all bots execute their kill methods ...

UT2004Server server = ucc.getUTServer();
ObservableCollection agents = server.getAgents();
for(IAgent bot: agents){
// All of my bots have this superclass
BaseBot baseBot = (BaseBot) bot;
// getId() is available in my BaseBot method, but not in regular default bots
server.getAct().act(new Kick(baseBot.getId()));
}
//What's the difference between stop and kill?
server.stop();
server.kill();
ucc.stop();

--------------------

This code is then repeated, essentially within a loop. Therefore, as soon as one server is taken down, I need to start another one. I feel as though I'm doing this in a very sloppy manner, and although I seem to be successfully launching new servers, I'm not entirely sure that I'm successfully closing the old ones. Can someone recommend a way of improving this?
Hi!

.stop() method -> may throw an exception which means that the agent is left in undefined state (who knows what happened). If succeeds, the agent state will be IAgentStateStopped

.kill() method -> should be used in the case of exceptions, i.e., it stops the agent unconditionally switching its state to IAgentStateFailed marking that there was a severe failure while killing the agent, kill() method never throws an exception (never ever, guaranteed).

Jimmy

P.S.: if you do not care of the agent state, always use .kill()
One more note... using .kill() with MultipleUT2004BotRunner is a bad thing as the Agent will report that it fails and the MultipleUT2004BotRunner will tear down all other agents as well.

Jimmy
 

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.