[Pogamut-list] Controlling Bot
bulent
pogamut-forum at diana.ms.mff.cuni.cz
Thu Dec 23 00:35:31 CET 2010
Re: Controlling Bot
Author: bulent
Hi
First of all thank you for all the help and sorry for making this topic too long but I really need to understand the concept and get this working.
Here's what I've done so far. I have created the 3 classes: "TestUT2004BotObserver" , "TestUT2004BotObserverModule" that you gave and another class to test the program.
Here's the code for testing the program:
{CODE()}
import cz.cuni.amis.pogamut.base.agent.impl.AgentId;
import cz.cuni.amis.pogamut.base.agent.state.level1.IAgentStateUp;
import cz.cuni.amis.pogamut.base.communication.connection.impl.socket.ISocketConnectionAddress;
import cz.cuni.amis.pogamut.ut2004.agent.params.UT2004AgentParameters;
import cz.cuni.amis.pogamut.ut2004.factory.guice.remoteagent.UT2004ObserverFactory;
public class Test {
public Test(){
//PLAYER NAME: Cleopatra id: DM-TrainingDay.GBxBot3
//PLAYER NAME: Bulent id: DM-TrainingDay.ObservedPlayer2
UT2004ObserverFactory observerFactory = new UT2004ObserverFactory(new TestUT2004BotObserverModule());
UT2004AgentParameters observerParameters =
new UT2004AgentParameters()
.setAgentId(new AgentId("observer"))
.setWorldAddress(
new ISocketConnectionAddress() {
public String getHost() {
return "localhost";
}
public int getPort() {
return 3002;
}
});
TestUT2004BotObserver observer = (TestUT2004BotObserver) observerFactory.newAgent(observerParameters);
observer.start();
try{
observer.startObserving("DM-TrainingDay.ObservedPlayer2");
System.out.println("Observer Started");
// 10 sec delay
try{Thread.sleep(10000);} catch(Exception ex){}
observer.testMessages();
observer.stop();
System.out.println("Observer Stopped");
} catch(Exception ex) {
ex.printStackTrace();
} finally {
if(observer.inState(IAgentStateUp.class)){
observer.kill();
System.out.println("Observer Killed bc it was in Up State");
}
}
}
public static void main(String[] args){
new Test();
}
}
{CODE}
The test class is nothing but the code you provided. The only thing I try to do is to get the user data from players.
When I run this code I get all the error messages that I can get.
{CODE()}
!!!!! ERRORS | GAME INFO NOT RECEIVED | SELF NOT RECEIVED | NAVPOINT NOT RECEIVED | ITEMS NOT RECEIVED | PLAYER NOT RECEIVED | BOT DAMAGED NOT RECEIVED | BEGIN MESSAGE NOT RECEIVED | END MESSAGE NOT RECEIVED
{CODE}
The code looks like working but the observer doesn't seem like bound with the game environment.
Is there anything I need to add or do to get observer working correctly?
Thanks
--
Reply Link: <http://diana.ms.mff.cuni.cz/main/tiki-view_forum_thread.php?forumId=4&comments_reply_threadId=4&comments_parentId=446&post_reply=1#form>
More information about the Pogamut-list
mailing list