[Pogamut-list] Own A* (originally posted by jakub.gemrot)

michal.bida pogamut-forum at diana.ms.mff.cuni.cz
Tue Apr 27 21:41:20 CEST 2010


Re: Re: Own A* (originally posted by jakub.gemrot)

Author: michal.bida

It is possible to parametrize bot with a simple hack. I use this in my main method. My agent class is "EmohawkAgent":
{CODE()}

        // factory object is used to construct new instances of bots
        UT2004BotModule module = new UT2004BotModule(EmohawkAgent.class);
        UT2004BotFactory factory = new UT2004BotFactory(module);
        // runner starts the bot constructed by factory and connects it to the server
        // address and the port of the server are specified in PogamutPlatformCustom.properties
        UT2004BotRunner botRunner = new UT2004BotRunner(factory, name) {
            @Override
            protected void preStartHook(UT2004Bot agent){
                EmohawkAgent cont = (EmohawkAgent) agent.getController();
                cont.agentName = name;
                cont.setStoryController(controller);
            }
        };
        botRunner.startAgent();

{CODE}

The key is to override preStartHook method. I set there bot name and StoryController (inside EmohawkAgent class). 

Does this help?

Best,
michal

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





More information about the Pogamut-list mailing list