Loading...
 

PogamutUT2004


Weapons in pogamut3

Hi,
I use pogamut3 with UT2004, everithing is OK, but I have problem with obtaining some information about game state as bots list of weapons. I also don't know, how to change weapons. I have Pogamut 3.0.3 and I found class Weaponry, but it is not complete.
I would like to know, what I should use for these things or when it is finished.
Class Weaponry will be finished in Pogamut 3.0.4 that should be out in a week or two.

Apart from this, some general infromation about UT2004 weapons and objects is here: UT2004 objects.

To see a complete list of Pogamut 3 commands consult JavaDoc and search for command message. Command for changing weapon is ChangeWeapon or something like that.

Now about how to obtain a list of bot weapons. Create a listener for ItemPickedUp message and look if the object is a weapon, if yes, add it to your list of bots current weapons.

Best,
Michal
Thanks.
Now I'm using Weaponry from version 3.0.4 and in constructor, there is new parameter ItemDescriptions. Where it should be taken from? Because when I created new ItemDescriptors(bot), I got an error (nullpointerexception) in Weaponry class.

Tomas
First thing - modules should be initialized in prepareBot(UT2004Bot bot) method. Don't forget to call super.prepareBot(bot); first, otherwise your bot won't work.

Second thing - there is a small bug in GameBots in 3.0.4 and 3.0.5 that causes the Weaponry module to fail on Java Null Pointer in any game that has Translocator weapon spawned by default for the bots. To fix this download and install GameBots fix (2359). In deathmatch it should work fine anyway.

Example of correct initializaiton of weaponry module:
AgentInfo agentInfo;
    Weaponry weap;
    ItemDescriptors id;
    Game game;    
    
    @Override
    public void prepareBot(UT2004Bot bot) {
        super.prepareBot(bot);

        game = new Game(bot);
        agentInfo = new AgentInfo(bot, game);
        id = new ItemDescriptors(bot);
        weap = new Weaponry(bot,agentInfo,id);
    }


Best,
michal
I have another promblem now. When I change weapon ( weaponry.changeWeapon(ItemType.FLAK_CANNON); ), it change weapon to flak cannon, but it fails with error:

(GoalBot1) SEVERE 12:54:52.685 Fatal error in WorldView113: Exception raising event InfoMessageWeaponUpdate | Id = DM-Trainingday.AssaultRifle | PrimaryAmmo = 100 | SecondaryAmmo = 4 |
(GoalBot1) SEVERE 12:54:52.687 Fatal error happenned - component bus is stopping.
FatalErrorEvent[
Component=UT2004SyncLockableWorldView
Message=Exception raising event InfoMessageWeaponUpdate | Id = DM-Trainingday.AssaultRifle | PrimaryAmmo = 100 | SecondaryAmmo = 4 |
Cause=java.lang.NullPointerException
Cause stacktrace:
cz.cuni.amis.pogamut.ut2004.agent.module.sensomotoric.Weaponry$WeaponUpdateListener.notify(Weaponry.java:839)
cz.cuni.amis.pogamut.ut2004.agent.module.sensomotoric.Weaponry$WeaponUpdateListener.notify(Weaponry.java:834)
cz.cuni.amis.pogamut.base.communication.worldview.impl.AbstractWorldView$ListenerNotifier.notify(AbstractWorldView.java:98)
...


Thanks a lot for helping me.
Tomas
There is a bug in Weaponry module, line 839 there.

There shouldn't be event.getId(), but InventoryType of the weapon with Id. You can get it through getItemTypeForId() in Weaponry.java, but it needs unreal Id, so you need to convert string variable to UnrealId.
Try to put there this:
WeaponDescriptor weaponDesc = (WeaponDescriptor)itemDescriptors.getDescriptor(getItemTypeForId(UnrealId.get(event.getId())));

instead of old:
WeaponDescriptor weaponDesc = (WeaponDescriptor)itemDescriptors.getDescriptor(event.getId());

This is fixed now in repository and will be included in next version. Thx for bug report!

best,
michal
Hi again,

I have a question about retrieving information about current count of ammo of specific weapon. When I use bot.weaponry.getPrimaryWeaponAmmo(ItemType.FLAK_CANNON); I get right number (for example 15), but it is not decreased by shooting (still 15, but bot has already shot in primary mode). When I use bot.agentinfo.getCurrentAmmo(); it returns correct number (14 after shoot), but only for current weapon. Is it bug or feature? :-)

Tomas
Hi!

Sure it's a bug ;-) ... or it will be until we find out that we can't get the right info out of GB2004.

Michal - how are you exporting WeaponUpdate messages? Weaponry depends on them (surely it also watches the Self but as Tomas said, it provides limited info to the agent).

Cheers!
Jimmy
Weaponry module is fixed now. To fix this bug we needed to make changes in GameBots as well, so if you update PogamutUT2004 and gamebots from repository, it should work fine now.

Best,
Michal
Thank You a lot

Tomas
 

News

News RSS RSS feed for News link



Pogamut

Quarterly RSS RSS feed for quarterly reports

Acknowledgement

This work is supported by GA UK 1053/2007/A-INF/MFF (2007-8), GA UK 351/2006/A-INF/MFF (2006-8), the Ministry of Education of the Czech Republic (grant MSM0021620838) (2008-9), by the Program "Information Society" under project 1ET100300517 (2006-9), and the project Integration of IT Tools into Education of Humanities (2006-8) and by the project CZ.2.17/3.1.00/31162, which are financed by the European Social Fund, the state budget of the Czech Republic, and by the budget of Municipal House Prague.