How to work with Pogamut SVN version - versions before 3.2.0
You need to checkout only three projects to make a Pogamut UT2004 bot work:
- PogamutCore located in svn://amis.mff.cuni.cz/pogamut/trunk/project/Core
- PogamutUnreal located in svn://amis.mff.cuni.cz/pogamut/trunk/project/PogamutUnreal
- PogamutUT2004 located in svn://amis.mff.cuni.cz/pogamut/trunk/project/PogamutUT2004
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://amis.mff.cuni.cz/pogamut/trunk/project/Core/libs to your project as a libraries (In NetBeans: click project properties, select Libraries and there click Add jar/folder)
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, initialize agent modules here } @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 'self' to examine current bot's location and other stuff } @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 // Memory module specialized on general info about the game: // game type, time limit, frag limit, etc. // this.info // Memory module specialized on general info about the agent whereabouts: // location, rotation, health, current weapon, who is enemy/friend, etc. // this.players // Memory module specialized on whereabouts of other players: // who is visible, enemy / friend, whether bot can see anybody, etc. // this.descriptors // Sensory module that provides mapping between ItemType and ItemDescriptor // providing an easy way to obtain item descriptors for various items in UT2004. // this.items // Memory module specialized on items on the map - which are visible and which are probably spawned. // this.senses // Memory module specialized on agent's senses: // whether the bot has been recently killed, collide with level's geometry, etc. // this.weaponry // Memory module specialized on info about the bot's weapon and ammo inventory. // It can tell you which weapons are loaded, melee/ranged, etc. // this.config // Memory module specialized on the agent's configuration inside UT2004: // name, vision time, manual spawn, cheats (if enabled at GB2004). // this.raycasting // Support for creating rays used for raycasting (see {@link AutoTraceRay} that is being utilized). // this.body // Wraps all available commands that can be issued to the virtual body of the bot inside UT2004. // this.shoot // Shortcut for body.getAdvancedShooting() that allows you to shoot at opponent. // this.move // Shortcut for body.getAdvancedLocomotion() that allows you to manually // steer the movement through the environment. // this.pathPlanner // Planner used to compute the path (consisting of navigation points) inside the map. // this.pathExecutor // Executor is used for following a path in the environment. // note that you need to attach listeners to path events and add stuck detector if you want to use pathExecutor // see NavigationBot sample for example implementation of the listener } @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, "PogamutJavaBot").setMain(true).startAgent(); } }
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.
Best,
Michal