Tutorial body

Note: This tutorial can be applied to PogamutUT2004 and will mostly hold in PogamutUDK examples.

In this tutorial you will learn about Pogamut modules. The purpose of Pogamut modules is to provide some basic functionality that can be used by users programming their bots. What functionality are we talking about? Well, there are two types of Pogamut modules - sensor modules and command modules. Sensor modules are a wrappings of the bot WorldView. They have public methods defined on them that can respond questions such as "Do I see some player?", "What is my location?", "Was I hit recently", etc. Command modules wrap Pogamut commands - simply by calling preprepared methods, our bot will move, jump, shoot, etc. Note that all Pogamut modules are initialized and accessible in UT2004BotModuleController - the ancestor of all Pogamut example bots. Below you will find list of most usefull Pogamut modules.

Pogamut sensor modules

Here we will describe pogamut sensor modules - what they provide and how we can initialize them (and how we can usually access them - if our bot is a child of UT2004BotModuleController).

  • AgentInfo - accessible via info is very usefull module providing basic information about the bot itself. Here we can get how much health the bot has, what is his location, what is his team and more.

  • Players - accessible via players. Want to know more about other players or bots around the bot? Then this is the module to use. It provides methods that return all currently visible players - friends or enemies. You can ask it about nearest visible players etc.

  • Items - accessible via items. is a similar module to players module, but now we are handling items. This module is also capable of optimistic guessing if some item is currently spawned in the environment. Or it can return whether the target item is pickable (if the bot is capable of picking up the item) - as this may not be automatic (e.g. bot can pick up regular health pack only when his health is lower than 100).

  • Weaponry - accessible via weaponry. Provides interface to bot current weapons and ammo in his inventory.

  • AgentStats - accessible via stats returns the bot statistics - how many players he killed, how many times he died. Even more thorough statistics are available - how many times a concrete player killed our bot, etc.

  • Senses - accessible via senses. This modules implements listeners for most of the Pogamut events. You will get information about last time your bot was damaged or if your bot recently heared a sound.

  • Game - accessible via game. This module provides basic information about the game the bot is currently in. Information such as time limit, maximum number of health, goal frag score, etc. will be provided here.

  • ItemDecriptors - accessible via destriptors. Here the detailed information about UT2004 items are stored. Detailed information about weapons and pickups can be got here. Note that some of the weapons attributes are experimental. Also note that here you will get only items parameters, you will not get items locations or a list of items in the environment. Descriptors are only data classes describing various item types in the environment.

Don't forget the Pogamut modules are automatically instanciated in UT2004BotModuleController. They can be used in any Pogamut example or in PogamutJavaBot project.

Here is an example of using modules in logic() method. Example below is a simple follow bot.


    @Override
    public void logic() throws PogamutException {
    
        // a simple follow bot logic

        if (players.canSeePlayers()) {
            Player followPlayer = players.getNearestVisiblePlayer();
            if (followPlayer != null)
                getAct().act(new Move().setFirstLocation(followPlayer.getLocation()));
        }
    }
        

Pogamut command and sensomotoric modules

Command and sensomotoric modules provides wrappings of Pogamut3 commands. Sensomotoric modules are a mix of sensoric and command modules. They usually provide information and at the same time are able to issue commands to the bot. Below we will provide you with a list of most interesting Pogamut command modules with a brief description.

  • AdvancedLocomotion - accessible via move. Locomotion commands can be found here (moving, turning, jumping, strafing etc.).

  • AdvancedShooting - accessible via shoot. Simple and advanced shooting commands can be issued from this module (firing, alternate firing, firing grenades, etc.).

  • AgentConfig - accessible via config. With this module some of the bot parameters can be configured - e.g. name, frequency of updates, debugging features, etc.

  • ConfigureCommands - commands for bot configuration.

  • Raycasting - accessible via raycasting. Wraps commands and messages associated with ray casting functionality.

The command modules are automatically instanciated in UT2004BotModuleController class. You may access them in all examples or PogamutJavaBot projects by typing body.. Here is an example of jumping bot done through Pogamut modules:


    @Override
    public void logic() throws PogamutException {
        //we can simply use our command module to create a crazy jumping bot
        body.getLocomotion().jump();
    }
    

Other Pogamut modules

Here is a list of other interesting Pogamut modules that do no fit into preceding categories.

  • WeaponPrefs - accessible via weaponPrefs. This module enables to set up the bot weapon preferences that can be then used automatically by AdvancedShooting module allowing the user to quickly specify desired weapon selection behavior.

  • Random - accessible via random. Standard Java random numbers generator.

  • LogCategory - accessible via log. You can log anything you want with Pogamut logs - they are available for introspection in UT2004Serer window found in Services tab.

  • UT2004Navigation - accessible via navigation. Completely wraps bot path finding. You don't need to care about getting the path or handling of jump spots, lifts, etc. This module does everything for you.