Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
pogamut_bot_svn_guide [2011/01/10 17:05] michal_bida |
— (current) | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Intro ====== | ||
- | Don't want to wait for a new installer when we fix some bugs in Pogamut? Or do you want to edit Pogamut code yourself? Use Pogamut SVN version for your bot! | ||
- | ====== Pogamut UT2004 ====== | ||
- | |||
- | You need to checkout only three projects to make a Pogamut UT2004 bot work: | ||
- | |||
- | * PogamutCore located in [[svn:// | ||
- | * PogamutUnreal located in [[svn:// | ||
- | * PogamutUT2004 located in [[svn:// | ||
- | |||
- | Add these projects to your projects libraries (In NetBeans: click project properties, select **Libraries** and there click **Add a project...**) | ||
- | |||
- | Moreover, add all .jars from [[svn:// | ||
- | |||
- | In your project create a base bot class with following code: | ||
- | |||
- | < | ||
- | package pogamutjavabot; | ||
- | |||
- | import cz.cuni.amis.pogamut.base.agent.IAgent; | ||
- | import cz.cuni.amis.pogamut.base.agent.state.WaitForAgentStateChange; | ||
- | import cz.cuni.amis.pogamut.base.agent.state.level2.IAgentStateStopped; | ||
- | import cz.cuni.amis.pogamut.base.utils.Pogamut; | ||
- | import cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004Bot; | ||
- | import cz.cuni.amis.pogamut.ut2004.bot.impl.UT2004BotModuleController; | ||
- | |||
- | import cz.cuni.amis.pogamut.ut2004.communication.messages.gbcommands.Initialize; | ||
- | import cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.BotKilled; | ||
- | import cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.ConfigChange; | ||
- | import cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GameInfo; | ||
- | import cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.InitedMessage; | ||
- | import cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.Self; | ||
- | import cz.cuni.amis.pogamut.ut2004.factory.guice.remoteagent.UT2004BotFactory; | ||
- | import cz.cuni.amis.pogamut.ut2004.factory.guice.remoteagent.UT2004BotModule; | ||
- | import cz.cuni.amis.pogamut.ut2004.utils.UT2004BotRunner; | ||
- | import cz.cuni.amis.utils.exception.PogamutException; | ||
- | import cz.cuni.amis.pogamut.ut2004.utils.UT2004BotRunner; | ||
- | |||
- | /** | ||
- | * Java Bot template. | ||
- | */ | ||
- | public class PogamutJavaBot extends UT2004BotModuleController { | ||
- | |||
- | @Override | ||
- | public void prepareBot(UT2004Bot bot) { | ||
- | // TODO used for initialization, | ||
- | } | ||
- | |||
- | @Override | ||
- | public Initialize getInitializeCommand() { | ||
- | // TODO init bot's params there | ||
- | return new Initialize(); | ||
- | } | ||
- | |||
- | @Override | ||
- | public void botInitialized(GameInfo info, ConfigChange config, InitedMessage init) { | ||
- | // TODO called after the bot was initialized | ||
- | // since this method, you may use your agent modules | ||
- | } | ||
- | |||
- | @Override | ||
- | public void botSpawned(GameInfo gameInfo, ConfigChange config, InitedMessage init, Self self) { | ||
- | // bot is spawned for the first time in the environment | ||
- | // examine ' | ||
- | } | ||
- | |||
- | @Override | ||
- | public void logic() throws PogamutException { | ||
- | // TODO code bots logic there | ||
- | |||
- | // The parent of this class - UT2004BotModuleController contains many modules that can help | ||
- | // you with querying bot's world view and issuing commands | ||
- | // | ||
- | // this.game | ||
- | // | ||
- | // this.info | ||
- | // | ||
- | // this.players | ||
- | // | ||
- | // this.descriptors | ||
- | // providing an easy way to obtain item descriptors for various items in UT2004. | ||
- | // this.items | ||
- | // this.senses | ||
- | // | ||
- | // this.weaponry | ||
- | // | ||
- | // this.config | ||
- | // | ||
- | // this.raycasting | ||
- | // this.body | ||
- | // this.shoot | ||
- | // this.move | ||
- | // | ||
- | // this.pathPlanner | ||
- | // this.pathExecutor // Executor is used for following a path in the environment. | ||
- | // | ||
- | // | ||
- | } | ||
- | |||
- | @Override | ||
- | public void botKilled(BotKilled event) { | ||
- | // TODO handle what will happen whent the bot was killed | ||
- | } | ||
- | |||
- | /** | ||
- | * This method is called when the bot is started either from IDE or from command line. | ||
- | * It connects the bot to the game server. | ||
- | * @param args | ||
- | */ | ||
- | public static void main(String args[]) throws PogamutException { | ||
- | new UT2004BotRunner(PogamutJavaBot.class, | ||
- | } | ||
- | } | ||
- | </ | ||
- | |||
- | |||
- | And you are ready to go. To make changes to PogamutUT2004 or Core simply open them in NetBeans, make change and then Clean and Build your bot project. | ||
- | |||
- | ====== Pogamut UDK ====== | ||
- | |||
- | Instead of | ||
- | |||
- | * PogamutUT2004 | ||
- | |||
- | checkout and add to your project | ||
- | |||
- | * PogamutUDK located in [[svn:// | ||
- | |||
- | To get PogamutUDK base bot class use the class created when creating new Pogamut UDK project in NetBeans. After the project is created, in project properties in Libraries, remove the default library (should be PogamutUDK) and add projects and jars as in PogamutUT2004 above (except that instead PogamutUT2004 add PogamutUDK). |