[Pogamut-list] Ammo/Shot tracking

jacob.schrum pogamut-forum at diana.ms.mff.cuni.cz
Thu Jan 17 00:30:17 CET 2013


Ammo/Shot tracking

Author: jacob.schrum

So, something that I have always found a bit annoying about GameBots is the way that there are actions to start and stop shooting, but not really to take a single shot. I know that in general this makes sense, because it corresponds to whether or not a human is holding down the mouse button or not, but it creates some difficulties.

Specifically, I would like to track when the bot actually takes a shot with weapons like the shock rifle, sniper rifle, etc (single shot weapons with a pause between shots), or at the very least track how much ammo the bot spends with any given weapon. The ultimate goal is to track some notion of bot accuracy.

Now, it seems like the most straight-forward way to do this is to remember how much ammo the bot previously had, and update this amount whenever a new Self message comes in. If the new ammo amount is less than the previous amount, then the difference between the two amounts can be counted as ammo spent.

However, this approach runs into problems given that the bot may also be acquiring new ammo for a gun it is using while shooting it, which brings up a question of exactly when certain updates occur. For example, if I track every ItemPickUp message to keep an eye out for both ammo and weapon pickups, I will be able to tell when new ammo is added for a gun. However, at what point does Pogamut actually update its internal data structures regarding new item pickups? If I access the Weaponry class from within a Listener for ItemPickUp messages, and check the amount of ammo that a given weapon has, will the amount be for before or after the currently picked up item is processed? If I try to track weapon ammo counts based on asynchronous messages like ItemPickUp, and I doomed to become out of sync with the ammo counts from Self messages?

Basically, it would be really nice if there were some kind of asynchronous message that indicated whenever ammo was depleted, but I can understand why this doesn't exist, since continued fire with certain weapons means that ammo is depleted continuously.

Basically, any recommendations you have for the easiest/cleanest way to track either ammo use or firing accuracy would be welcome.

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




More information about the Pogamut-list mailing list